You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam Hardy <ah...@cyberspaceroad.com> on 2008/04/08 19:10:37 UTC

date conversion

Hi

quick question, I can't find any specific mention of what I want so I assume I 
have to code my own Converter.

I need a date in the ISO format YYYY-MM-DD

There is no converter that I can configure in the struts package, is there?

Thanks
Adam

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


Re: Simple interceptor is not called

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
Which server are you running the application in? Are you sure you have
checked all the log files for the server? And are you sure you're
editing the struts.xml that is actually picked up at run time? I've
had some problems earlier with Eclipse not synchronizing resources
properly to the correct output build folder. If that's the case, a
"project clean" usually helps. And configuring log4j properly would
probably help giving some meaningful information messages.

Nils-H

On Tue, Apr 8, 2008 at 11:59 PM, Peter Theissen <pe...@web.de> wrote:
> Hi,
>
>
>
> >
> > Are you sure it isn't?
> >
> >
>  yes ;-)
>
>
> > What happens if you return something other than SUCCESS from your action?
> >
> >
>  Unfortunately, exactly the same happens.
>
>
> > That will test whether or not it's getting the result from the intercept
> call
> > or the action itself.
> >
>  Now I returned Action.NONE and the System.out.println statement before
> still didnt work.
>
>
> > Are you able to see other sysout statements across the
> > application? (Use a logger!)
> >
>  Yes, I guess  I can see them on the common Eclipse console
>
>
>
> > Are there any startup errors in your log?
> >
>  Warnings are there:
>  log4j:WARN No appenders could be found for logger
> (org.springframework.util.ClassUtils).
>  log4j:WARN Please initialize the log4j system properly.
>
>
> > Is the
> > action configured properly in Spring?
> >
> >
>  I hope so. But difficult to judge for a noob. Is there any part I should
> examine
>  especially?
>
>  Thanks for your time and help
>  Peter
>
>
>
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Re: Again: question to interceptors

Posted by Peter Theissen <pe...@web.de>.
Hi all, dear Ralf,

thanks a lot for your answer it was really helpful.
Honestly, I didnt understand the call-stack-principle
behind the interceptors at all. So your hint:
"To understand recursion, you must understand recursion"
was a good one and also this picture:
[1] http://struts.apache.org/2.0.11.1/docs/big-picture.html
I already knew that design from the event handling of
a Javascript API (Map24 AJAX API)

However, what I thought, was one has to determine the
order in that the interceptors are called, in the action tag:
all interceptors that are before the result are also called
before the action, then the action is called, then the result
and those the interceptors are called, which are written AFTER
the result tags. OK, in retrospect my idea was also not
so intelligent ;-)

Thx & best regards
Peter



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


Re: Again: question to interceptors

Posted by Ralf Fischer <th...@googlemail.com>.
Hi Peter,

On Thu, Apr 10, 2008 at 12:08 PM, Peter Theissen <pe...@web.de> wrote:
<snip />
>  I have the "SimpleInterceptor":
>  >>>
>  public String intercept(ActionInvocation invocation) throws Exception {
>   System.out.println("The action is being intercepted!");
>   return invocation.invoke();        //return Action.SUCCESS; (**)
>  }
>  <<<

You 'usually' don't return anything else from the intercept method
despite the return code of the action invocation itself. Anyway the
return of your interceptor leads back to the action invocation, which
then puts the resulting success-String into a local variable and
returns null. End of processing. So neither action nor result are
executed, as there never is a call to actionInvocation.invoke() at the
end of your interceptor stack, which whould do this. You only
understand what a recursion is, when you've understood recursion ;-)

>  and the struts.xml contains:
>  >>>
>  <action name="listRegistrationsWaiting" class="registrationWaitingAction"
> method="execute">
>   <result>pages/list.jsp</result>
>   <result name="input">pages/list.jsp</result>
>   <interceptor-ref name="simpleInterceptor"/>           </action>
>  <<<

You know this leaves you with only ONE interceptor on your interceptor
stack, the default stack is completely omitted! Means no configuration
parameters or URL parameters injected into your action, and lots of
other stuff you miss. Try something like

<action name="foo" class="org.bar.Foo">
  <result>/foo.jsp</result>
  <interceptor-ref name="defaultStack" />
  <interceptor-ref name="simpleInterceptor" />
</action>

>  When I comment in (**) instead of the return,
>  the result is not displayed (list.jsp) is not invoked.
>  I dont understand why, since the interceptor should
>  be called as the LAST step as far as I understand the
>  doc?! Therefore, there should be no influence of
>  the interceptor at the result at all!

Nope. actionInvocation.invoke() calls the next intercepter on the
interceptor stack until there are no more interceptors. THEN the call
to actionInvocation.invoke() from the last interceptor on the stack
invokes the action. Thus in your example above the action never should
be called.

>  But obvously, Im misunderstanding something, since I found
>  out that it works, when I just call return invocation.invoke();
>  But also in this case I wounder why the interceptor is called
>  BEFORE the DB Access (I can see that on the console),
>  since the interceptor is provided as the LAST part of the
>  action.

Check out some more docs in the wiki, especially take a look at the
big picture[1] and interceptors[2].

Cheers,
-Ralf


[1] http://struts.apache.org/2.0.11.1/docs/big-picture.html
[2] http://struts.apache.org/2.x/docs/interceptors.html

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


Again: question to interceptors

Posted by Peter Theissen <pe...@web.de>.
Hello,

first of all thanks for all your previous answers. Somehow,
I got the interceptor working for the simplest case, but
honestly I still dont know exactly why. Maybe it was a
caching issue.

Now I have some questions:

I have the "SimpleInterceptor":
 >>>
public String intercept(ActionInvocation invocation) throws Exception {
  System.out.println("The action is being intercepted!");
  return invocation.invoke();       
  //return Action.SUCCESS; (**)
}
<<<

and the struts.xml contains:
 >>>
<action name="listRegistrationsWaiting" 
class="registrationWaitingAction" method="execute">
  <result>pages/list.jsp</result>
  <result name="input">pages/list.jsp</result>
  <interceptor-ref name="simpleInterceptor"/>           
</action>
<<<

When I comment in (**) instead of the return,
the result is not displayed (list.jsp) is not invoked.
I dont understand why, since the interceptor should
be called as the LAST step as far as I understand the
doc?! Therefore, there should be no influence of
the interceptor at the result at all!

But obvously, Im misunderstanding something, since I found
out that it works, when I just call return invocation.invoke();
But also in this case I wounder why the interceptor is called
BEFORE the DB Access (I can see that on the console),
since the interceptor is provided as the LAST part of the
action.

Thanks for your help
Peter



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


Re: Simple interceptor is not called

Posted by Dave Newton <ne...@yahoo.com>.
I agree with Nils; I'd be double-checking the deployment etc.

There's nothing obviously wrong (except that you say it doesn't work ;)

What happens if you throw an exception in the interceptor? In a *different*
action? That could help diagnose a deployment issue, anyway.

Dave

--- Peter Theissen <pe...@web.de> wrote:

> Hi,
> 
> >
> > Are you sure it isn't?
> >   
> yes ;-)
> > What happens if you return something other than SUCCESS from your action?
> >   
> Unfortunately, exactly the same happens.
> > That will test whether or not it's getting the result from the intercept
> call
> > or the action itself. 
> Now I returned Action.NONE and the System.out.println statement before 
> still didnt work.
> > Are you able to see other sysout statements across the
> > application? (Use a logger!) 
> Yes, I guess  I can see them on the common Eclipse console
> 
> > Are there any startup errors in your log? 
> Warnings are there:
> log4j:WARN No appenders could be found for logger 
> (org.springframework.util.ClassUtils).
> log4j:WARN Please initialize the log4j system properly.
> > Is the
> > action configured properly in Spring?
> >   
> I hope so. But difficult to judge for a noob. Is there any part I should 
> examine
> especially?
> 
> Thanks for your time and help
> Peter
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


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


Re: Simple interceptor is not called

Posted by Peter Theissen <pe...@web.de>.
Hi,

>
> Are you sure it isn't?
>   
yes ;-)
> What happens if you return something other than SUCCESS from your action?
>   
Unfortunately, exactly the same happens.
> That will test whether or not it's getting the result from the intercept call
> or the action itself. 
Now I returned Action.NONE and the System.out.println statement before 
still didnt work.
> Are you able to see other sysout statements across the
> application? (Use a logger!) 
Yes, I guess  I can see them on the common Eclipse console

