Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

http GET links

 
Dushy Inguva
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For http GET links, a JSP can expect 2 params. While composing this link, an ugly syntax has to be followed. Example: UserSubmit.jsp?UserID=<dynamicallyGenerated>&UserAge=<SomeMoreDynamicStuff>
This kind of syntax is problematic if a '&' is missed or if the dynamic stuff has spaces.
The solution we are thinking of is a helper class
URLGetLink link = new URLGetLink("UserSubmit.jsp");
link.addParam("UserID",<dynamicallyGeneratedStuff> ;
link.print(stream);

And use this from a custom tag, so that there is no java in the JSP pages. Is there a simpler way of doing this ?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd recommend saving those two values to session scope if you need them for each request. It will make things prettier for the user and have higher security for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic