You're missing an important point about the JSTL tags.  The tags that
store information into variables don't put them into scriptlet
variables, they put them into "scoped variables", which are just HashMap
entries.  If you use "fmt:formatDate" to store a formatted date into
"currentdate", you can't reference it with "<%=currentdate%>".

If you're using the JSTL with Struts, you're probably better off using
Struts-EL, as the Struts-EL tags use the JSTL EL for attribute values,
instead of scriptlet expressions.

> -----Original Message-----
> From: Mohan Radhakrishnan [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 10, 2003 12:37 AM
> To: 'Struts Users Mailing List'
> Subject: 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to