You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by otisg <ot...@ureach.com> on 2003/04/18 21:31:21 UTC

${param.ParamHere} doesn't work

Hello,

Using 1.0.3 release of Jakarta Taglibs, I am unable to get the
request parameter by using this in the JSP when I invoke my
servlet as /something/Action.do?oink=boink:

Request param 'oink': ${param.oink}

This does not get evaluated, and I see the above printed as a
literal in the resulting page.

According to this article by Hans Bergsten, that should work:
  http://www.onjava.com/pub/a/onjava/2002/08/14/jstl1.html


I have also tried accessing Map elements like this:

In servlet:
        Map myMap = new HashMap();
        myMap.put("dingle", "berry");
        request.setAttribute("map", myMap);

In JSP neither of these two statements got evaluated:

${map.dingle}$
${map["dingle"]}$

The above is also supposed to work, according to the same
article further up.


The JSP does have this in it:
  <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

Thank you,
Otis


________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: ${param.ParamHere} doesn't work

Posted by Michael Duffy <du...@yahoo.com>.
Henri,

Of course you're correct.  I had that head slapping
epiphany at the grocery store soon after I sent my
note.  I came home, looked in Shawn Bayern's book, and
realized that I could next the <c:out> tag exactly as
you say.  

Sorry for the bother, and thank you for your patient
advice.  It's right on the money, of course. 
Sincerely, MOD


--- Henri Yandell <ba...@generationjava.com> wrote:
> 
> 
> 
> On Sat, 19 Apr 2003, Michael Duffy wrote:
> 
> >
> > I have two pages where I'm trying to pass the
> value of
> > a radio button from the first to the second page. 
> The
> > second page uses the radio button value in an SQL
> > query.
> >
> > The first page has a table where the first column
> is a
> > radio button:
> >
> > <input type="radio" name="conferenceId"
> > value="${conference.id}">
> 
> <input> isn't a JSTL tag. You need:
> 
> <input type="radio" name="conferenceId"
> value="<c:out
> value='${conference.id}"/>">
> 
> This assumes you're not using JSP 2.0 with Tomcat 5.
> 
> > The conference.id value is an integer from an SQL
> > query.
> >
> > When I submit and go to the second page I
> immediately
> > try to print out the value:
> >
> > <c:out value="Selected Conference ID is
> > ${param.conferenceId}"/>
> >
> > I get the string "Selected Conference ID is
> > ${conference.id}" in the browser response from the
> > second page.
> >
> > I'm using EL in JSTL tags and nowhere else.  Why
> don't
> > I get the integer value from the radio button? 
> I'm
> > sure it'll be a head-slapper, but I don't see it.
> > Thank you. - MOD
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: ${param.ParamHere} doesn't work

Posted by Henri Yandell <ba...@generationjava.com>.


On Sat, 19 Apr 2003, Michael Duffy wrote:

>
> I have two pages where I'm trying to pass the value of
> a radio button from the first to the second page.  The
> second page uses the radio button value in an SQL
> query.
>
> The first page has a table where the first column is a
> radio button:
>
> <input type="radio" name="conferenceId"
> value="${conference.id}">

<input> isn't a JSTL tag. You need:

<input type="radio" name="conferenceId" value="<c:out
value='${conference.id}"/>">

This assumes you're not using JSP 2.0 with Tomcat 5.

> The conference.id value is an integer from an SQL
> query.
>
> When I submit and go to the second page I immediately
> try to print out the value:
>
> <c:out value="Selected Conference ID is
> ${param.conferenceId}"/>
>
> I get the string "Selected Conference ID is
> ${conference.id}" in the browser response from the
> second page.
>
> I'm using EL in JSTL tags and nowhere else.  Why don't
> I get the integer value from the radio button?  I'm
> sure it'll be a head-slapper, but I don't see it.
> Thank you. - MOD


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: ${param.ParamHere} doesn't work

Posted by Michael Duffy <du...@yahoo.com>.
I have two pages where I'm trying to pass the value of
a radio button from the first to the second page.  The
second page uses the radio button value in an SQL
query.

The first page has a table where the first column is a
radio button:

<input type="radio" name="conferenceId"
value="${conference.id}">

The conference.id value is an integer from an SQL
query.

When I submit and go to the second page I immediately
try to print out the value:

<c:out value="Selected Conference ID is
${param.conferenceId}"/>

I get the string "Selected Conference ID is
${conference.id}" in the browser response from the
second page. 

I'm using EL in JSTL tags and nowhere else.  Why don't
I get the integer value from the radio button?  I'm
sure it'll be a head-slapper, but I don't see it. 
Thank you. - MOD

