File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » JSP
Bookmark "dynamic hyperlink (struts & ?JSTL)" Watch "dynamic hyperlink (struts & ?JSTL)" New topic

dynamic hyperlink (struts & ?JSTL)

Ro Dowd

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"/>

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"/>

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

Joined: Jan 10, 2002
Posts: 63862

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] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63862

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

Joined: Jul 06, 2005
Posts: 1580
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?
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>.
I agree. Here's the link:
subject: dynamic hyperlink (struts & ?JSTL)
It's not a secret anymore!