On Nov 27, 2006, at 9:13 AM, Plat wrote:

> Hopefully this is a JSP-newbie question. Pleasepleaseplease let it  
> be a newbie question! :-)
>

Somewhat.  It's a very annoying feature of the JSP 2.1 spec (and it's  
required by the TCK, so we can't avoid it.)

If you have an old-style web.xml (basically you don't have a  
namespace declaration), then JSP won't understand the ${...} syntax.

You can avoid this by changing your web.xml to start like:

<web-app xmlns="http://caucho.com/ns/resin";>

(You can also use xmlns="http://java.sun.com/xml/ns/j2ee";).

-- Scott


> I've recently upgraded from Resin 3.0.14 to 3.0.22. My JSP pages  
> pass attribute values to JSP Tag Files using EL expressions. Here's  
> some example code based on my "real" code:
>
>     <helloLib:HelloTag user="${myUser}" />
>     <%-- myUser is an instance of the MyUser class --%>
>
> Although this worked fine in 3.0.14, after upgrading Resin I see  
> the error:
>
>     expected `<%= ... %>' at `${myUser}'
>     for tag attribute setter `setUser(MyUser)'.
>     Tag attributes which can't be converted from strings must use a  
> runtime
>     attribute expression.
>
> The error (thrown from JspNode.java in the Resin source) makes  
> sense from the standpoint that "MyUser" cannot be converted from a  
> string. For my purposes it would be very difficult to support full  
> conversion to/from strings, so MyUser does not support this.
>
> Now, if I change my tag call to use runtime expressions for such  
> attributes, everything works how I want it to.
>
>     <helloLib:HelloTag user="<%= myUser %>" />
>     <%-- This works great in 3.0.22 --%>
>
>
> So now I'm wondering:
>
> 1) Is the latter syntax (use of runtime expressions) generally  
> supported by JSP engines? That is, if I pass such a value using a  
> runtime expression, am I generally protected from having to change  
> this again? I was reading through JSR 152 and it seems like I  
> should be OK, but I'm no pro yet.
>
> 2) Why is it that "Tag attributes which can't be converted from  
> strings must use a runtime attribute expression"? Is this a  
> limitation of Resin, or is this in the JSP specification somewhere?  
> (Or some implicit requirement of PropertyEditors?)
>
>
> I'm fine with changing my code to use runtime expressions instead,  
> but I'd really like to understand _why_ I need to do so.
>
>
> Thanks for your insight!
> _______________________________________________
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest


_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to