jsp - how to remove parameter from url when redirecting to get method in `Java` -


i want remove parameter url coming headerinterceptor.java in posthandle method when load method after redirect post method.

what written in headerinterceptor.java file

modelandview.addobject("roleid", stu.getroleid());

so, when redirect post method , url come is: http://localhost:8080/system/studentlist.htm?roleid=23

so, here want remove ?roleid=23.

following code written in post method:

string referer = request.getheader("referer"); return "redirect:"+referer;

but m not able see parameter in referer string.

the code tried in post method : redirectview redirectview = new redirectview("?"); redirectview.setexposemodelattributes(false);

but still showing same url parameter.

any appreciated. :)

you can manually remove url parameters calling string newurl = url.substring(0, url.indexof("?"));


Comments