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 Adam Sherman <ad...@tritus.ca> on 2003/03/23 21:07:08 UTC

Basic EL Use Help

I think I must have missed something.

If a servlet, in my case a Struts Action, contains:

request.setAttribute( "ca.tritus.tmailer.CONFIRM_ACTION", confirmBean );

And the Action forwards to a JSP page that contains:

<html:form action="${ca.tritus.tmailer.CONFIRM_ACTION.action}">

The tag should see the value of confirmBean.getAction(), correct?

Thanks,

A.

--
Adam Sherman
Tritus CG Inc.
http://www.tritus.ca/
+1 (613) 797-6819

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


Re: Basic EL Use Help

Posted by Adam Sherman <ad...@tritus.ca>.
On 03/23/03 13:32:20 -0800 Hans Bergsten wrote:

>> If "action" is a property of the bean stored in the request as
>> "ca.tritus.tmailer.CONFIRM_ACTION", what would the syntax be?
>
>    ${requestScope['ca.tritus.tmailer.CONFIRM_ACTION'].action}

Ugh, that's not as clean was the trivial examples I've seen. I thought that 
EL looked in all the scopes in order?

>> Also, isn't package-style notation the recommended naming scheme for
>> Attributes?
>
> Well, in some circles ;-) It's a good convention if there's any risk
> that the attribute name can clash with another attibute used in the
> application, for instance attributes created by components that may
> be reused in any application. If there's no risk for name clashes,
> e.g. for application-specific attributes that you have full control
> over, the package-style notation is arguably overkill.

Good point.

Thanks,

A.

--
Adam Sherman
Tritus CG Inc.
http://www.tritus.ca/
+1 (613) 797-6819

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


Re: Basic EL Use Help

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Adam Sherman wrote:
> On 03/23/03 13:10:25 -0800 Hans Bergsten wrote:
> 
>> No, you need to use a different syntax when the variable name contains
>> dots, since they are used as separators in the EL language:
>>
>>    ${requestScope['ca.tritus.tmailer.CONFIRM_ACTION.action']}
> 
> 
> Ah! Light! (-:
> 
> If "action" is a property of the bean stored in the request as 
> "ca.tritus.tmailer.CONFIRM_ACTION", what would the syntax be?

   ${requestScope['ca.tritus.tmailer.CONFIRM_ACTION'].action}

> Also, isn't package-style notation the recommended naming scheme for 
> Attributes?

Well, in some circles ;-) It's a good convention if there's any risk
that the attribute name can clash with another attibute used in the
application, for instance attributes created by components that may
be reused in any application. If there's no risk for name clashes,
e.g. for application-specific attributes that you have full control
over, the package-style notation is arguably overkill.

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: Basic EL Use Help

Posted by Adam Sherman <ad...@tritus.ca>.
On 03/23/03 13:10:25 -0800 Hans Bergsten wrote:

> No, you need to use a different syntax when the variable name contains
> dots, since they are used as separators in the EL language:
>
>    ${requestScope['ca.tritus.tmailer.CONFIRM_ACTION.action']}

Ah! Light! (-:

If "action" is a property of the bean stored in the request as 
"ca.tritus.tmailer.CONFIRM_ACTION", what would the syntax be?

Also, isn't package-style notation the recommended naming scheme for 
Attributes?

Thanks for your help,

A.

--
Adam Sherman
Tritus CG Inc.
http://www.tritus.ca/
+1 (613) 797-6819

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


Re: Basic EL Use Help

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Adam Sherman wrote:
> I think I must have missed something.
> 
> If a servlet, in my case a Struts Action, contains:
> 
> request.setAttribute( "ca.tritus.tmailer.CONFIRM_ACTION", confirmBean );
> 
> And the Action forwards to a JSP page that contains:
> 
> <html:form action="${ca.tritus.tmailer.CONFIRM_ACTION.action}">
> 
> The tag should see the value of confirmBean.getAction(), correct?

No, you need to use a different syntax when the variable name contains
dots, since they are used as separators in the EL language:

   ${requestScope['ca.tritus.tmailer.CONFIRM_ACTION.action']}

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: Basic EL Use Help

Posted by Adam Sherman <ad...@tritus.ca>.
On 03/23/03 15:14:07 -0500 Henri Yandell wrote:

> One thing to check is that you have a Struts version that supports EL [or
> you're using JSP 2.0]. Your EL looks good.

Thanks for the confirmation.

I am using Struts-EL but I seem to not get anything at all out. Going to 
try some simpler <c:out>'s.

A.

--
Adam Sherman
Tritus CG Inc.
http://www.tritus.ca/
+1 (613) 797-6819

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


Re: Basic EL Use Help

Posted by Henri Yandell <ba...@generationjava.com>.
One thing to check is that you have a Struts version that supports EL [or
you're using JSP 2.0]. Your EL looks good.

Hen

On Sun, 23 Mar 2003, Adam Sherman wrote:

> I think I must have missed something.
>
> If a servlet, in my case a Struts Action, contains:
>
> request.setAttribute( "ca.tritus.tmailer.CONFIRM_ACTION", confirmBean );
>
> And the Action forwards to a JSP page that contains:
>
> <html:form action="${ca.tritus.tmailer.CONFIRM_ACTION.action}">
>
> The tag should see the value of confirmBean.getAction(), correct?
>
> Thanks,
>
> A.
>
> --
> Adam Sherman
> Tritus CG Inc.
> http://www.tritus.ca/
> +1 (613) 797-6819
>
> ---------------------------------------------------------------------
> 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