jianmin
asked on
how to deliver the url string as a parameter in the url
I want to deliver the url string as a request parameter to next page ,but the system trucate some information.the part codes are showed as follows.
the html code:
<html>
<body>
<form name="form1" method="post" action="/test/testurl.jsp? url='/serv let/page.g o?pagenum= 1&pa=adb'& pagerow=3" >
<INPUT TYPE="text" NAME="testname" >
<INPUT TYPE="submit" NAME="commit" ID="commit" VALUE="commit">
</form>
testurl.jsp:
<html>
<body>
URL test
<%
String testname = request.getParameter("test name");
String url = request.getParameter("url" );
String pagerow = request.getParameter("page row");
out.println("testname=" + testname);
out.println("<br>");
out.println("url=" + url);
out.println("<br>");
out.println("pagerow=" + pagerow);
%>
</body>
the result page:
<html>
<body>
URL test
testname=dgdfgdssdgfdsgfsd
<br>
url=/servlet/page.go?pagen um=1
<br>
pagerow=3
</body>
the url string was trucated.Can you give me some advices,Thank you first.
the html code:
<html>
<body>
<form name="form1" method="post" action="/test/testurl.jsp?
<INPUT TYPE="text" NAME="testname" >
<INPUT TYPE="submit" NAME="commit" ID="commit" VALUE="commit">
</form>
testurl.jsp:
<html>
<body>
URL test
<%
String testname = request.getParameter("test
String url = request.getParameter("url"
String pagerow = request.getParameter("page
out.println("testname=" + testname);
out.println("<br>");
out.println("url=" + url);
out.println("<br>");
out.println("pagerow=" + pagerow);
%>
</body>
the result page:
<html>
<body>
URL test
testname=dgdfgdssdgfdsgfsd
<br>
url=/servlet/page.go?pagen
<br>
pagerow=3
</body>
the url string was trucated.Can you give me some advices,Thank you first.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
..
<form name="form1" method="post" action="<%= myUrl.toString() %>">
<form name="form1" method="post" action="<%= myUrl.toString() %>">
Force Accepted
SpideyMod
Community Support Moderator @Experts Exchange
SpideyMod
Community Support Moderator @Experts Exchange
and yes.. the single quote is not allowed (special char bot allowed in url addy). use the method i mentioned.
StringBuffer myUrl = new StringBuffer();
myUrl.append("/test/testur