Solved

how to deliver the url string  as a parameter in the url

Posted on 2001-06-03
4
208 Views
Last Modified: 2010-08-05
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='/servlet/page.go?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("testname");
      String url      = request.getParameter("url");
      String pagerow  = request.getParameter("pagerow");
      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?pagenum=1
<br>
pagerow=3

</body>

the url string was trucated.Can you give me some advices,Thank you first.
0
Comment
Question by:jianmin
  • 3
4 Comments
 
LVL 3

Accepted Solution

by:
ibo earned 100 total points
ID: 6151582
white spaces is not allowed in url (in between parameters)
u can use the method :
java.net.URLEncoder.encode(myString)
to encode special characters and string w/ white spaces
into a valid url.
0
 
LVL 3

Expert Comment

by:ibo
ID: 6151603

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/testurl.jsp?url=").append(java.net.URLEncoder.encode('/servlet/page.go?pagenum=1&pa=adb').append("&pagerow=3">);
0
 
LVL 3

Expert Comment

by:ibo
ID: 6151609
..

<form name="form1" method="post" action="<%= myUrl.toString() %>">
0
 

Expert Comment

by:SpideyMod
ID: 8289448
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JList custom Cell Renderer refresh 15 53
eclipse argument 14 53
Java Loop 6 50
servlet filter example 37 46
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now