You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Fred Livingston <FL...@physiome.com> on 2002/01/30 21:53:29 UTC

RE: Need help with html:link and passing parameters on the querys tring

Hi Kevin:

Here is how I used the html:link, but it is used with a bean.

This code:

<html:link page="/delete.do?type=user" paramId="userName"
paramName="userSearchResults" paramProperty="userName">Delete</html:link>

produces:

http://protege:8080/physiome/delete.do?type=user&userName=JFERNANDEZ

basically, it assigns a parmeter called userName the values of the property
(parameProperty) from the bean (paramName). If you want to have more than
one dynamic parameter then you will have to use a Map (in the html:link
documentation). 

Maybe you could add the request.getParameter() to a bean (using a struts
tag?) before using the html:link?

-Fred


> -----Original Message-----
> From: Kevin J. Turner [mailto:kturner@dceg.com]
> Sent: Wednesday, January 30, 2002 3:40 PM
> To: Struts Users Mailing List
> Subject: Need help with html:link and passing parameters on the
> querystring
> 
> I am trying to use the Struts tag, html:link, but I don't think I
> understand its usage. Basically all I want to do is create a link to a
> page in my application and one or more dynamic parameters in the query
> string.
> 
> The non-Struts JSP link went something like this:
> 
> <a href=" <http://localhost:8080/myapp/foo.jsp?service=<%=
> request.getParameter(service_name>
> http://localhost:8080/myapp/foo.jsp?service=<%=
> request.getParameter(service_name) %>">Service</a>
> 
> I am trying to figure out the Struts equivalent but I am not having any
> luck. I tried something like this:
> 
> <html:link page="/foo.jsp?service=<%= request.getParameter("service")
> %>">Service</html:link>
> 
> ... but it doesn't like the usage of the request.getParameter(). Can
> anyone help?
> 
> I read the Struts documentation and browsed the struts-example app code
> but I'm still not getting this.
> 
> K.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Need help with html:link and passing parameters on the querystring

Posted by Konstantina Stamopoulou <st...@intracom.gr>.
Hello,

I needed to do exactly the same thing and this is what I used in my .jsp:

 <jsp:useBean id="info" class="java.util.HashMap" scope="session"/>

 <%info.put("provider", request.getParameter("provider");
        info.put("subs", request.getParameter("subs"));%>

<html:link page="/details.do" name="info" > Show details </html:link>

This results to page: /details.do?provider=my provider&subs=mysubs.

Konstantina


> > -----Original Message-----
> > From: Kevin J. Turner [mailto:kturner@dceg.com]
> > Sent: Wednesday, January 30, 2002 3:40 PM
> > To: Struts Users Mailing List
> > Subject: Need help with html:link and passing parameters on the
> > querystring
> >
> > I am trying to use the Struts tag, html:link, but I don't think I
> > understand its usage. Basically all I want to do is create a link to a
> > page in my application and one or more dynamic parameters in the query
> > string.
> >
> > The non-Struts JSP link went something like this:
> >
> > <a href=" <http://localhost:8080/myapp/foo.jsp?service=<%=
> > request.getParameter(service_name>
> > http://localhost:8080/myapp/foo.jsp?service=<%=
> > request.getParameter(service_name) %>">Service</a>
> >
> > I am trying to figure out the Struts equivalent but I am not having any
> > luck. I tried something like this:
> >
> > <html:link page="/foo.jsp?service=<%= request.getParameter("service")
> > %>">Service</html:link>
> >
> > ... but it doesn't like the usage of the request.getParameter(). Can
> > anyone help?
> >
> > I read the Struts documentation and browsed the struts-example app code
> > but I'm still not getting this.
> >
> > K.
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>