--- Hans Bergsten <ha...@gefionsoftware.com> wrote:
> otisg wrote:
> > Hello,
> > 
> > Using 1.0.3 release of Jakarta Taglibs, I am
> unable to get the
> > request parameter by using this in the JSP when I
> invoke my
> > servlet as /something/Action.do?oink=boink:
> > 
> > Request param 'oink': ${param.oink}
> > 
> > This does not get evaluated, and I see the above
> printed as a
> > literal in the resulting page.
> > 
> > According to this article by Hans Bergsten, that
> should work:
> >  
>
http://www.onjava.com/pub/a/onjava/2002/08/14/jstl1.html
> > 
> > 
> > I have also tried accessing Map elements like
> this:
> > 
> > In servlet:
> >         Map myMap = new HashMap();
> >         myMap.put("dingle", "berry");
> >         request.setAttribute("map", myMap);
> > 
> > In JSP neither of these two statements got
> evaluated:
> > 
> > ${map.dingle}$
> > ${map["dingle"]}$
> > 
> > The above is also supposed to work, according to
> the same
> > article further up.
> > 
> > 
> > The JSP does have this in it:
> >   <%@ taglib prefix="c"
> uri="http://java.sun.com/jstl/core" %>
> 
> It's not clear from your description, but it sounds
> like you're
> using the EL expressions directly in template text.
> That's not
> supported in JSP 1.2 (but will be in JSP 2.0). With
> JSP 1.2, EL
> expressions can only be used in JSTL attribute
> values, e.g.:
> 
>    Request param 'oink': <c:out
> value="${param.oink}" />
> 
> I say so in the article, but maybe not clear enough.
> I hope this
> helps.
> 
> Hans
> -- 
> Hans Bergsten                               
> <ha...@gefionsoftware.com>
> Gefion Software                      
> <http://www.gefionsoftware.com/>
> Author of O'Reilly's "JavaServer Pages", covering
> JSP 1.2 and JSTL 1.0
> Details at                                   
> <http://TheJSPBook.com/>
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: ${param.ParamHere} doesn't work

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
otisg wrote:
> Hello,
> 
> Using 1.0.3 release of Jakarta Taglibs, I am unable to get the
> request parameter by using this in the JSP when I invoke my
> servlet as /something/Action.do?oink=boink:
> 
> Request param 'oink': ${param.oink}
> 
> This does not get evaluated, and I see the above printed as a
> literal in the resulting page.
> 
> According to this article by Hans Bergsten, that should work:
>   http://www.onjava.com/pub/a/onjava/2002/08/14/jstl1.html
> 
> 
> I have also tried accessing Map elements like this:
> 
> In servlet:
>         Map myMap = new HashMap();
>         myMap.put("dingle", "berry");
>         request.setAttribute("map", myMap);
> 
> In JSP neither of these two statements got evaluated:
> 
> ${map.dingle}$
> ${map["dingle"]}$
> 
> The above is also supposed to work, according to the same
> article further up.
> 
> 
> The JSP does have this in it:
>   <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

It's not clear from your description, but it sounds like you're
using the EL expressions directly in template text. That's not
supported in JSP 1.2 (but will be in JSP 2.0). With JSP 1.2, EL
expressions can only be used in JSTL attribute values, e.g.:

   Request param 'oink': <c:out value="${param.oink}" />

I say so in the article, but maybe not clear enough. I hope this
helps.

Hans
-- 
Hans Bergsten                                <ha...@gefionsoftware.com>
Gefion Software                       <http://www.gefionsoftware.com/>
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at                                    <http://TheJSPBook.com/>


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: ${param.ParamHere} doesn't work

Posted by Michael Duffy <du...@yahoo.com>.
I'm having this very problem, too.  I followed the
directions out of Shawn B.'s book, and I get the same
kind of output.

Anybody have a solution or workaround?  - MOD


--- otisg <ot...@ureach.com> wrote:
> Hello,
> 
> Using 1.0.3 release of Jakarta Taglibs, I am unable
> to get the
> request parameter by using this in the JSP when I
> invoke my
> servlet as /something/Action.do?oink=boink:
> 
> Request param 'oink': ${param.oink}
> 
> This does not get evaluated, and I see the above
> printed as a
> literal in the resulting page.
> 
> According to this article by Hans Bergsten, that
> should work:
>  
>
http://www.onjava.com/pub/a/onjava/2002/08/14/jstl1.html
> 
> 
> I have also tried accessing Map elements like this:
> 
> In servlet:
>         Map myMap = new HashMap();
>         myMap.put("dingle", "berry");
>         request.setAttribute("map", myMap);
> 
> In JSP neither of these two statements got
> evaluated:
> 
> ${map.dingle}$
> ${map["dingle"]}$
> 
> The above is also supposed to work, according to the
> same
> article further up.
> 
> 
> The JSP does have this in it:
>   <%@ taglib prefix="c"
> uri="http://java.sun.com/jstl/core" %>
> 
> Thank you,
> Otis
> 
> 
> ________________________________________________
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: ${param.ParamHere} doesn't work

Posted by Henri Yandell <ba...@generationjava.com>.
Isn't that JSP 2.0? ie) you need to do:

<c:out value="${param.oink}"/> in JSP 1.2.

On Fri, 18 Apr 2003, otisg wrote:

> Hello,
>
> Using 1.0.3 release of Jakarta Taglibs, I am unable to get the
> request parameter by using this in the JSP when I invoke my
> servlet as /something/Action.do?oink=boink:
>
> Request param 'oink': ${param.oink}
>
> This does not get evaluated, and I see the above printed as a
> literal in the resulting page.
>
> According to this article by Hans Bergsten, that should work:
>   http://www.onjava.com/pub/a/onjava/2002/08/14/jstl1.html
>
>
> I have also tried accessing Map elements like this:
>
> In servlet:
>         Map myMap = new HashMap();
>         myMap.put("dingle", "berry");
>         request.setAttribute("map", myMap);
>
> In JSP neither of these two statements got evaluated:
>
> ${map.dingle}$
> ${map["dingle"]}$
>
> The above is also supposed to work, according to the same
> article further up.
>
>
> The JSP does have this in it:
>   <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
>
> Thank you,
> Otis
>
>
> ________________________________________________
> Get your own "800" number
> Voicemail, fax, email, and a lot more
> http://www.ureach.com/reg/tag
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org