> Are there any startup errors in your log? 
Warnings are there:
log4j:WARN No appenders could be found for logger 
(org.springframework.util.ClassUtils).
log4j:WARN Please initialize the log4j system properly.
> Is the
> action configured properly in Spring?
>   
I hope so. But difficult to judge for a noob. Is there any part I should 
examine
especially?

Thanks for your time and help
Peter



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


Re: Request scoped data in Struts2

Posted by Dave Newton <ne...@yahoo.com>.
--- Raghuveer Kumarakrishnan <kr...@yahoo.com> wrote:
> My point is just having getters for an Action property should suffice for
> it to be accessed in the view by any tag library.

I don't know as this is correct for *any* tag library.

It works for S2 tags that use OGNL, because S2 tags evalue OGNL.

It works for tag libraries that choose to interpret attribute values as JSP
EL and do the EL processing "by hand", because S2 provides a request wrapper
that maps EL expressions to the value stack (or the programmer uses a JSP EL
expression as the attribute value).

If an EL expression isn't used and the tag library doesn't assume EL or OGNL,
though, the tag library will just get a string, AFAIK (and whatever type
conversions are available to tags these days).

Dave

> Chris Pratt <th...@gmail.com> wrote:
>   You are correct. In that case,
> 
> 
> 
> is equivalent to calling
> 
> request.put("someName",action.getSomeName());
> 
> in an Action that implements RequestAware. So when Display Tag processes
> 
> 
> 
> The "someName" attribute is available when the JSP Tag Library
> (DisplayTag in this instance) calls
> pageContext.findAttribute("someName");
> 
> But you have to use the (or put the value in the request from
> the action) for DisplayTag to see it.
> 
> (*Chris*)
> 
> On Tue, Apr 8, 2008 at 3:12 PM, Raghuveer Kumarakrishnan
> wrote:
> > This doc seems to suggest that even request scoped data needs to
> explicitly set using
> > to be used by tag libraries like jsp taglib or displaytag
> >
> >
>
http://struts.apache.org/2.x/docs/exposing-framework-objects-to-jstl-with-a-jstl-and-displaytag-example.html
> >
> >
> > But for request scoped data you do not need to explicitly set it as a
> request attribute,just getters on the action will do ,so a tag library like
> displaytag will work out of the box
> >
> > 
> > ...
> > ..
> >
> > 
> >
> > where there is a getSomeName( ) method in the Struts2 Action class
> >
> >
> > Am I missing something or does the doc need to be updated?
> >
> > --Raghu
> >
> >
> > A Goal .......... Is a Dream with a Deadline
> >
> > ---------------------------------
> > You rock. That's why Blockbuster's offering you one month of Blockbuster
> Total Access, No Cost.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> 
> A Goal .......... Is a Dream with a Deadline
>        
> ---------------------------------
> You rock. That's why Blockbuster's offering you one month of Blockbuster
> Total Access, No Cost.


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


Re: Request scoped data in Struts2

Posted by Raghuveer Kumarakrishnan <kr...@yahoo.com>.
My point is just having getters for an Action property should suffice for it to be accessed in the view by any tag library.
  
Chris Pratt <th...@gmail.com> wrote:
  You are correct. In that case,



is equivalent to calling

request.put("someName",action.getSomeName());

in an Action that implements RequestAware. So when Display Tag processes



The "someName" attribute is available when the JSP Tag Library
(DisplayTag in this instance) calls
pageContext.findAttribute("someName");

But you have to use the (or put the value in the request from
the action) for DisplayTag to see it.

(*Chris*)

On Tue, Apr 8, 2008 at 3:12 PM, Raghuveer Kumarakrishnan
wrote:
> This doc seems to suggest that even request scoped data needs to explicitly set using
> to be used by tag libraries like jsp taglib or displaytag
>
> http://struts.apache.org/2.x/docs/exposing-framework-objects-to-jstl-with-a-jstl-and-displaytag-example.html
>
>
> But for request scoped data you do not need to explicitly set it as a request attribute,just getters on the action will do ,so a tag library like displaytag will work out of the box
>
> 
> ...
> ..
>
> 
>
> where there is a getSomeName( ) method in the Struts2 Action class
>
>
> Am I missing something or does the doc need to be updated?
>
> --Raghu
>
>
> A Goal .......... Is a Dream with a Deadline
>
> ---------------------------------
> You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.

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




A Goal .......... Is a Dream with a Deadline
       
---------------------------------
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.

Re: Request scoped data in Struts2

Posted by Chris Pratt <th...@gmail.com>.
You are correct.  In that case,

<s:set name="someName" value="someName" scope="request"/>

is equivalent to calling

request.put("someName",action.getSomeName());

in an Action that implements RequestAware.  So when Display Tag processes

<display:table name="someName" ...>

The "someName" attribute is available when the JSP Tag Library
(DisplayTag in this instance) calls
pageContext.findAttribute("someName");

But you have to use the <s:set> (or put the value in the request from
the action) for DisplayTag to see it.

  (*Chris*)

On Tue, Apr 8, 2008 at 3:12 PM, Raghuveer Kumarakrishnan
<kr...@yahoo.com> wrote:
> This doc seems to  suggest that even request scoped data needs to explicitly set using
>   <s:set....> to be used by tag libraries like jsp taglib or displaytag
>
>   http://struts.apache.org/2.x/docs/exposing-framework-objects-to-jstl-with-a-jstl-and-displaytag-example.html
>
>
>   But for request scoped data you do not need to explicitly set it as a request attribute,just getters on the action will do ,so a tag library like displaytag  will work out of the box
>
>     <display:table name="someName" ....>
>   ...
>   ..
>
>     </display:table>
>
>   where there is a getSomeName( )  method in the Struts2 Action class
>
>
>   Am I missing something or does the doc need to be updated?
>
>   --Raghu
>
>
>  A Goal .......... Is a Dream with a Deadline
>
>  ---------------------------------
>  You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.

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


Request scoped data in Struts2

Posted by Raghuveer Kumarakrishnan <kr...@yahoo.com>.
This doc seems to  suggest that even request scoped data needs to explicitly set using 
  <s:set....> to be used by tag libraries like jsp taglib or displaytag
   
  http://struts.apache.org/2.x/docs/exposing-framework-objects-to-jstl-with-a-jstl-and-displaytag-example.html
   
   
  But for request scoped data you do not need to explicitly set it as a request attribute,just getters on the action will do ,so a tag library like displaytag  will work out of the box
   
    <display:table name="someName" ....>
  ...
  .. 

    </display:table>
   
  where there is a getSomeName( )  method in the Struts2 Action class 

   
  Am I missing something or does the doc need to be updated?
   
  --Raghu


A Goal .......... Is a Dream with a Deadline
       
---------------------------------
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.

Re: Simple interceptor is not called

Posted by Dave Newton <ne...@yahoo.com>.
--- Peter Theissen <pe...@web.de> wrote:
> doese anybody see why the following (quite simple)
> interceptor isnt called:
> BTW: list.jsp seems to be called correctly.
> 
> struts.xml
>  >>>
>     <package name="registration" extends="struts-default">
> 
>         <interceptors>
>              <interceptor name="simpleInterceptor" 
> class="quickstart.interceptor.simpleInterceptor"/>
>         </interceptors>       
>      
>         <action name="listRegistrationsWaiting" 
> class="registrationWaitingAction" method="execute">
>             <result>pages/list.jsp</result>
>             <result name="input">pages/list.jsp</result>
>             <interceptor-ref name="simpleInterceptor"/>           
>         </action>
>       ...
>     </package>
> <<<
> 
> SimpleInterceptor.java
>  >>>
> package quickstart.interceptor;
> 
> import com.opensymphony.xwork2.Action;
> import com.opensymphony.xwork2.ActionInvocation;
> import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
> 
> public class SimpleInterceptor extends AbstractInterceptor{
>    
>     public String intercept(ActionInvocation invocation) throws Exception {
>         System.out.println("The action is being intercepted!");
>         return Action.SUCCESS;
>     }
> }
> <<<
> 
> What am I missing?

Are you sure it isn't?

What happens if you return something other than SUCCESS from your action?
That will test whether or not it's getting the result from the intercept call
or the action itself. Are you able to see other sysout statements across the
application? (Use a logger!) Are there any startup errors in your log? Is the
action configured properly in Spring?

Dave



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


Simple interceptor is not called

Posted by Peter Theissen <pe...@web.de>.
Hi everybody,

doese anybody see why the following (quite simple)
interceptor isnt called:
BTW: list.jsp seems to be called correctly.

