This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Struts and the fly likes http GET links Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "http GET links" Watch "http GET links" New topic

http GET links

Dushy Inguva
Ranch Hand

Joined: Jun 24, 2003
Posts: 264
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> ;

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

Joined: Feb 05, 2003
Posts: 4727

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.

A good workman is known by his tools.
Don't get me started about those stupid light bulbs.
subject: http GET links