P. 1
Struts Survival Guide

Struts Survival Guide

|Views: 29|Likes:
Published by sudhir_fresh

More info:

Published by: sudhir_fresh on Jun 24, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





As you might know already, Struts-EL is a port of Struts tags to JSTL. This

provides a migration path for the existing Struts applications to the expression

language syntax in a non-intrusive manner. Normal Struts tags rely on runtime

scriptlet expressions to evaluate dynamic attribute values. For example, the key

of the bean:message below is dependent on some business logic.

” />

This assumes that stringVar exists as a JSP scripting variable. This tag can

be rewritten with the Struts-EL version of the message tag as follows:

Although, not much exciting is going on in the above tag, it shows how easy

it is to port the existing Struts tags to Struts-EL. The real power of Struts-EL

comes to the fore especially when the scriptlet deciding the attribute value starts

becoming complex.

Not all tags from Struts are ported to Struts-EL. In areas where there is

already a JSTL tag available, porting of the Struts tags will only cause

Struts Survival Guide – Basics to Best Practices


redundancy. Hence those Struts tags are not ported. For e.g., the bean:write

tag can be implemented with the c:out JSTL tag. Similarly most of the logic

tags (such as equal, notEqual, lessThan etc.) are not ported since the JSTL

tag c:if can take any expression and evaluate it (with the test=”${….}”

option). You have already seen how a logic:equal tag can be replaced with

c:if in the earlier section on Nested Logic Tags.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->