This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes URL Parameters AND Encode in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "URL Parameters AND Encode in JSP" Watch "URL Parameters AND Encode in JSP" New topic
Author

URL Parameters AND Encode in JSP

ming wu
Greenhorn

Joined: Oct 07, 2001
Posts: 1
Hello all:
I have some problems with my jsp code, they have been bothering me for days.
I was trying to create a dynamic form which should displayed all the records stored in the Oracle database. Each record would be a hyper link, when you click it, you would be directed to another Edit page.
The way I am using to do the above is, get the file number from record set by rs.getString( "XXXX" ), then encode it and add it to the URL.
The code example is here:
out.println(" <td>");
out.println("<a href=\"FileRecord.jsp?" + "FileNumber=" +
java.net.URLEncoder.encode ( rs.getString("f_FILENUMBER") )+ "&\" ><font style=\"font-size: 10pt; font-family: Arial, Tahoma \">" + rs.getString("f_FILENUMBER") +"</font></a>");
/* f_FILENUMBER is the alies for the column FileNumber. */
out.println("</td>" );
And I've also tried another way: create a new StringBuffer, then append the URL and paramters to it. But neither of them worked. I really can't figure out why and how to solve the problem. If I can't append the parameters to the URL, then the next Edit page wouldn't be able to get the parameters and find the right file record.
Can anybody please help me out? Thank you very much.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: URL Parameters AND Encode in JSP
 
Similar Threads
Is there any one who can help me...Please?
multipart download servlet
A href command not working
Passing parameter from popup
Why can I display one statement only?!