25 May 2010

JSP history of writing bean properties

  • JSP 0.9

<% ActionForm form = (ActionForm) request.getAttribute(”LoginForm”); %>
<%= form.getUserName()%>

  • JSP 1.0

<jsp:useBean id=“form" class=“be.uniway.LoginForm" />
<jsp:getProperty name=“form" property=“userName" />

  • Struts

<bean:write name=“loginForm" property="userName"/>

  • JSP 1.2

<c:out value} ="${loginForm.userName}">

  • JSP 2.0

${loginForm.userName}

16 May 2010

JSTL/JSP EL alternate Struts excercise solution

The De Post/PMC excercises (and the Struts blank sample application) are based on

  • Struts
    • tags-bean
    • tags-logic
    • tags-html
  • JSP scriptlets
In this post we will show how to move this to
  • Struts
    • tags-html
  • JSTL
  • JSP expression language
To enable JSTL/JSP/EL support in your application follow these instructions. Here’s the table from the excercise rendered with JSTL/JSP EL:
<c:forEach  var="product" items="${List}"  varStatus ="status">
  <tr class="${(status.index%2==1)?'odd':'even'}">
    <td>
      <html:link action="<%=modify%>" paramId="id" paramName="product" paramProperty="id">
        <html:img srcKey="icon.edit" altKey="icon.alt.edit" border="0"/>
      </html:link> 
    </td> 
    <td>
      <html:link action="<%=remove %>" paramId="id" paramName="product" paramProperty="id">
        <html:img srcKey="icon.trash" altKey="icon.alt.trash" border="0"/>
      </html:link>
    </td>
    <td> ${product.name}</td> 
    <td> ${product.description}</td>
  </tr>
</c:forEach>

15 May 2010

SAP buys Sybase

In my previous company our two main products were Sun and Sybase.
Both have now been sold within a short interval:
Sybase to SAP
Sun to Oracle

Struts 1 action (mapping) element