If you want to use a scoped variable created by JSTL as a scripting variable in
a JSP expression, try this:

<c:set var="rowStartDate" value="${rows.STARTDATE}" />
<jsp:useBean id="rowStartDate" type="java.lang.String" />

Notice the use of the "type" attribute instead of the "class" attribute.
However, you still can't use <jsp:useBean> twice with the same id and if you
update the scoped var it *won't* be reflected in the value of the scripting
var. In other words, doing this:

<c:set var="foo" value="bar"/>
<jsp:useBean id="foo" type="java.lang.String"/>
<c:out value="${foo}"/> : <%= foo %>
<c:set var="foo" value="baz"/>
<c:out value="${foo}"/> : <%= foo %>

Will output:

bar : bar
baz : bar

What specific problems are you having with the <fmt> tags?

Quoting Roy Benjamin <[EMAIL PROTECTED]>:

> I have a function to format a date; takes and returns
> a String.  There are two possible places where this may be
> used, one for on-line display, the other when downloading
> the data. <c:choose> construct.
> 
> This works for the on-line option:
> 
> <c:set var="rowStartDate" value="${rows.STARTDATE}" />
> <jsp:useBean id="rowStartDate" class="java.lang.String" />
> <c-rt:out value="<%= formatDate(rowStartDate) %>" />
> 
> but only if I use a different bean for the off-line option..
> 
> <c:set var="rowStartDateXXX" value="${rows.STARTDATE}" />
> <jsp:useBean id="rowStartDateXXX" class="java.lang.String" />
> <c-rt:out value="<%= formatDate(rowStartDateXXX) %>" />
> 
> otherwise I get an error the the bean is declared twice.
> 
> Ok, so I take and move the useBean action to near the top
> of the page, then I don't need to declare essentially the
> same bean under two different names..  the page compiles
> Ok, but the value of the bean, a page scoped variable is now
> never set by:
>       <c:set var="rowStartDate" value="${rows.STARTDATE}" />
> the value is -always- null.  I don't get it, the c:set should
> still be pasting the new string into the page context?  no?
> 
> Roy
> 
> (I've tried many times to use the fmt:date actions... they seem
>  to be non-working in the version of jstl I need to use now...)

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

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

Reply via email to