Thanks this helped a lot.  I'd already grimbled over
several books on these subjects.

Re: fmt tags...

It must have been my error... but I must have been trying
to do the format in one step.  After posting my earlier
message I tried again...  having just looked over all I
was trying to do this sometimes helps... anyway this
example does work, and does exactly what I had been
trying to do!

  <fmt:parseDate var="date" value="${rows.STARTDATE}" 
    pattern="yyyyy-MM-dd kk:mm:ss.SSS"/>
  <fmt:formatDate value="${date}" pattern="MMM d, yyyy"/>

I needed to use both fmt steps, like I said, I must have
previously tried getting it done in one step.

Thanks again

Roy

On Wed, 2004-03-31 at 10:12, Kris Schneider wrote:
> 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...)


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

Reply via email to