This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes How to retrieve value from a link Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to retrieve value from a link " Watch "How to retrieve value from a link " New topic
Author

How to retrieve value from a link

Gaurav Chhabras
Ranch Hand

Joined: Sep 21, 2005
Posts: 126
Hello

I am new to struts and i have a link on one page.The link is like that -:

http://localhost:8080/abc.jsp?id=786

now when i reached abc.jsp , then please tell me that how to retrieve the value of id from the link with the help of any struts tag.
This is the case for URL rewritting.

Thanks
Regards
Gaurav
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If you use the tag:

<bean:parameter id="id" name="id" />

Struts creates an id variable as a String in page scope. You can then use this variable as you would any other bean, as in:

<bean:write name="id"/>

Now that I've answered your question, I'll mention that a great many Struts developers (myself included) prefer to use JSTL tags over Struts tags whenever either will do the job. JSTL tags are more standard throughout the Java community, and they are more powerful.

<cut value="${param.id}" /> will do the same job a little more elegantly.
[ January 29, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
 
subject: How to retrieve value from a link
 
Similar Threads
Problem While Running Jsp Error Page.
Getting 500 Error While Running JSP.
Java access parameter pass by URL
invoking an action from a JSP page
request.getRequestURI() problem