Solved

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

Posted on 2001-06-03
4
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Certificat to iSeries KeyStore 1 31
difference between sorce folder and folder in eclipise 3 65
spring maven example issues 3 110
batch vs regular insert in spring DAO 2 53
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

752 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