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 %3Cfmt:message%3E 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

  • No labels