On Tue, 2004-02-10 at 09:03, Alex Kovacs wrote:
> Hi,
> 
> I am using cocoon-2.1.3 with Woody. I have a situation where I am using xsp
> to display some data from a Woody form. The problem is when trying to
> display the value of a date widget and the date format is the default one
> instead of the one set in the widget definition. I have the following
> configuration (using xml binding):
> 
> Widget definition:
>         ...
>         <wd:field id="start_date">
>             <wd:datatype base="date">
>                 <wd:convertor type="formatting">
>                     <wd:patterns>
>                         <wd:pattern>dd/MM/yyyy</wd:pattern>
>                     </wd:patterns>
>                 </wd:convertor>
>             </wd:datatype>
>             <wd:label>Start Date</wd:label>
>         </wd:field>
>         ...
> 
> 
> The confirm.xsp file:
>             ...
>             <xsp:logic>
>                 //Fetching the form from the request attribute
>                 Form form = (Form)request.getAttribute("theform");
>                 Field start_date = (Field)form.getWidget("start_date");
>             </xsp:logic>
>             ...
>             <item>
>                    <xsp:expr>start_date.getValue()</xsp:expr>
>              </item>
>             ...
> 
> And the output is in the form of: "Tue Feb 10 00:00:00 EST 2004", instead of
> "10/02/2004".
> 
> Can anyone help?

The start_date.getValue() call returns a Date object, so the date you're
seeing it the default Date.toString() behaviour of Java.

Unfortunately, AFAIK, there's currently no method on the Field widget to
retrieve its converted string value (it's only part of the generated
XML). Seems useful to me though, and would only be 3 lines of code.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]                          [EMAIL PROTECTED]


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

Reply via email to