struts.xml
 >>>
    <package name="registration" extends="struts-default">

        <interceptors>
             <interceptor name="simpleInterceptor" 
class="quickstart.interceptor.simpleInterceptor"/>
        </interceptors>       
     
        <action name="listRegistrationsWaiting" 
class="registrationWaitingAction" method="execute">
            <result>pages/list.jsp</result>
            <result name="input">pages/list.jsp</result>
            <interceptor-ref name="simpleInterceptor"/>           
        </action>
      ...
    </package>
<<<

SimpleInterceptor.java
 >>>
package quickstart.interceptor;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class SimpleInterceptor extends AbstractInterceptor{
   
    public String intercept(ActionInvocation invocation) throws Exception {
        System.out.println("The action is being intercepted!");
        return Action.SUCCESS;
    }
}
<<<

What am I missing?

Thanks and best regards
Peter

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


RE: Need help getting started with remote tabs

Posted by "Jiang, Jane (NIH/NCI) [C]" <ji...@mail.nih.gov>.
Thank you.  I found my problem was not really with my code.  I
accidentally find the remote tab working fine with IE.  But it shows
nothing in Firefox.  The jsp alone display ok in firefox, I can also
include the jsp using the s:include tag, but when I changed it to remote
tab, nothing shows up on the tab.  I did not find any error either.

-----Original Message-----
From: Musachy Barroso [mailto:musachy@gmail.com] 
Sent: Thursday, April 10, 2008 10:38 AM
To: Struts Users Mailing List
Subject: Re: Need help getting started with remote tabs

See the download section on the website:

http://struts.apache.org/download.cgi

musachy

On Thu, Apr 10, 2008 at 1:38 PM, Jiang, Jane (NIH/NCI) [C]
<ji...@mail.nih.gov> wrote:
> Musachy,
>
>  Thanks for your suggestion.  Do you mean this showcase?
>
>
http://www.planetstruts.org/struts2-showcase/ajax/tabbedpanel/example3.j
>  sp
>
>  I found the source for the jsp, but there is no source code for the
>  action.  Is there a place to download the complete source code?
>
>  Thank you,
>
>  Jane
>
>
>
>  -----Original Message-----
>  From: Musachy Barroso [mailto:musachy@gmail.com]
>  Sent: Wednesday, April 09, 2008 5:38 PM
>  To: Struts Users Mailing List
>  Subject: Re: Need help getting started with remote tabs
>
>  There are examples in the showcase application.
>
>  musachy
>
>  On Wed, Apr 9, 2008 at 8:55 PM, Jiang, Jane (NIH/NCI) [C]
>  <ji...@mail.nih.gov> wrote:
>  > Is there a complete working example for the tabbedPanel tag?  I
found
>  >  this example in the tag reference document.  How do I set up the
>  result
>  >  for AjaxTest.action?  I loaded the dynamic contents in that action
>  and
>  >  directed it to the jsp that displays that content.  The action was
>  >  invoked, but the tab shows up empty.  I tried to include the jsp
>  inside
>  >  the s:div tag and still nothing.
>  >
>  >  <s:tabbedpanel id="test"
beforeSelectTabNotifyTopics="/beforeSelect">
>  >    <s:div id="three" label="remote" theme="ajax"
>  href="/AjaxTest.action"
>  >  >
>  >        One Tab
>  >    </s:div>
>  >    <s:div id="three" label="remote" theme="ajax"
>  href="/AjaxTest.action"
>  >  >
>  >        Another tab
>  >    </s:div>
>  >  </s:tabbedpanel>
>  >
>  >  Thanks a lot for your help,
>  >
>  >  Jane
>  >
>  >
---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  >  For additional commands, e-mail: user-help@struts.apache.org
>  >
>  >
>
>
>
>  --
>  "Hey you! Would you help me to carry the stone?" Pink Floyd
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


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


Re: Need help getting started with remote tabs

Posted by Musachy Barroso <mu...@gmail.com>.
See the download section on the website:

http://struts.apache.org/download.cgi

musachy

On Thu, Apr 10, 2008 at 1:38 PM, Jiang, Jane (NIH/NCI) [C]
<ji...@mail.nih.gov> wrote:
> Musachy,
>
>  Thanks for your suggestion.  Do you mean this showcase?
>
>  http://www.planetstruts.org/struts2-showcase/ajax/tabbedpanel/example3.j
>  sp
>
>  I found the source for the jsp, but there is no source code for the
>  action.  Is there a place to download the complete source code?
>
>  Thank you,
>
>  Jane
>
>
>
>  -----Original Message-----
>  From: Musachy Barroso [mailto:musachy@gmail.com]
>  Sent: Wednesday, April 09, 2008 5:38 PM
>  To: Struts Users Mailing List
>  Subject: Re: Need help getting started with remote tabs
>
>  There are examples in the showcase application.
>
>  musachy
>
>  On Wed, Apr 9, 2008 at 8:55 PM, Jiang, Jane (NIH/NCI) [C]
>  <ji...@mail.nih.gov> wrote:
>  > Is there a complete working example for the tabbedPanel tag?  I found
>  >  this example in the tag reference document.  How do I set up the
>  result
>  >  for AjaxTest.action?  I loaded the dynamic contents in that action
>  and
>  >  directed it to the jsp that displays that content.  The action was
>  >  invoked, but the tab shows up empty.  I tried to include the jsp
>  inside
>  >  the s:div tag and still nothing.
>  >
>  >  <s:tabbedpanel id="test" beforeSelectTabNotifyTopics="/beforeSelect">
>  >    <s:div id="three" label="remote" theme="ajax"
>  href="/AjaxTest.action"
>  >  >
>  >        One Tab
>  >    </s:div>
>  >    <s:div id="three" label="remote" theme="ajax"
>  href="/AjaxTest.action"
>  >  >
>  >        Another tab
>  >    </s:div>
>  >  </s:tabbedpanel>
>  >
>  >  Thanks a lot for your help,
>  >
>  >  Jane
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  >  For additional commands, e-mail: user-help@struts.apache.org
>  >
>  >
>
>
>
>  --
>  "Hey you! Would you help me to carry the stone?" Pink Floyd
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


RE: Need help getting started with remote tabs

Posted by "Jiang, Jane (NIH/NCI) [C]" <ji...@mail.nih.gov>.
Musachy,

Thanks for your suggestion.  Do you mean this showcase?

http://www.planetstruts.org/struts2-showcase/ajax/tabbedpanel/example3.j
sp

I found the source for the jsp, but there is no source code for the
action.  Is there a place to download the complete source code?

Thank you,

Jane

-----Original Message-----
From: Musachy Barroso [mailto:musachy@gmail.com] 
Sent: Wednesday, April 09, 2008 5:38 PM
To: Struts Users Mailing List
Subject: Re: Need help getting started with remote tabs

There are examples in the showcase application.

musachy

On Wed, Apr 9, 2008 at 8:55 PM, Jiang, Jane (NIH/NCI) [C]
<ji...@mail.nih.gov> wrote:
> Is there a complete working example for the tabbedPanel tag?  I found
>  this example in the tag reference document.  How do I set up the
result
>  for AjaxTest.action?  I loaded the dynamic contents in that action
and
>  directed it to the jsp that displays that content.  The action was
>  invoked, but the tab shows up empty.  I tried to include the jsp
inside
>  the s:div tag and still nothing.
>
>  <s:tabbedpanel id="test" beforeSelectTabNotifyTopics="/beforeSelect">
>    <s:div id="three" label="remote" theme="ajax"
href="/AjaxTest.action"
>  >
>        One Tab
>    </s:div>
>    <s:div id="three" label="remote" theme="ajax"
href="/AjaxTest.action"
>  >
>        Another tab
>    </s:div>
>  </s:tabbedpanel>
>
>  Thanks a lot for your help,
>
>  Jane
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


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


Re: Need help getting started with remote tabs

Posted by Musachy Barroso <mu...@gmail.com>.
There are examples in the showcase application.

musachy

On Wed, Apr 9, 2008 at 8:55 PM, Jiang, Jane (NIH/NCI) [C]
<ji...@mail.nih.gov> wrote:
> Is there a complete working example for the tabbedPanel tag?  I found
>  this example in the tag reference document.  How do I set up the result
>  for AjaxTest.action?  I loaded the dynamic contents in that action and
>  directed it to the jsp that displays that content.  The action was
>  invoked, but the tab shows up empty.  I tried to include the jsp inside
>  the s:div tag and still nothing.
>
>  <s:tabbedpanel id="test" beforeSelectTabNotifyTopics="/beforeSelect">
>    <s:div id="three" label="remote" theme="ajax" href="/AjaxTest.action"
>  >
>        One Tab
>    </s:div>
>    <s:div id="three" label="remote" theme="ajax" href="/AjaxTest.action"
>  >
>        Another tab
>    </s:div>
>  </s:tabbedpanel>
>
>  Thanks a lot for your help,
>
>  Jane
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Need help getting started with remote tabs

