Differences between revisions 6 and 7
Revision 6 as of 2006-07-22 04:00:22
Size: 3150
Comment:
Revision 7 as of 2009-09-20 23:12:16
Size: 3161
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 10: Line 10:
|| <bean:message> || Use [:JSTLTagsBeanMessage:<fmt:message>] JSTL action || || <bean:message> || Use [[JSTLTagsBeanMessage|<fmt:message>]] JSTL action ||
Line 50: Line 50:
See example here: ["JSTLTagsNested"] See example here: [[JSTLTagsNested]]
Line 54: Line 54:
 * ["StrutsAndJSTL"]
 * [http://www.phptr.com/articles/printerfriendly.asp?p=30946&rl=1 JSTL Expression Language] by David Geary
 * [http://www.onjava.com/pub/a/onjava/2002/08/14/jstl1.html JSTL 1.0: Standardizing JSP, Part 1] by Hans Bergsten
 * [http://www.onjava.com/pub/a/onjava/2002/09/11/jstl2.html JSTL 1.0: What JSP Applications Need, Part 2] by Hans Bergsten
 * [http://www.onjava.com/pub/a/onjava/2002/10/30/jstl3.html JSTL 1.0: What JSP Applications Need, Part 3] by Hans Bergsten
 * [http://www.learntechnology.net/struts-nested.do Struts Nested] -- Rick Reumann
 * [[StrutsAndJSTL]]
 * [[http://www.phptr.com/articles/printerfriendly.asp?p=30946&rl=1|JSTL Expression Language]] by David Geary
 * [[http://www.onjava.com/pub/a/onjava/2002/08/14/jstl1.html|JSTL 1.0: Standardizing JSP, Part 1]] by Hans Bergsten
 * [[http://www.onjava.com/pub/a/onjava/2002/09/11/jstl2.html|JSTL 1.0: What JSP Applications Need, Part 2]] by Hans Bergsten
 * [[http://www.onjava.com/pub/a/onjava/2002/10/30/jstl3.html|JSTL 1.0: What JSP Applications Need, Part 3]] by Hans Bergsten
 * [[http://www.learntechnology.net/struts-nested.do|Struts Nested]] -- Rick Reumann

This is a stub, feel free to expand.

Bean tags

Struts tag

JSTL tag or implicit object

<bean:cookie>

Use implicit object cookie that contains a a read-only collection of Cookie objects

<bean:define>

<bean:header>

Use implicit object header that contains a read-only collection of request headers

<bean:include>

Use <c:import> JSTL action

<bean:message>

Use <fmt:message> JSTL action

<bean:page>

Simply refer to the bean name, JSTL will automatically search for it in page, request, session and application scopes

<bean:parameter>

Use implicit JSTL objects param and paramValues

<bean:resource>

<bean:size>

No match

<bean:struts>

No match

<bean:write>

Use <c:out> JSTL tag. On JSP 2.0 container simply use ${...} construct

Logic tags

Two most notable tags that you will still be using are <logic:messagesNotPresent>, <logic:messagesPresent>. Other tags can be replaced with JSTL tags or with better practices, like performing redirect or forward from an action class.

Struts tag

JSTL tag or implicit object

<logic:empty>

<c:if test="${empty ...}">

<logic:equal>

<c:if test="...">

<logic:forward>

No strict match. You can use <c:forward> with extracted path

<logic:greaterEqual>

<c:if test="...">

<logic:greaterThan>

<c:if test="...">

<logic:iterate>

<c:forEach>

<logic:lessEqual>

<c:if test="...">

<logic:lessThan>

<c:if test="...">

<logic:match>

<logic:messagesNotPresent>

No match

<logic:messagesPresent>

No match

<logic:notEmpty>

<c:if test="${not empty ...}">

<logic:notEqual>

<c:if test="...">

<logic:notMatch>

<logic:present>

<c:if test="...">

<logic:notPresent>

<c:if test="...">

<logic:redirect>

No strict match. You can use <c:redirect> with extracted path

Nested tags

Struts <nested:xxx> tags are used for two purposes:

  • to iterate through and display content of nested beans
  • to generate proper names of input elements, so these name could be parsed on input phase

JSTL <c:forEach> helps to iterate and display content of nested beans only, because JSTL is positioned as render-only technology. Therefore choosing JSTL <c:forEach> tag over Struts <nested:xxx> tags is not an obvious choice.

See example here: JSTLTagsNested

Additional Information

JSTLTags (last edited 2009-09-20 23:12:16 by localhost)