wood burning stoves 2.0*
The moose likes JSP and the fly likes dynamic hyperlink (struts & ?JSTL) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "dynamic hyperlink (struts & ?JSTL)" Watch "dynamic hyperlink (struts & ?JSTL)" New topic
Author

dynamic hyperlink (struts & ?JSTL)

Ro Dowd
Greenhorn

Joined: Jul 10, 2006
Posts: 22
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

Joined: Jan 10, 2002
Posts: 60783
    
  65

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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60783
    
  65

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

Joined: Jul 06, 2005
Posts: 1016
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

Joined: May 11, 2006
Posts: 226
[Bear: thread hi-jack removed. Please start your own question in your own topic.]
[ January 17, 2007: Message edited by: Bear Bibeault ]

The difference between <b>failure</b> and <b>success</b> is often being <b>right</b> and being <b>exactly right</b>.
 
 
subject: dynamic hyperlink (struts & ?JSTL)
 
Similar Threads
Equivalent of System.getProperty in JSP
html:link tag
Hyper Link
Help with html:link
JSTL formating is not working after setting the locale