Posted by "Jiang, Jane (NIH/NCI) [C]" <ji...@mail.nih.gov>.
Is there a complete working example for the tabbedPanel tag?  I found
this example in the tag reference document.  How do I set up the result
for AjaxTest.action?  I loaded the dynamic contents in that action and
directed it to the jsp that displays that content.  The action was
invoked, but the tab shows up empty.  I tried to include the jsp inside
the s:div tag and still nothing.  

<s:tabbedpanel id="test" beforeSelectTabNotifyTopics="/beforeSelect">
   <s:div id="three" label="remote" theme="ajax" href="/AjaxTest.action"
>
       One Tab
   </s:div>
   <s:div id="three" label="remote" theme="ajax" href="/AjaxTest.action"
>
       Another tab
   </s:div>
</s:tabbedpanel>

Thanks a lot for your help,

Jane

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


Re: date conversion

Posted by "Alberto A. Flores" <aa...@gmail.com>.
the synchronized is not needed

Adam Hardy wrote:
> Actually I use it in a static method on a utility class, and call 
> SimpleDateFormat inside a synchronized block.
> 
> Brad A Cupit on 09/04/08 13:51, wrote:
>>>> Consider placing the SimpleDateFormat as a local variable
>> exactly right
>>
>> or, consider using a ThreadLocal
>> or, consider using commons-lang's FastDateFormat
>>
>> http://commons.apache.org/lang/api-release/org/apache/commons/lang/time/
>> FastDateFormat.html
>>
>> Brad Cupit
>> Louisiana State University - UIS
>> e-mail: brad@lsu.edu
>> office: 225.578.4774
>>
>>
>> -----Original Message-----
>> From: Alberto A. Flores [mailto:aaflores@gmail.com] Sent: Wednesday, 
>> April 09, 2008 7:48 AM
>> To: Struts Users Mailing List
>> Subject: Re: date conversion
>>
>> Consider placing the SimpleDateFormat as a local variable (within the 
>> method) to avoid non-thread safe operations (guaranteed by the jvm
>> spec).
>>
>>
>> Brad A Cupit wrote:
>>> the static SimpleDateFormat (assuming this code is in an S2 Action
>> that
>>> is instantiated per request) is not thread safe.
>>>
>>>
>> http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html#sy
>>> nchronization
>>>
>>> Brad Cupit
>>> Louisiana State University - UIS
>>>
>>> -----Original Message-----
>>> From: Zoran Avtarovski [mailto:zoran@sparecreative.com] Sent: 
>>> Tuesday, April 08, 2008 7:30 PM
>>> To: Struts Users Mailing List
>>> Subject: Re: date conversion
>>>
>>> We had the same issue and went with writing a new converter (shown
>>> below).
>>> And then created a xwork-conversion.properties file pointing to it.
>>>
>>> Z.
>>>
>>>     private final static SimpleDateFormat DATE_FORMAT = new
>>> SimpleDateFormat("dd/MM/yyyy");     @Override    public Object
>>> convertFromString(Map context, String[] values, Class toType) throws
>>> TypeConversionException {            try {                return
>>> DATE_FORMAT.parse( values[0]);            } catch (ParseException e) {
>>> e.printStackTrace();                throw new
>>> TypeConversionException("xwork.default.invalid.fieldvalue");
>>> }
>>> return null;    }     @Override    public String convertToString(Map
>>> context, Object object) {        Calendar cal =
>> Calendar.getInstance();
>>> cal.setTime((Date) object);                try {             return
>>> DATE_FORMAT.format(object);                } catch (Exception e) {
>>> throw new TypeConversionException("xwork.default.invalid.fieldvalue");
>>> }    }
>>>
>>>> Can you patch a whole class?
>>>>
>>>> What would be useful is parameterizable type converters, to specify
>>> the date
>>>> format in this case. (they're not parameterizable, are they?)
>>>>
>>>> Dave Newton on 08/04/08 22:13, wrote:
>>>>>> --- Adam Hardy <ah...@cyberspaceroad.com> wrote:
>>>>>>>> One area where S1 actually had the upper hand :(
>>>>>> Submit a patch :)
>>>>>>
>>>>>> Dave
>>>>>>
>>>>>>>> Dave Newton on 08/04/08 18:36, wrote:
>>>>>>>>>> The built-in type converter uses "uses the SHORT format for the
>>> Locale
>>>>>>>>>> associated with the current request" according to the type
>>> conversion
>>>>>>>> docs,
>>>>>>>>>> so yes, you'll need to do your own if you're using a different
>>> input
>>>>>>>> format.
>>>>>>>>>> Looking through the XWork conversion code it's hard for me to
>>> tell what
>>>>>>>> it's
>>>>>>>>>> *actually* doing, though :/
>>>>>>>>>>
>>>>>>>>>> Dave
>>>>>>>>>>
>>>>>>>>>> --- Brad A Cupit <br...@lsu.edu> wrote:
>>>>>>>>>>
>>>>>>>>>>>> JSTL has the <fmt:formatDate> tag. If you want to do it in
>>> Java,
>>>>>>>> rather
>>>>>>>>>>>> than your JSP, you can use SimpleDateFormat.
>>>>>>>>>>>>
>>>>>>>>>>>> Be aware that SimpleDataFormat is not thread safe, so don't
>>> assign it
>>> to
>>>>>>>> a
>>>>>>>>>>>> static field or use it in a singleton. If you use it as an
>>> instance
>>>>>>>> field
>>>>>>>>>>>> on an Action you'll be safe, since Actions are created per
>>> request.
>>>>>>>>>>>> If you want a thread safe version of SimpleDateFormat,
>>> Jakarta
>>>>>>>> Commons
>>>>>>>> lang
>>>>>>>>>>>> has FastDateFormat: http://commons.apache.org/lang/
>>>>>>>>>>>>
>>>>>>>>>>>> Brad Cupit
>>>>>>>>>>>> Louisiana State University - UIS
>>>>>>>>>>>> e-mail: brad@lsu.edu
>>>>>>>>>>>> office: 225.578.4774
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> -----Original Message-----
>>>>>>>>>>>> From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com]
>>>>>>>>>>>> Sent: Tuesday, April 08, 2008 12:11 PM
>>>>>>>>>>>> To: Struts Users Mailing List
>>>>>>>>>>>> Subject: date conversion
>>>>>>>>>>>>
>>>>>>>>>>>> Hi
>>>>>>>>>>>>
>>>>>>>>>>>> quick question, I can't find any specific mention of what I
>>> want so I
>>>>>>>>>>>> assume I
>>>>>>>>>>>> have to code my own Converter.
>>>>>>>>>>>>
>>>>>>>>>>>> I need a date in the ISO format YYYY-MM-DD
>>>>>>>>>>>>
>>>>>>>>>>>> There is no converter that I can configure in the struts
>>> package, is
>>>>>>>> there?
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

-- 

Alberto A. Flores
http://www.linkedin.com/in/aflores



Re: date conversion

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Actually I use it in a static method on a utility class, and call 
SimpleDateFormat inside a synchronized block.

Brad A Cupit on 09/04/08 13:51, wrote:
>>> Consider placing the SimpleDateFormat as a local variable
> exactly right
> 
> or, consider using a ThreadLocal
> or, consider using commons-lang's FastDateFormat
> 
> http://commons.apache.org/lang/api-release/org/apache/commons/lang/time/
> FastDateFormat.html
> 
> Brad Cupit
> Louisiana State University - UIS
> e-mail: brad@lsu.edu
> office: 225.578.4774
> 
> 
> -----Original Message-----
> From: Alberto A. Flores [mailto:aaflores@gmail.com] 
> Sent: Wednesday, April 09, 2008 7:48 AM
> To: Struts Users Mailing List
> Subject: Re: date conversion
> 
> Consider placing the SimpleDateFormat as a local variable (within the 
> method) to avoid non-thread safe operations (guaranteed by the jvm
> spec).
> 
> 
> Brad A Cupit wrote:
>> the static SimpleDateFormat (assuming this code is in an S2 Action
> that
>> is instantiated per request) is not thread safe.
>>
>>
> http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html#sy
>> nchronization
>>
>> Brad Cupit
>> Louisiana State University - UIS
>>
>> -----Original Message-----
>> From: Zoran Avtarovski [mailto:zoran@sparecreative.com] 
>> Sent: Tuesday, April 08, 2008 7:30 PM
>> To: Struts Users Mailing List
>> Subject: Re: date conversion
>>
>> We had the same issue and went with writing a new converter (shown
>> below).
>> And then created a xwork-conversion.properties file pointing to it.
>>
>> Z.
>>
>>     private final static SimpleDateFormat DATE_FORMAT = new
>> SimpleDateFormat("dd/MM/yyyy");     @Override    public Object
>> convertFromString(Map context, String[] values, Class toType) throws
>> TypeConversionException {            try {                return
>> DATE_FORMAT.parse( values[0]);            } catch (ParseException e) {
>> e.printStackTrace();                throw new
>> TypeConversionException("xwork.default.invalid.fieldvalue");
>> }
>> return null;    }     @Override    public String convertToString(Map
>> context, Object object) {        Calendar cal =
> Calendar.getInstance();
>> cal.setTime((Date) object);                try {             return
>> DATE_FORMAT.format(object);                } catch (Exception e) {
>> throw new TypeConversionException("xwork.default.invalid.fieldvalue");
>> }    } 
>>
>>
>>> Can you patch a whole class?
>>>
>>> What would be useful is parameterizable type converters, to specify
>> the date
>>> format in this case. (they're not parameterizable, are they?)
>>>
>>> Dave Newton on 08/04/08 22:13, wrote:
>>>>> --- Adam Hardy <ah...@cyberspaceroad.com> wrote:
>>>>>>> One area where S1 actually had the upper hand :(
>>>>> Submit a patch :)
>>>>>
>>>>> Dave
>>>>>
>>>>>>> Dave Newton on 08/04/08 18:36, wrote:
>>>>>>>>> The built-in type converter uses "uses the SHORT format for the
>> Locale
>>>>>>>>> associated with the current request" according to the type
>> conversion
>>>>>>> docs,
>>>>>>>>> so yes, you'll need to do your own if you're using a different
>> input
>>>>>>> format.
>>>>>>>>> Looking through the XWork conversion code it's hard for me to
>> tell what
>>>>>>> it's
>>>>>>>>> *actually* doing, though :/
>>>>>>>>>
>>>>>>>>> Dave
>>>>>>>>>
>>>>>>>>> --- Brad A Cupit <br...@lsu.edu> wrote:
>>>>>>>>>
>>>>>>>>>>> JSTL has the <fmt:formatDate> tag. If you want to do it in
>> Java,
>>>>>>> rather
>>>>>>>>>>> than your JSP, you can use SimpleDateFormat.
>>>>>>>>>>>
>>>>>>>>>>> Be aware that SimpleDataFormat is not thread safe, so don't
>> assign it
>> to
>>>>>>> a
>>>>>>>>>>> static field or use it in a singleton. If you use it as an
>> instance
>>>>>>> field
>>>>>>>>>>> on an Action you'll be safe, since Actions are created per
>> request.
>>>>>>>>>>> If you want a thread safe version of SimpleDateFormat,
>> Jakarta
>>>>>>> Commons
>>>>>>> lang
>>>>>>>>>>> has FastDateFormat: http://commons.apache.org/lang/
>>>>>>>>>>>
>>>>>>>>>>> Brad Cupit
>>>>>>>>>>> Louisiana State University - UIS
>>>>>>>>>>> e-mail: brad@lsu.edu
>>>>>>>>>>> office: 225.578.4774
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> -----Original Message-----
>>>>>>>>>>> From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com]
>>>>>>>>>>> Sent: Tuesday, April 08, 2008 12:11 PM
>>>>>>>>>>> To: Struts Users Mailing List
>>>>>>>>>>> Subject: date conversion
>>>>>>>>>>>
>>>>>>>>>>> Hi
>>>>>>>>>>>
>>>>>>>>>>> quick question, I can't find any specific mention of what I
>> want so I
>>>>>>>>>>> assume I
>>>>>>>>>>> have to code my own Converter.
>>>>>>>>>>>
>>>>>>>>>>> I need a date in the ISO format YYYY-MM-DD
>>>>>>>>>>>
>>>>>>>>>>> There is no converter that I can configure in the struts
>> package, is
>>>>>>> there?


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


RE: date conversion

Posted by Brad A Cupit <br...@lsu.edu>.
>> Consider placing the SimpleDateFormat as a local variable
exactly right

or, consider using a ThreadLocal
or, consider using commons-lang's FastDateFormat

http://commons.apache.org/lang/api-release/org/apache/commons/lang/time/
FastDateFormat.html

Brad Cupit
Louisiana State University - UIS
e-mail: brad@lsu.edu
office: 225.578.4774


-----Original Message-----
From: Alberto A. Flores [mailto:aaflores@gmail.com] 
Sent: Wednesday, April 09, 2008 7:48 AM
To: Struts Users Mailing List
Subject: Re: date conversion

Consider placing the SimpleDateFormat as a local variable (within the 
method) to avoid non-thread safe operations (guaranteed by the jvm
spec).


Brad A Cupit wrote:
> the static SimpleDateFormat (assuming this code is in an S2 Action
that
> is instantiated per request) is not thread safe.
> 
>
http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html#sy
> nchronization
> 
> Brad Cupit
> Louisiana State University - UIS
> 
> -----Original Message-----
> From: Zoran Avtarovski [mailto:zoran@sparecreative.com] 
> Sent: Tuesday, April 08, 2008 7:30 PM
> To: Struts Users Mailing List
> Subject: Re: date conversion
> 
> We had the same issue and went with writing a new converter (shown
> below).
> And then created a xwork-conversion.properties file pointing to it.
> 
> Z.
> 
>     private final static SimpleDateFormat DATE_FORMAT = new
> SimpleDateFormat("dd/MM/yyyy");     @Override    public Object
> convertFromString(Map context, String[] values, Class toType) throws
> TypeConversionException {            try {                return
> DATE_FORMAT.parse( values[0]);            } catch (ParseException e) {
> e.printStackTrace();                throw new
> TypeConversionException("xwork.default.invalid.fieldvalue");
> }
> return null;    }     @Override    public String convertToString(Map
> context, Object object) {        Calendar cal =
Calendar.getInstance();
> cal.setTime((Date) object);                try {             return
> DATE_FORMAT.format(object);                } catch (Exception e) {
> throw new TypeConversionException("xwork.default.invalid.fieldvalue");
> }    } 
> 
> 
>> Can you patch a whole class?
>>
>> What would be useful is parameterizable type converters, to specify
> the date
>> format in this case. (they're not parameterizable, are they?)
>>
>> Dave Newton on 08/04/08 22:13, wrote:
>>>> --- Adam Hardy <ah...@cyberspaceroad.com> wrote:
>>>>>> One area where S1 actually had the upper hand :(
>>>> Submit a patch :)
>>>>
>>>> Dave
>>>>
>>>>>> Dave Newton on 08/04/08 18:36, wrote:
>>>>>>>> The built-in type converter uses "uses the SHORT format for the
> Locale
>>>>>>>> associated with the current request" according to the type
> conversion
>>>>>> docs,
>>>>>>>> so yes, you'll need to do your own if you're using a different
> input
>>>>>> format.
>>>>>>>> Looking through the XWork conversion code it's hard for me to
> tell what
>>>>>> it's
>>>>>>>> *actually* doing, though :/
>>>>>>>>
>>>>>>>> Dave
>>>>>>>>
>>>>>>>> --- Brad A Cupit <br...@lsu.edu> wrote:
>>>>>>>>
>>>>>>>>>> JSTL has the <fmt:formatDate> tag. If you want to do it in
> Java,
>>>>>> rather
>>>>>>>>>> than your JSP, you can use SimpleDateFormat.
>>>>>>>>>>
>>>>>>>>>> Be aware that SimpleDataFormat is not thread safe, so don't
> assign it
> to
>>>>>> a
>>>>>>>>>> static field or use it in a singleton. If you use it as an
> instance
>>>>>> field
>>>>>>>>>> on an Action you'll be safe, since Actions are created per
> request.
>>>>>>>>>> If you want a thread safe version of SimpleDateFormat,
> Jakarta
>>>>>> Commons
>>>>>> lang
>>>>>>>>>> has FastDateFormat: http://commons.apache.org/lang/
>>>>>>>>>>
>>>>>>>>>> Brad Cupit
>>>>>>>>>> Louisiana State University - UIS
>>>>>>>>>> e-mail: brad@lsu.edu
>>>>>>>>>> office: 225.578.4774
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -----Original Message-----
>>>>>>>>>> From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com]
>>>>>>>>>> Sent: Tuesday, April 08, 2008 12:11 PM
>>>>>>>>>> To: Struts Users Mailing List
>>>>>>>>>> Subject: date conversion
>>>>>>>>>>
>>>>>>>>>> Hi
>>>>>>>>>>
>>>>>>>>>> quick question, I can't find any specific mention of what I
> want so I
>>>>>>>>>> assume I
>>>>>>>>>> have to code my own Converter.
>>>>>>>>>>
>>>>>>>>>> I need a date in the ISO format YYYY-MM-DD
>>>>>>>>>>
>>>>>>>>>> There is no converter that I can configure in the struts
> package, is
>>>>>> there?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

-- 

Alberto A. Flores
http://www.linkedin.com/in/aflores



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


Re: date conversion

Posted by "Alberto A. Flores" <aa...@gmail.com>.
Consider placing the SimpleDateFormat as a local variable (within the 
method) to avoid non-thread safe operations (guaranteed by the jvm spec).


Brad A Cupit wrote:
> the static SimpleDateFormat (assuming this code is in an S2 Action that
> is instantiated per request) is not thread safe.
> 
> http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html#sy
> nchronization
> 
> Brad Cupit
> Louisiana State University - UIS
> 
> -----Original Message-----
> From: Zoran Avtarovski [mailto:zoran@sparecreative.com] 
> Sent: Tuesday, April 08, 2008 7:30 PM
> To: Struts Users Mailing List
> Subject: Re: date conversion
> 
> We had the same issue and went with writing a new converter (shown
> below).
> And then created a xwork-conversion.properties file pointing to it.
> 
> Z.
> 
>     private final static SimpleDateFormat DATE_FORMAT = new
> SimpleDateFormat("dd/MM/yyyy");     @Override    public Object
> convertFromString(Map context, String[] values, Class toType) throws
> TypeConversionException {            try {                return
> DATE_FORMAT.parse( values[0]);            } catch (ParseException e) {
> e.printStackTrace();                throw new
> TypeConversionException("xwork.default.invalid.fieldvalue");
> }
> return null;    }     @Override    public String convertToString(Map
> context, Object object) {        Calendar cal = Calendar.getInstance();
> cal.setTime((Date) object);                try {             return
> DATE_FORMAT.format(object);                } catch (Exception e) {
> throw new TypeConversionException("xwork.default.invalid.fieldvalue");
> }    } 
> 
> 
>> Can you patch a whole class?
>>
>> What would be useful is parameterizable type converters, to specify
> the date
>> format in this case. (they're not parameterizable, are they?)
>>
>> Dave Newton on 08/04/08 22:13, wrote:
>>>> --- Adam Hardy <ah...@cyberspaceroad.com> wrote:
>>>>>> One area where S1 actually had the upper hand :(
>>>> Submit a patch :)
>>>>
>>>> Dave
>>>>
>>>>>> Dave Newton on 08/04/08 18:36, wrote:
>>>>>>>> The built-in type converter uses "uses the SHORT format for the
> Locale
>>>>>>>> associated with the current request" according to the type
> conversion
>>>>>> docs,
>>>>>>>> so yes, you'll need to do your own if you're using a different
> input
>>>>>> format.
>>>>>>>> Looking through the XWork conversion code it's hard for me to
> tell what
>>>>>> it's
>>>>>>>> *actually* doing, though :/
>>>>>>>>
>>>>>>>> Dave
>>>>>>>>
>>>>>>>> --- Brad A Cupit <br...@lsu.edu> wrote:
>>>>>>>>
>>>>>>>>>> JSTL has the <fmt:formatDate> tag. If you want to do it in
> Java,
>>>>>> rather
>>>>>>>>>> than your JSP, you can use SimpleDateFormat.
>>>>>>>>>>
>>>>>>>>>> Be aware that SimpleDataFormat is not thread safe, so don't
> assign it
> to
>>>>>> a
>>>>>>>>>> static field or use it in a singleton. If you use it as an
> instance
>>>>>> field
>>>>>>>>>> on an Action you'll be safe, since Actions are created per
> request.
>>>>>>>>>> If you want a thread safe version of SimpleDateFormat,
> Jakarta
>>>>>> Commons
>>>>>> lang
>>>>>>>>>> has FastDateFormat: http://commons.apache.org/lang/
>>>>>>>>>>
>>>>>>>>>> Brad Cupit
>>>>>>>>>> Louisiana State University - UIS
>>>>>>>>>> e-mail: brad@lsu.edu
>>>>>>>>>> office: 225.578.4774
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -----Original Message-----
>>>>>>>>>> From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com]
>>>>>>>>>> Sent: Tuesday, April 08, 2008 12:11 PM
>>>>>>>>>> To: Struts Users Mailing List
>>>>>>>>>> Subject: date conversion
>>>>>>>>>>
>>>>>>>>>> Hi
>>>>>>>>>>
>>>>>>>>>> quick question, I can't find any specific mention of what I
> want so I
>>>>>>>>>> assume I
>>>>>>>>>> have to code my own Converter.
>>>>>>>>>>
>>>>>>>>>> I need a date in the ISO format YYYY-MM-DD
>>>>>>>>>>
>>>>>>>>>> There is no converter that I can configure in the struts
> package, is
>>>>>> there?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

-- 

Alberto A. Flores
http://www.linkedin.com/in/aflores



RE: date conversion

Posted by Brad A Cupit <br...@lsu.edu>.
the static SimpleDateFormat (assuming this code is in an S2 Action that
is instantiated per request) is not thread safe.

http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html#sy
nchronization

Brad Cupit
Louisiana State University - UIS

-----Original Message-----
From: Zoran Avtarovski [mailto:zoran@sparecreative.com] 
Sent: Tuesday, April 08, 2008 7:30 PM
To: Struts Users Mailing List
Subject: Re: date conversion

We had the same issue and went with writing a new converter (shown
below).
And then created a xwork-conversion.properties file pointing to it.

Z.

    private final static SimpleDateFormat DATE_FORMAT = new
SimpleDateFormat("dd/MM/yyyy");     @Override    public Object
convertFromString(Map context, String[] values, Class toType) throws
TypeConversionException {            try {                return
DATE_FORMAT.parse( values[0]);            } catch (ParseException e) {
e.printStackTrace();                throw new
TypeConversionException("xwork.default.invalid.fieldvalue");
}
return null;    }     @Override    public String convertToString(Map
context, Object object) {        Calendar cal = Calendar.getInstance();
cal.setTime((Date) object);                try {             return
DATE_FORMAT.format(object);                } catch (Exception e) {
throw new TypeConversionException("xwork.default.invalid.fieldvalue");
}    } 


> 
> Can you patch a whole class?
> 
> What would be useful is parameterizable type converters, to specify
the date
> format in this case. (they're not parameterizable, are they?)
> 
> Dave Newton on 08/04/08 22:13, wrote:
>> > --- Adam Hardy <ah...@cyberspaceroad.com> wrote:
>>> >> One area where S1 actually had the upper hand :(
>> > 
>> > Submit a patch :)
>> > 
>> > Dave
>> > 
>>> >> Dave Newton on 08/04/08 18:36, wrote:
>>>> >>> The built-in type converter uses "uses the SHORT format for the
Locale
>>>> >>> associated with the current request" according to the type
conversion
>>> >> docs,
>>>> >>> so yes, you'll need to do your own if you're using a different
input
>>> >> format.
>>>> >>> Looking through the XWork conversion code it's hard for me to
tell what
>>> >> it's
>>>> >>> *actually* doing, though :/
>>>> >>>
>>>> >>> Dave
>>>> >>>
>>>> >>> --- Brad A Cupit <br...@lsu.edu> wrote:
>>>> >>>
>>>>> >>>> JSTL has the <fmt:formatDate> tag. If you want to do it in
Java,
>>>>> rather
>>>>> >>>> than your JSP, you can use SimpleDateFormat.
>>>>> >>>>
>>>>> >>>> Be aware that SimpleDataFormat is not thread safe, so don't
assign it
to
>>> >> a
>>>>> >>>> static field or use it in a singleton. If you use it as an
instance
>>> >> field
>>>>> >>>> on an Action you'll be safe, since Actions are created per
request.
>>>>> >>>>
>>>>> >>>> If you want a thread safe version of SimpleDateFormat,
Jakarta
>>>>> Commons
>>> >> lang
>>>>> >>>> has FastDateFormat: http://commons.apache.org/lang/
>>>>> >>>>
>>>>> >>>> Brad Cupit
>>>>> >>>> Louisiana State University - UIS
>>>>> >>>> e-mail: brad@lsu.edu
>>>>> >>>> office: 225.578.4774
>>>>> >>>>
>>>>> >>>>
>>>>> >>>> -----Original Message-----
>>>>> >>>> From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com]
>>>>> >>>> Sent: Tuesday, April 08, 2008 12:11 PM
>>>>> >>>> To: Struts Users Mailing List
>>>>> >>>> Subject: date conversion
>>>>> >>>>
>>>>> >>>> Hi
>>>>> >>>>
>>>>> >>>> quick question, I can't find any specific mention of what I
want so I
>>>>> >>>> assume I
>>>>> >>>> have to code my own Converter.
>>>>> >>>>
>>>>> >>>> I need a date in the ISO format YYYY-MM-DD
>>>>> >>>>
>>>>> >>>> There is no converter that I can configure in the struts
package, is
>>> >> there?
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 



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


