Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

URL Parameters AND Encode in JSP  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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=" + ( 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!