Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to retrieve value from a link

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

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