On Wed, 24 Apr 2002, Jing Zhou wrote:

[snip]
> > [Craig said]
> > If we are going to adopt the JSTL (and JSP 1.3) expression language
> > syntax, I believe we should adopt all of it, not just a subset.  For
> > example, consider the <bean:write> tag, where you use the "name" and
> > "property" (plus optional "scope") attributes to identify the property to
> > be written.  The "property" attribute takes one of our proprietary
> > expressions, so you can say something like:
> >
> >   <bean:write name="customer" property="address.city" scope="session"/>
> >
> > The equivalent using a standard JSTL tag would look like this:
> >
> >   <c:out value="${sessionScope.customer.address.city}"/>
> >
>
> Can we have syntax like this in Struts?
>     <bean:write name="customer" property="address[${key}]" scope="session"/>

This is not curently legal.  Struts only accepts integer literals as
subscripts, although you can fake it with a runtime expression:

  <bean:write name="customer"
   property='<%= "address[" + key + "]" %>' scope="session"/>

> or in JSTL
>     <c:out value="${sessionScope.customer.address[${key}]}" />

In this case, it would actually be:

  <c:out value="${sessionScope.customer.address[key]}"/>

You don't really need to wonder what the JSTL expression language syntax
is -- you can download the JSTL spec and read Appendix A.

  http://jcp.org/aboutJava/communityprocess/first/jsr052/

> Where the evaluated value of ${key} at runtime could be obtained from
> a loop tag or a tool provided model. An example value of ${key} could be
> 0, 1, 2 ... as a looped index, or "home", "ship_to", "charge_to", etc.
>
> I feel the true problems I am struggling for are better expressed in the
> above
> examples. A more agressive syntax may looks like:
> <html:text name="customer" property="${whatever property to post}" />
> or something like:
> <html:text name="customer" property="${foo1}normal_string${foo2}"/>
>
> I am not sure JSTL could understand the "nested expressions" or not and
> how to express them in JSTL. The idea is somehow we could dynamically
> assemble the string literal for the "property" attributes.
>

There are two variations of the JSTL library -- one that accepts runtime
expressions (like the Struts case above) and one that does not.

[snip]

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to