You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Ralph Schaer <sc...@ess.ch> on 2000/06/19 10:34:08 UTC

runtime expressions

Hi

It would be nice if it's possible to add runtime expressions to the link tag

for example there is a a list with basket items and every item has a delete
link

 <% String deletelink = "deleteBasket.do?id=" + basketItem.getId() %>
 <struts:link href="<%= deletelink %>">delete</struts:link>

this does not work with the current struts.tld.

The solution for this problem is to change rtexprvalue from false to true.
That's all.


  <tag>
    <name>link</name>
    <tagclass>org.apache.struts.taglib.LinkTag</tagclass>
    <bodycontent>JSP</bodycontent>
    <attribute>
      <name>href</name>
      <required>true</required>
      <rtexprvalue>true</rtexprvalue>
<--------------------------
    </attribute>
    <attribute>
      <name>target</name>
      <required>false</required>
      <rtexprvalue>false</rtexprvalue>
    </attribute>
  </tag>





Re: runtime expressions

Posted by Eduardo Pelegri--Llopart <Ed...@eng.sun.com>.
Not valid JSP 1.1.

Actually there is a proposal to address this in JSP 1.2.

	- eduard/o

"Craig R. McClanahan" wrote:
> 
> Ralph Schaer wrote:
> 
> > >Sounds reasonable.  I just checked in a patch for this, and for the
> > "action"
> > >attribute on <struts:form>.  I tended to be pretty conservative about
> > setting
> > ><rtexprvalue>true</rtexprvalue> because the generated code in the JSP page
> > can
> > >be a little more efficient if it is set to false, but these are very
> > reasonable
> > >cases.
> >
> > I think when it's more efficient without runtime expressions we shouldn't
> > change
> > the current implementation. IMHO it's better to use another tag.
> >
> > For example the "url" tag from the book "Web Development with JSP
> > (Manning)".
> >
> > example:
> > <a href="<mut:url>menu.jsp</mut:url>">menu</a>
> 
> Hmmm ...
> 
> I'm going to have to ask for a clarification from the JSP spec lead (Eduardo
> Pelegri-Llopart) on whether this is technically legal JSP 1.1 syntax or not.
> It will certainly cause problems if you try to move to an XML representation of
> the JSP page.
> 
> The reason I'm hesitating is that the description of the <rtexprvalue> element
> in the TLD states that a "true" value enables scriptlet expressions ("<%= xxxxx
> %>"), but does not say anything about nested JSP or custom tags.
> 
> Craig



Re: runtime expressions

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Ralph Schaer wrote:

> >Sounds reasonable.  I just checked in a patch for this, and for the
> "action"
> >attribute on <struts:form>.  I tended to be pretty conservative about
> setting
> ><rtexprvalue>true</rtexprvalue> because the generated code in the JSP page
> can
> >be a little more efficient if it is set to false, but these are very
> reasonable
> >cases.
>
> I think when it's more efficient without runtime expressions we shouldn't
> change
> the current implementation. IMHO it's better to use another tag.
>
> For example the "url" tag from the book "Web Development with JSP
> (Manning)".
>
> example:
> <a href="<mut:url>menu.jsp</mut:url>">menu</a>

Hmmm ...

I'm going to have to ask for a clarification from the JSP spec lead (Eduardo
Pelegri-Llopart) on whether this is technically legal JSP 1.1 syntax or not.
It will certainly cause problems if you try to move to an XML representation of
the JSP page.

The reason I'm hesitating is that the description of the <rtexprvalue> element
in the TLD states that a "true" value enables scriptlet expressions ("<%= xxxxx
%>"), but does not say anything about nested JSP or custom tags.

Craig







RE: runtime expressions

Posted by Ralph Schaer <sc...@ess.ch>.
>Sounds reasonable.  I just checked in a patch for this, and for the
"action"
>attribute on <struts:form>.  I tended to be pretty conservative about
setting
><rtexprvalue>true</rtexprvalue> because the generated code in the JSP page
can
>be a little more efficient if it is set to false, but these are very
reasonable
>cases.

I think when it's more efficient without runtime expressions we shouldn't
change
the current implementation. IMHO it's better to use another tag.

For example the "url" tag from the book "Web Development with JSP
(Manning)".

example:
<a href="<mut:url>menu.jsp</mut:url>">menu</a>







Re: runtime expressions

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Ralph Schaer wrote:

> Hi
>
> It would be nice if it's possible to add runtime expressions to the link tag
>
> for example there is a a list with basket items and every item has a delete
> link
>
>  <% String deletelink = "deleteBasket.do?id=" + basketItem.getId() %>
>  <struts:link href="<%= deletelink %>">delete</struts:link>
>
> this does not work with the current struts.tld.
>

Sounds reasonable.  I just checked in a patch for this, and for the "action"
attribute on <struts:form>.  I tended to be pretty conservative about setting
<rtexprvalue>true</rtexprvalue> because the generated code in the JSP page can
be a little more efficient if it is set to false, but these are very reasonable
cases.

Craig