Re: date conversion

Posted by "Alberto A. Flores" <aa...@gmail.com>.
Also, consider to inject the format in your IoC container (Guice, 
Spring, etc).

Zoran Avtarovski wrote:
> We had the same issue and went with writing a new converter (shown below).
> And then created a xwork-conversion.properties file pointing to it.
> 
> Z.
> 
>     private final static SimpleDateFormat DATE_FORMAT = new
> SimpleDateFormat("dd/MM/yyyy");     @Override    public Object
> convertFromString(Map context, String[] values, Class toType) throws
> TypeConversionException {            try {                return
> DATE_FORMAT.parse( values[0]);            } catch (ParseException e) {
> e.printStackTrace();                throw new
> TypeConversionException("xwork.default.invalid.fieldvalue");            }
> return null;    }     @Override    public String convertToString(Map
> context, Object object) {        Calendar cal = Calendar.getInstance();
> cal.setTime((Date) object);                try {             return
> DATE_FORMAT.format(object);                } catch (Exception e) {
> throw new TypeConversionException("xwork.default.invalid.fieldvalue");
> }    } 
> 
> 
>> Can you patch a whole class?
>>
>> What would be useful is parameterizable type converters, to specify the date
>> format in this case. (they're not parameterizable, are they?)
>>
>> Dave Newton on 08/04/08 22:13, wrote:
>>>> --- Adam Hardy <ah...@cyberspaceroad.com> wrote:
>>>>>> One area where S1 actually had the upper hand :(
>>>> Submit a patch :)
>>>>
>>>> Dave
>>>>
>>>>>> Dave Newton on 08/04/08 18:36, wrote:
>>>>>>>> The built-in type converter uses "uses the SHORT format for the Locale
>>>>>>>> associated with the current request" according to the type conversion
>>>>>> docs,
>>>>>>>> so yes, you'll need to do your own if you're using a different input
>>>>>> format.
>>>>>>>> Looking through the XWork conversion code it's hard for me to tell what
>>>>>> it's
>>>>>>>> *actually* doing, though :/
>>>>>>>>
>>>>>>>> Dave
>>>>>>>>
>>>>>>>> --- Brad A Cupit <br...@lsu.edu> wrote:
>>>>>>>>
>>>>>>>>>> JSTL has the <fmt:formatDate> tag. If you want to do it in Java,
>>>>>> rather
>>>>>>>>>> than your JSP, you can use SimpleDateFormat.
>>>>>>>>>>
>>>>>>>>>> Be aware that SimpleDataFormat is not thread safe, so don't assign it
> to
>>>>>> a
>>>>>>>>>> static field or use it in a singleton. If you use it as an instance
>>>>>> field
>>>>>>>>>> on an Action you'll be safe, since Actions are created per request.
>>>>>>>>>>
>>>>>>>>>> If you want a thread safe version of SimpleDateFormat, Jakarta
>>>>>> Commons
>>>>>> lang
>>>>>>>>>> has FastDateFormat: http://commons.apache.org/lang/
>>>>>>>>>>
>>>>>>>>>> Brad Cupit
>>>>>>>>>> Louisiana State University - UIS
>>>>>>>>>> e-mail: brad@lsu.edu
>>>>>>>>>> office: 225.578.4774
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -----Original Message-----
>>>>>>>>>> From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com]
>>>>>>>>>> Sent: Tuesday, April 08, 2008 12:11 PM
>>>>>>>>>> To: Struts Users Mailing List
>>>>>>>>>> Subject: date conversion
>>>>>>>>>>
>>>>>>>>>> Hi
>>>>>>>>>>
>>>>>>>>>> quick question, I can't find any specific mention of what I want so I
>>>>>>>>>> assume I
>>>>>>>>>> have to code my own Converter.
>>>>>>>>>>
>>>>>>>>>> I need a date in the ISO format YYYY-MM-DD
>>>>>>>>>>
>>>>>>>>>> There is no converter that I can configure in the struts package, is
>>>>>> there?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
> 
> 
> 

-- 

Alberto A. Flores
http://www.linkedin.com/in/aflores



Re: date conversion

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
We had the same issue and went with writing a new converter (shown below).
And then created a xwork-conversion.properties file pointing to it.

Z.

    private final static SimpleDateFormat DATE_FORMAT = new
SimpleDateFormat("dd/MM/yyyy");     @Override    public Object
convertFromString(Map context, String[] values, Class toType) throws
TypeConversionException {            try {                return
DATE_FORMAT.parse( values[0]);            } catch (ParseException e) {
e.printStackTrace();                throw new
TypeConversionException("xwork.default.invalid.fieldvalue");            }
return null;    }     @Override    public String convertToString(Map
context, Object object) {        Calendar cal = Calendar.getInstance();
cal.setTime((Date) object);                try {             return
DATE_FORMAT.format(object);                } catch (Exception e) {
throw new TypeConversionException("xwork.default.invalid.fieldvalue");
}    } 


> 
> Can you patch a whole class?
> 
> What would be useful is parameterizable type converters, to specify the date
> format in this case. (they're not parameterizable, are they?)
> 
> Dave Newton on 08/04/08 22:13, wrote:
>> > --- Adam Hardy <ah...@cyberspaceroad.com> wrote:
>>> >> One area where S1 actually had the upper hand :(
>> > 
>> > Submit a patch :)
>> > 
>> > Dave
>> > 
>>> >> Dave Newton on 08/04/08 18:36, wrote:
>>>> >>> The built-in type converter uses "uses the SHORT format for the Locale
>>>> >>> associated with the current request" according to the type conversion
>>> >> docs,
>>>> >>> so yes, you'll need to do your own if you're using a different input
>>> >> format.
>>>> >>> Looking through the XWork conversion code it's hard for me to tell what
>>> >> it's
>>>> >>> *actually* doing, though :/
>>>> >>>
>>>> >>> Dave
>>>> >>>
>>>> >>> --- Brad A Cupit <br...@lsu.edu> wrote:
>>>> >>>
>>>>> >>>> JSTL has the <fmt:formatDate> tag. If you want to do it in Java,
>>>>> rather
>>>>> >>>> than your JSP, you can use SimpleDateFormat.
>>>>> >>>>
>>>>> >>>> Be aware that SimpleDataFormat is not thread safe, so don't assign it
to
>>> >> a
>>>>> >>>> static field or use it in a singleton. If you use it as an instance
>>> >> field
>>>>> >>>> on an Action you'll be safe, since Actions are created per request.
>>>>> >>>>
>>>>> >>>> If you want a thread safe version of SimpleDateFormat, Jakarta
>>>>> Commons
>>> >> lang
>>>>> >>>> has FastDateFormat: http://commons.apache.org/lang/
>>>>> >>>>
>>>>> >>>> Brad Cupit
>>>>> >>>> Louisiana State University - UIS
>>>>> >>>> e-mail: brad@lsu.edu
>>>>> >>>> office: 225.578.4774
>>>>> >>>>
>>>>> >>>>
>>>>> >>>> -----Original Message-----
>>>>> >>>> From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com]
>>>>> >>>> Sent: Tuesday, April 08, 2008 12:11 PM
>>>>> >>>> To: Struts Users Mailing List
>>>>> >>>> Subject: date conversion
>>>>> >>>>
>>>>> >>>> Hi
>>>>> >>>>
>>>>> >>>> quick question, I can't find any specific mention of what I want so I
>>>>> >>>> assume I
>>>>> >>>> have to code my own Converter.
>>>>> >>>>
>>>>> >>>> I need a date in the ISO format YYYY-MM-DD
>>>>> >>>>
>>>>> >>>> There is no converter that I can configure in the struts package, is
>>> >> there?
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 



