You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mohan Radhakrishnan <Mo...@hclcomnet.co.in> on 2003/03/10 09:36:38 UTC

bean:define and el tags

Hi

   I am trying to use simple if-else logic here.

	Date formatter -
	<jsp:useBean id="now" class="java.util.Date" />
	<fmt:formatDate var="currentdate" value="${now}"
pattern="dd/MM/yyyy"/>

   If my indexed property in the form returns null, I use the current date.

<c:choose>
<c:when test="${form.startDate[0] != null}">
<bean:define id="date" name="form" property='<%= "startDate[" + 0 + "]"
%>'/>
</c:when>
<c:when test="${form.startDate[0] == null}">
<bean:define id="date" value="<%=currentdate%>"/>
</c:when>
</c:choose>

This is to populate my html:text box like this

<html:text value="<%=date.toString()%>"

  Is something wrong here ? It seems that the variable "date" is not found
at runtime.

Thanks,
Mohan

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org