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

dynamic hyperlink (struts & ?JSTL)

 
Ro Dowd
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm trying to create a dynamic hyperlink using struts (v1.2.8) and JSTL as below:

<html:link action="MyGenericLink">
<fmt:message key="cancel.button"/>
</html:link>


I want to ensure that MyGenericLinkis whatever the user passes in in the request (in a request parameter called link eg)

i'm trying to

<html:link action="<%= request.getParameter(�link�) %>">
<fmt:message key="cancel.button"/>
</html:link>

this doesnt seem to work, is there a handier way? maybe JSTL only? can someone provide me with a code sample if pos?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
with a code sample if pos?


"pos" is not a word. Please use real words when posting to the Ranch.
[ November 03, 2006: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sure you can do what you need to do in pure JSTL and EL. Rather than relying upon people knowing what the proprietary Struts tags do, why not post what you are trying to accomplish?
 
Stefan Evans
Bartender
Posts: 1779
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you have posted there should theoretically work.
You say it doesn't - what doesn't work about it?

You are wanting the resulting url to come from a request parameter.
Who sets this request parameter?
What possible values can it take? You are using the "action" attribute with the struts tag which means it should link to a defined struts action.
If you want to link to a URL you should use the href attribute instead maybe?

http://struts.apache.org/1.2.9/userGuide/struts-html.html#link
 
Em Aiy
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Bear: thread hi-jack removed. Please start your own question in your own topic.]
[ January 17, 2007: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic