Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

[S2] Slow s:url execution

Jordi Rubio Moreno

2007-05-14

Replies:

Hi,

I'm testing s:iterator and s:url tags vs #foreach and #surl velocity
tags, and my surprise is that Struts s:url tag is "slower" than #surl
invocation. When I work with Velocity, the test page is rendered
immediately, but when I execute the same test (in the same machine and
Tomcat) with s:url, an annoying scroll effect appears.

The code I'm testing is (offers is an ArrayList of very light POJOs):

* taglibs

<s:iterator value="offers">
<tr>
 <td>
  <s:url id="offUrl" action="Redirect">
  <s:param name="url"><s:property value="url"/></s:param>
  </s:url>
  <s:a href="%{offUrl}"><s:property value="title"/></s:a>
 </td>
</tr>
</s:iterator>

* Velocity

#foreach($offer in $offers)
<tr>
 <td>
  #surl("id=offUrl" "action=Redirect" "url=$offer.url")
  <a href="${offUrl}">$offer.title</a>
 </td>
</tr>
#end

What's the matter? What I'm doing wrong? I'm using Struts 2.0.6.

Thanks a lot in advance!

Cheers
©2008 junlu.com - Jax Systems, LLC, U.S.A.