Re: date conversion

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Can you patch a whole class?

What would be useful is parameterizable type converters, to specify the date 
format in this case. (they're not parameterizable, are they?)

Dave Newton on 08/04/08 22:13, wrote:
> --- Adam Hardy <ah...@cyberspaceroad.com> wrote:
>> One area where S1 actually had the upper hand :(
> 
> Submit a patch :)
> 
> Dave
> 
>> Dave Newton on 08/04/08 18:36, wrote:
>>> The built-in type converter uses "uses the SHORT format for the Locale
>>> associated with the current request" according to the type conversion
>> docs,
>>> so yes, you'll need to do your own if you're using a different input
>> format.
>>> Looking through the XWork conversion code it's hard for me to tell what
>> it's
>>> *actually* doing, though :/
>>>
>>> Dave
>>>
>>> --- Brad A Cupit <br...@lsu.edu> wrote:
>>>
>>>> JSTL has the <fmt:formatDate> tag. If you want to do it in Java, rather
>>>> than your JSP, you can use SimpleDateFormat.
>>>>
>>>> Be aware that SimpleDataFormat is not thread safe, so don't assign it to
>> a
>>>> static field or use it in a singleton. If you use it as an instance
>> field
>>>> on an Action you'll be safe, since Actions are created per request.
>>>>
>>>> If you want a thread safe version of SimpleDateFormat, Jakarta Commons
>> lang
>>>> has FastDateFormat: http://commons.apache.org/lang/
>>>>
>>>> Brad Cupit
>>>> Louisiana State University - UIS
>>>> e-mail: brad@lsu.edu
>>>> office: 225.578.4774
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com] 
>>>> Sent: Tuesday, April 08, 2008 12:11 PM
>>>> To: Struts Users Mailing List
>>>> Subject: date conversion
>>>>
>>>> Hi
>>>>
>>>> quick question, I can't find any specific mention of what I want so I
>>>> assume I 
>>>> have to code my own Converter.
>>>>
>>>> I need a date in the ISO format YYYY-MM-DD
>>>>
>>>> There is no converter that I can configure in the struts package, is
>> there?


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


Re: date conversion

Posted by Dave Newton <ne...@yahoo.com>.
--- Adam Hardy <ah...@cyberspaceroad.com> wrote:
> One area where S1 actually had the upper hand :(

Submit a patch :)

Dave

> Dave Newton on 08/04/08 18:36, wrote:
> > The built-in type converter uses "uses the SHORT format for the Locale
> > associated with the current request" according to the type conversion
> docs,
> > so yes, you'll need to do your own if you're using a different input
> format.
> > 
> > Looking through the XWork conversion code it's hard for me to tell what
> it's
> > *actually* doing, though :/
> > 
> > Dave
> > 
> > --- Brad A Cupit <br...@lsu.edu> wrote:
> > 
> >> JSTL has the <fmt:formatDate> tag. If you want to do it in Java, rather
> >> than your JSP, you can use SimpleDateFormat.
> >>
> >> Be aware that SimpleDataFormat is not thread safe, so don't assign it to
> a
> >> static field or use it in a singleton. If you use it as an instance
> field
> >> on an Action you'll be safe, since Actions are created per request.
> >>
> >> If you want a thread safe version of SimpleDateFormat, Jakarta Commons
> lang
> >> has FastDateFormat: http://commons.apache.org/lang/
> >>
> >> Brad Cupit
> >> Louisiana State University - UIS
> >> e-mail: brad@lsu.edu
> >> office: 225.578.4774
> >>
> >>
> >> -----Original Message-----
> >> From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com] 
> >> Sent: Tuesday, April 08, 2008 12:11 PM
> >> To: Struts Users Mailing List
> >> Subject: date conversion
> >>
> >> Hi
> >>
> >> quick question, I can't find any specific mention of what I want so I
> >> assume I 
> >> have to code my own Converter.
> >>
> >> I need a date in the ISO format YYYY-MM-DD
> >>
> >> There is no converter that I can configure in the struts package, is
> there?
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


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


Re: date conversion

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
OK thanks guys.

One area where S1 actually had the upper hand :(

Dave Newton on 08/04/08 18:36, wrote:
> The built-in type converter uses "uses the SHORT format for the Locale
> associated with the current request" according to the type conversion docs,
> so yes, you'll need to do your own if you're using a different input format.
> 
> Looking through the XWork conversion code it's hard for me to tell what it's
> *actually* doing, though :/
> 
> Dave
> 
> --- Brad A Cupit <br...@lsu.edu> wrote:
> 
>> JSTL has the <fmt:formatDate> tag. If you want to do it in Java, rather
>> than your JSP, you can use SimpleDateFormat.
>>
>> Be aware that SimpleDataFormat is not thread safe, so don't assign it to a
>> static field or use it in a singleton. If you use it as an instance field
>> on an Action you'll be safe, since Actions are created per request.
>>
>> If you want a thread safe version of SimpleDateFormat, Jakarta Commons lang
>> has FastDateFormat: http://commons.apache.org/lang/
>>
>> Brad Cupit
>> Louisiana State University - UIS
>> e-mail: brad@lsu.edu
>> office: 225.578.4774
>>
>>
>> -----Original Message-----
>> From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com] 
>> Sent: Tuesday, April 08, 2008 12:11 PM
>> To: Struts Users Mailing List
>> Subject: date conversion
>>
>> Hi
>>
>> quick question, I can't find any specific mention of what I want so I
>> assume I 
>> have to code my own Converter.
>>
>> I need a date in the ISO format YYYY-MM-DD
>>
>> There is no converter that I can configure in the struts package, is there?


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


RE: date conversion

Posted by Dave Newton <ne...@yahoo.com>.
The built-in type converter uses "uses the SHORT format for the Locale
associated with the current request" according to the type conversion docs,
so yes, you'll need to do your own if you're using a different input format.

Looking through the XWork conversion code it's hard for me to tell what it's
*actually* doing, though :/

Dave

--- Brad A Cupit <br...@lsu.edu> wrote:

> JSTL has the <fmt:formatDate> tag. If you want to do it in Java, rather
> than your JSP, you can use SimpleDateFormat.
> 
> Be aware that SimpleDataFormat is not thread safe, so don't assign it to a
> static field or use it in a singleton. If you use it as an instance field
> on an Action you'll be safe, since Actions are created per request.
> 
> If you want a thread safe version of SimpleDateFormat, Jakarta Commons lang
> has FastDateFormat: http://commons.apache.org/lang/
> 
> Brad Cupit
> Louisiana State University - UIS
> e-mail: brad@lsu.edu
> office: 225.578.4774
> 
> 
> -----Original Message-----
> From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com] 
> Sent: Tuesday, April 08, 2008 12:11 PM
> To: Struts Users Mailing List
> Subject: date conversion
> 
> Hi
> 
> quick question, I can't find any specific mention of what I want so I
> assume I 
> have to code my own Converter.
> 
> I need a date in the ISO format YYYY-MM-DD
> 
> There is no converter that I can configure in the struts package, is there?
> 
> Thanks
> Adam
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


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


RE: date conversion

Posted by Brad A Cupit <br...@lsu.edu>.
JSTL has the <fmt:formatDate> tag. If you want to do it in Java, rather than your JSP, you can use SimpleDateFormat.

Be aware that SimpleDataFormat is not thread safe, so don't assign it to a static field or use it in a singleton. If you use it as an instance field on an Action you'll be safe, since Actions are created per request.

If you want a thread safe version of SimpleDateFormat, Jakarta Commons lang has FastDateFormat: http://commons.apache.org/lang/

Brad Cupit
Louisiana State University - UIS
e-mail: brad@lsu.edu
office: 225.578.4774


-----Original Message-----
From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com] 
Sent: Tuesday, April 08, 2008 12:11 PM
To: Struts Users Mailing List
Subject: date conversion

Hi

quick question, I can't find any specific mention of what I want so I assume I 
have to code my own Converter.

I need a date in the ISO format YYYY-MM-DD

There is no converter that I can configure in the struts package, is there?

Thanks
Adam

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