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 "Renick, Garrel" <ga...@more.net> on 2003/02/07 00:40:13 UTC
Using Standard Tag Library to Display a Request Attribute
I'm struggling with displaying a request attribute with the
Standard tag library. I would like to display the
javax.servlet.error.message request attribute, but nothing
is displaying. The following format doesn't display anything:
<c:out value="${requestScope.javax.servlet.error.message}" />
However, I can see an error message if I use this:
<c:out value="${pageContext.exception.message}"/>
Is there a trick to displaying request attributes with
JSTL? Is the expression language interpreting the periods
in the attribute name?
Regards,
Garrel Renick
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: ELSE for JSTL
Posted by Shawn Bayern <ba...@essentially.net>.
On Sat, 8 Feb 2003, Henri Yandell wrote:
> Why not:
>
> <c:if test="...">
> <c:do>
> foo
> </c:do>
> <c:else>
> bar
> </c:else>
> </c:if>
>
> ?? Just to make it a bit nicer in xml look and feel.
>
> Which of course is synonymous to choose I think :)
Yes, exactly. The <c:choose>, <c:when>, and <c:otherwise> tags simply
provide a more generalized syntax since they allow multiple conditions.
During the JSR-52 EG's deliberations, most of the members felt that there
were definite advantages to a simple <c:if> tag unencumbered by multi-way
conditions; no matter where a <c:if> tag appears, its body is included if
'test' is true and excluded otherwise. Either way, evaluation continues
after the closing </c:if> tag. Particularly for large and complex pages,
this kind of simplicity -- for, after all, a task that is one of JSTL's
simplest functions -- was considered desirable.
Note also that XSLT faced an identical problem (or at least a very similar
one) and came to the same conclusions.
--
Shawn Bayern
"JSTL in Action" http://www.manning.com/bayern
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: ELSE for JSTL
Posted by Henri Yandell <ba...@generationjava.com>.
On Sat, 8 Feb 2003, Mirko Nasato wrote:
> Henri Yandell wrote:
>
> >On Fri, 7 Feb 2003, Ivonne Barrantes wrote:
> >
> >
> >>? When we'll be able to enjoy the beneficts of our beloved "ELSE" for JSTL ?
> >>
> >>I know we have the <c:choose> tag, but it takes more code lines then a
> >>simple <c:else>
> >>
> >>What do you think about it Shawn?
> >>
> >>
> >
> >Shawn mentioned it in a post a week back or so I think. Unsure if it was
> >on Dev or Users. Basically the problem with <c:else> is that there's no
> >container tag:
> >
> ><c:if..>
> ></c:if>
> ><c:else>
> ></c:else>
> >
> >so it's probably a pain to implement.
> >
> >
> Why not something like:
>
> <c:if test="...">
> foo
> <c:else>
> bar
> </c:else>
> </c:if>
Why not:
<c:if test="...">
<c:do>
foo
</c:do>
<c:else>
bar
</c:else>
</c:if>
?? Just to make it a bit nicer in xml look and feel.
Which of course is synonymous to choose I think :)
Hen
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: ELSE for JSTL
Posted by Mirko Nasato <mi...@email.it>.
Henri Yandell wrote:
>On Fri, 7 Feb 2003, Ivonne Barrantes wrote:
>
>
>>? When we'll be able to enjoy the beneficts of our beloved "ELSE" for JSTL ?
>>
>>I know we have the <c:choose> tag, but it takes more code lines then a
>>simple <c:else>
>>
>>What do you think about it Shawn?
>>
>>
>
>Shawn mentioned it in a post a week back or so I think. Unsure if it was
>on Dev or Users. Basically the problem with <c:else> is that there's no
>container tag:
>
><c:if..>
></c:if>
><c:else>
></c:else>
>
>so it's probably a pain to implement.
>
>
Why not something like:
<c:if test="...">
foo
<c:else>
bar
</c:else>
</c:if>
Regards.
\mirko
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: ELSE for JSTL
Posted by Henri Yandell <ba...@generationjava.com>.
On Fri, 7 Feb 2003, Ivonne Barrantes wrote:
>
> � When we'll be able to enjoy the beneficts of our beloved "ELSE" for JSTL ?
>
> I know we have the <c:choose> tag, but it takes more code lines then a
> simple <c:else>
>
> What do you think about it Shawn?
Shawn mentioned it in a post a week back or so I think. Unsure if it was
on Dev or Users. Basically the problem with <c:else> is that there's no
container tag:
<c:if..>
</c:if>
<c:else>
</c:else>
so it's probably a pain to implement.
However, it's probably worth trying outside of JSTL to see if it's
possible :) Any interest in working on an else tag? Either one that worked
with <c:if> or had its own <xx:if> tag would be a good way to show the
JSTL JSR group that such a thing is possible.
I'll add it to the list I've started compiling of useful tags to code to
compliment the JSTL.
Hen
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
ELSE for JSTL
Posted by Ivonne Barrantes <ib...@ods.co.cr>.
¿ When we'll be able to enjoy the beneficts of our beloved "ELSE" for JSTL ?
I know we have the <c:choose> tag, but it takes more code lines then a
simple <c:else>
What do you think about it Shawn?
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: Using Standard Tag Library to Display a Request Attribute
Posted by Shawn Bayern <ba...@essentially.net>.
On Thu, 6 Feb 2003, Renick, Garrel wrote:
> <c:out value="${requestScope.javax.servlet.error.message}" />
>
> Is there a trick to displaying request attributes with JSTL? Is the
> expression language interpreting the periods in the attribute name?
Yes, it is. To avoid this, you can use expressions like the following:
<c:out value="${requestScope['javax.servlet.error.message']}" />
The [] syntax works wherever . works, but it lets you avoid problems when
the property name itself contains a period.
--
Shawn Bayern
"JSTL in Action" http://www.manning.com/bayern
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org