servlets - Get Exact URL in JSP -


hi have jsp page loading after executing action class , returning view. url http://localhost/search.do?operation=searchdata&place=bangalore , in jsp page need use complete url , append more parameters url , send request. question how exact url in jsp there in address bar???? used following ways not giving me expected

<%=request.getrequesturl() %> <%=request.getrequesturi() %> <%=request.getservletpath() %> 

these gives me following

http://localhost/jsp/gridsearch.jsp  /jsp/gridsearch.jsp  /jsp/gridsearch.jsp 

respectively. there way exact address there in address bar? http://localhost/search.do?operation=searchdata&place=bangalore

there isn't single method returns along lines of following should work.

<%=request.getrequesturl().append(request.getquerystring() == null ? "" : "?" +  request.getquerystring())%> 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -