You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marco Mistroni <mm...@waersystems.com> on 2005/07/26 16:36:10 UTC
STruts-EL
Hello all,
Anyone can suggest me a good link from where I can learn
Struts-EL?
Thanx and regards
Marco
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: STruts-EL
Posted by Wendy Smoak <ja...@wendysmoak.com>.
From: "M4RC0" <m4...@gmail.com>
> But, a newbie question: whitch are the beneficts of using Struts-EL
> instead standar struts taglibs or JSTL???
These aren't mutually exclusive, typically you'll use the original Struts
taglib alone, or Struts-EL and JSTL 1.0 together [in a Servlet 2.3/JSP 1.2
container].
(Then when you move to Servlet 2.4/JSP 2.0, you go back to the original
Struts tags, plus JSTL 1.1.)
> After reading documentation, i really don't understand why, when and
> where to use Struts-EL.
What typically happens is that you discover JSTL, and then get frustrated by
the fact that you _can't_ use expressions in the Struts taglibs [with JSP
1.2]. Enter Struts-EL, which gives you that ability.
In your example, that runtime expression will not be able to "see" variables
set with JSTL, such as the status of a loop inside <c:forEach> or anything
set with <c:set>. Try this:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<c:set var="myval" value="125000" />
<%= myval %>
(It won't even compile...)
The flip side of that is: JSTL cannot "see" scripting variables. This is
intentional. :)
If you're going to use JSTL 1.0, then you should use Struts-EL along with
it.
--
Wendy Smoak
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: STruts-EL
Posted by Jeff Beal <jb...@gmail.com>.
The second example would actually have to be:
<bean:message key="<%=
((SomeClass)request.getAttribute("someObj")).getSomeProp().getSomeString()%>"
/>
-- Jeff
On 7/26/05, Jeff Beal <jb...@gmail.com> wrote:
> It's a lot more clear to compare the difference between:
>
> <bean-el:message key="${someObj.someProp.someString}"/>
>
> and
>
> <bean:message key="<%=
> request.getAttribute("someObj").getSomeProp().getSomeString()%>"/>
>
> Especially considering the following scenarios that "just work" in EL:
>
> -- What if "someObj" may be in more than one scope?
> -- What if there *is* no 'someObj'?
> -- What if someProp is null?
>
> -- Jeff
>
> On 7/26/05, Dave Newton <ne...@pingsite.com> wrote:
> > M4RC0 wrote:
> >
> > >I mean, why to use
> > ><bean-el:message key="${stringvar}"/>
> > >instead
> > ><bean:message key='<%= stringvar %>'/>
> > >
> > >
> > Because typing ${} is easier/cleaner than typing <%= %> and it's JSP 2.0
> > syntax.
> >
> > Dave
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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: STruts-EL
Posted by Jeff Beal <jb...@gmail.com>.
It's a lot more clear to compare the difference between:
<bean-el:message key="${someObj.someProp.someString}"/>
and
<bean:message key="<%=
request.getAttribute("someObj").getSomeProp().getSomeString()%>"/>
Especially considering the following scenarios that "just work" in EL:
-- What if "someObj" may be in more than one scope?
-- What if there *is* no 'someObj'?
-- What if someProp is null?
-- Jeff
On 7/26/05, Dave Newton <ne...@pingsite.com> wrote:
> M4RC0 wrote:
>
> >I mean, why to use
> ><bean-el:message key="${stringvar}"/>
> >instead
> ><bean:message key='<%= stringvar %>'/>
> >
> >
> Because typing ${} is easier/cleaner than typing <%= %> and it's JSP 2.0
> syntax.
>
> Dave
>
>
>
> ---------------------------------------------------------------------
> 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: STruts-EL
Posted by Dave Newton <ne...@pingsite.com>.
M4RC0 wrote:
>I mean, why to use
><bean-el:message key="${stringvar}"/>
>instead
><bean:message key='<%= stringvar %>'/>
>
>
Because typing ${} is easier/cleaner than typing <%= %> and it's JSP 2.0
syntax.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: STruts-EL
Posted by M4RC0 <m4...@gmail.com>.
But, a newbie question: whitch are the beneficts of using Struts-EL
instead standar struts taglibs or JSTL???
After reading documentation, i really don't understand why, when and
where to use Struts-EL.
I mean, why to use
<bean-el:message key="${stringvar}"/>
instead
<bean:message key='<%= stringvar %>'/>
???
Thanks!
--
M4RC0
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: STruts-EL
Posted by Wendy Smoak <ja...@wendysmoak.com>.
> Anyone can suggest me a good link from where I can learn
> Struts-EL?
http://struts.apache.org/userGuide/building_view.html#struts-el
http://struts.apache.org/faqs/struts-el.html
You can find Struts-EL in the 'contrib' directory of the 1.2.7 binary
distribution.
--
Wendy Smoak
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org