You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jadeler <ja...@yahoo.ca> on 2005/10/21 01:56:43 UTC
html:link and jstl
Im having problems trying to build my url using
html:link and jstl. Im iterating over a list using
jstl and I want to pass in the id to the url.
Currently, im doing this:
<c:forEach var="webProduct" items="${webProductList}"
varStatus="loopStatus">
<html:link action='<%= "/StartBuyPolicy?x=" +
Constants.TU_PROD_TRS + "&y=" +
Constants.TU_PLAN_VIS%>'>Buy product</html:link>
</c:forEach>
I want to do something like this:
<c:forEach var="webProduct" items="${webProductList}"
varStatus="loopStatus">
<html:link action='<%= "/StartBuyPolicy?x=" +
${webProduct.id} + "&y=" + ${webProduct.name} %>'>Buy
product</html:link>
</c:forEach>
Any help is appreciated. Thanks.
Jadeler
__________________________________________________________
Find your next car at http://autos.yahoo.ca
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: html:link and jstl
Posted by Laurie Harper <la...@holoweb.net>.
Jadeler wrote:
> Im having problems trying to build my url using
> html:link and jstl. Im iterating over a list using
> jstl and I want to pass in the id to the url.
> Currently, im doing this:
>
> <c:forEach var="webProduct" items="${webProductList}"
> varStatus="loopStatus">
>
> <html:link action='<%= "/StartBuyPolicy?x=" +
> Constants.TU_PROD_TRS + "&y=" +
> Constants.TU_PLAN_VIS%>'>Buy product</html:link>
>
> </c:forEach>
>
> I want to do something like this:
>
> <c:forEach var="webProduct" items="${webProductList}"
> varStatus="loopStatus">
>
> <html:link action='<%= "/StartBuyPolicy?x=" +
> ${webProduct.id} + "&y=" + ${webProduct.name} %>'>Buy
> product</html:link>
>
> </c:forEach>
you've got your JSTL expressions nested inside a scriptlet there; you
can't mix the two like that. Try this instead:
<html:link action=
"/StartBuyPolicy?x=${webProduct.id}&y=${webProduct.name}"
>Buy product</html:link>
Note: I'm not sure if you need the & escape, it might work with just
'&' but it's technically more correct to use the escape.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: html:link and jstl
Posted by Murray Collingwood <mu...@focus-computing.com.au>.
None. How about you Laurie?
Kind regards
mc
On 20 Oct 2005 at 23:42, Jadeler wrote:
> Hey Murray....I tried what you suggested but the
> values dont seem to be resolving. The link becomes
>
>
http://localhost:8080/testapp/StartBuyPolicy.do;jsessionid=8DE06461ADFCD864AF7CD
5657A1C1DFD?x=${webProduct.id}&y=${webProduct.productType}
>
> Im not too sure why I cant output the values. I can
> print out those values via <c:out
> value="${webProduct.id}" /> so I know they exist. Any
> suggestions?
>
> Jadeler
>
> --- Murray Collingwood <mu...@focus-computing.com.au>
> wrote:
>
> > Hi Jadeler
> >
> > Fortunately it's simpler than that... you don't need
> > all that scriptlet stuff. Try this and
> > see if it works.
> >
> > <c:forEach var="webProduct"
> > items="${webProductList}" varStatus="loopStatus">
> >
> > <html:link
> >
> action="/StartBuyPolicy?x=${webProduct.id}&y=${webProduct.name}">
> > Buy product
> > </html:link>
> >
> > </c:forEach>
> >
> > HTH
> > mc
> >
> >
> > On 20 Oct 2005 at 19:56, Jadeler wrote:
> >
> > > Im having problems trying to build my url using
> > > html:link and jstl. Im iterating over a list
> > using
> > > jstl and I want to pass in the id to the url.
> > > Currently, im doing this:
> > >
> > > <c:forEach var="webProduct"
> > items="${webProductList}"
> > > varStatus="loopStatus">
> > >
> > > <html:link action='<%= "/StartBuyPolicy?x=" +
> > > Constants.TU_PROD_TRS + "&y=" +
> > > Constants.TU_PLAN_VIS%>'>Buy product</html:link>
> > >
> > > </c:forEach>
> > >
> > > I want to do something like this:
> > >
> > > <c:forEach var="webProduct"
> > items="${webProductList}"
> > > varStatus="loopStatus">
> > >
> > > <html:link action='<%= "/StartBuyPolicy?x=" +
> > > ${webProduct.id} + "&y=" + ${webProduct.name}
> > %>'>Buy
> > > product</html:link>
> > >
> > > </c:forEach>
> > >
> > > Any help is appreciated. Thanks.
> > >
> > > Jadeler
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> __________________________________________________________
> >
> > > Find your next car at http://autos.yahoo.ca
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail:
> > user-help@struts.apache.org
> > >
> > >
> > >
> > > --
> > > No virus found in this incoming message.
> > > Checked by AVG Anti-Virus.
> > > Version: 7.0.344 / Virus Database: 267.12.4/143 -
> > Release Date: 19/10/2005
> > >
> >
> >
> >
> > FOCUS Computing
> > Mob: 0415 24 26 24
> > murray@focus-computing.com.au
> > http://www.focus-computing.com.au
> >
> >
> >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.344 / Virus Database: 267.12.4/143 -
> > Release Date: 19/10/2005
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> > user-help@struts.apache.org
> >
> >
>
>
>
>
>
>
>
> __________________________________________________________
> Find your next car at http://autos.yahoo.ca
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.12.4/143 - Release Date: 19/10/2005
>
FOCUS Computing
Mob: 0415 24 26 24
murray@focus-computing.com.au
http://www.focus-computing.com.au
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.12.4/143 - Release Date: 19/10/2005
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: html:link and jstl
Posted by Martin Gainty <mg...@hotmail.com>.
Good Call-
The doc located at
http://struts.apache.org/struts-taglib/tagreference-struts-html.html#link
states that an action attribute forward,href,linkName or Page must be
specified
Also because you are passing in a string the EL Tag parser might choke on
special characters
such as $ OR { its a bit of a pain but you may want to consider &#xNNNN
where NNNN is standard hexadecimal representation of UTF-(8/16)
assuming you know the encoding..
Standard caveats apply (YMMV)
Martin-
----- Original Message -----
From: "Wendy Smoak" <ja...@wendysmoak.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Friday, October 21, 2005 1:32 AM
Subject: Re: html:link and jstl
> Jadeler wrote:
>
>> http://localhost:8080/testapp/StartBuyPolicy.do?
>> x=${webProduct.id&y=${webProduct.productType}
>
> The above link seems to be coming from this:
>
>> <html:link
>> action="/StartBuyPolicy?x=${webProduct.id}&y=${webProduct.name}">
>> Buy product
>> </html:link>
>
> What version of the Servlet Specification are you working with and which
> version of the Struts taglibs?
>
> That you mention using <c:out> to print the values implies Servlet 2.3,
> and if so you should be using Struts-EL. Add struts-el.jar to your
> webapp, and change the taglib to:
> <%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html" %>
>
> (If you're on a Servlet 2.4 container... check your configuration, it
> should be evaluating the expressions anywhere in the page.)
>
> --
> Wendy Smoak
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: html:link and jstl
Posted by Jadeler <ja...@yahoo.ca>.
Thanks Wendy. I just needed that library (since im
using servlet 2.3 spec) and now it works.
Jadeler
--- Wendy Smoak <ja...@wendysmoak.com> wrote:
> Jadeler wrote:
>
> > http://localhost:8080/testapp/StartBuyPolicy.do?
> > x=${webProduct.id&y=${webProduct.productType}
>
> The above link seems to be coming from this:
>
> > <html:link
> >
>
action="/StartBuyPolicy?x=${webProduct.id}&y=${webProduct.name}">
> > Buy product
> > </html:link>
>
> What version of the Servlet Specification are you
> working with and which
> version of the Struts taglibs?
>
> That you mention using <c:out> to print the values
> implies Servlet 2.3, and
> if so you should be using Struts-EL. Add
> struts-el.jar to your webapp, and
> change the taglib to:
> <%@ taglib
> uri="http://struts.apache.org/tags-html-el"
> prefix="html" %>
>
> (If you're on a Servlet 2.4 container... check your
> configuration, it should
> be evaluating the expressions anywhere in the page.)
>
> --
> Wendy Smoak
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
>
>
__________________________________________________________
Find your next car at http://autos.yahoo.ca
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: html:link and jstl
Posted by Wendy Smoak <ja...@wendysmoak.com>.
Jadeler wrote:
> http://localhost:8080/testapp/StartBuyPolicy.do?
> x=${webProduct.id&y=${webProduct.productType}
The above link seems to be coming from this:
> <html:link
> action="/StartBuyPolicy?x=${webProduct.id}&y=${webProduct.name}">
> Buy product
> </html:link>
What version of the Servlet Specification are you working with and which
version of the Struts taglibs?
That you mention using <c:out> to print the values implies Servlet 2.3, and
if so you should be using Struts-EL. Add struts-el.jar to your webapp, and
change the taglib to:
<%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html" %>
(If you're on a Servlet 2.4 container... check your configuration, it should
be evaluating the expressions anywhere in the page.)
--
Wendy Smoak
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: html:link and jstl
Posted by Jadeler <ja...@yahoo.ca>.
Hey Murray....I tried what you suggested but the
values dont seem to be resolving. The link becomes
http://localhost:8080/testapp/StartBuyPolicy.do;jsessionid=8DE06461ADFCD864AF7CD5657A1C1DFD?x=${webProduct.id}&y=${webProduct.productType}
Im not too sure why I cant output the values. I can
print out those values via <c:out
value="${webProduct.id}" /> so I know they exist. Any
suggestions?
Jadeler
--- Murray Collingwood <mu...@focus-computing.com.au>
wrote:
> Hi Jadeler
>
> Fortunately it's simpler than that... you don't need
> all that scriptlet stuff. Try this and
> see if it works.
>
> <c:forEach var="webProduct"
> items="${webProductList}" varStatus="loopStatus">
>
> <html:link
>
action="/StartBuyPolicy?x=${webProduct.id}&y=${webProduct.name}">
> Buy product
> </html:link>
>
> </c:forEach>
>
> HTH
> mc
>
>
> On 20 Oct 2005 at 19:56, Jadeler wrote:
>
> > Im having problems trying to build my url using
> > html:link and jstl. Im iterating over a list
> using
> > jstl and I want to pass in the id to the url.
> > Currently, im doing this:
> >
> > <c:forEach var="webProduct"
> items="${webProductList}"
> > varStatus="loopStatus">
> >
> > <html:link action='<%= "/StartBuyPolicy?x=" +
> > Constants.TU_PROD_TRS + "&y=" +
> > Constants.TU_PLAN_VIS%>'>Buy product</html:link>
> >
> > </c:forEach>
> >
> > I want to do something like this:
> >
> > <c:forEach var="webProduct"
> items="${webProductList}"
> > varStatus="loopStatus">
> >
> > <html:link action='<%= "/StartBuyPolicy?x=" +
> > ${webProduct.id} + "&y=" + ${webProduct.name}
> %>'>Buy
> > product</html:link>
> >
> > </c:forEach>
> >
> > Any help is appreciated. Thanks.
> >
> > Jadeler
> >
> >
> >
> >
> >
> >
> >
>
__________________________________________________________
>
> > Find your next car at http://autos.yahoo.ca
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> >
> >
> >
> > --
> > No virus found in this incoming message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.344 / Virus Database: 267.12.4/143 -
> Release Date: 19/10/2005
> >
>
>
>
> FOCUS Computing
> Mob: 0415 24 26 24
> murray@focus-computing.com.au
> http://www.focus-computing.com.au
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.12.4/143 -
> Release Date: 19/10/2005
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
>
>
__________________________________________________________
Find your next car at http://autos.yahoo.ca
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: html:link and jstl
Posted by Murray Collingwood <mu...@focus-computing.com.au>.
Hi Jadeler
Fortunately it's simpler than that... you don't need all that scriptlet stuff. Try this and
see if it works.
<c:forEach var="webProduct" items="${webProductList}" varStatus="loopStatus">
<html:link action="/StartBuyPolicy?x=${webProduct.id}&y=${webProduct.name}">
Buy product
</html:link>
</c:forEach>
HTH
mc
On 20 Oct 2005 at 19:56, Jadeler wrote:
> Im having problems trying to build my url using
> html:link and jstl. Im iterating over a list using
> jstl and I want to pass in the id to the url.
> Currently, im doing this:
>
> <c:forEach var="webProduct" items="${webProductList}"
> varStatus="loopStatus">
>
> <html:link action='<%= "/StartBuyPolicy?x=" +
> Constants.TU_PROD_TRS + "&y=" +
> Constants.TU_PLAN_VIS%>'>Buy product</html:link>
>
> </c:forEach>
>
> I want to do something like this:
>
> <c:forEach var="webProduct" items="${webProductList}"
> varStatus="loopStatus">
>
> <html:link action='<%= "/StartBuyPolicy?x=" +
> ${webProduct.id} + "&y=" + ${webProduct.name} %>'>Buy
> product</html:link>
>
> </c:forEach>
>
> Any help is appreciated. Thanks.
>
> Jadeler
>
>
>
>
>
>
> __________________________________________________________
> Find your next car at http://autos.yahoo.ca
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.12.4/143 - Release Date: 19/10/2005
>
FOCUS Computing
Mob: 0415 24 26 24
murray@focus-computing.com.au
http://www.focus-computing.com.au
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.12.4/143 - Release Date: 19/10/2005
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org