Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 9 Apr 2008 12:32:15 -0000 Issue 7970

user-digest-help

2008-04-09


Author LoginPost Reply

user Digest 9 Apr 2008 12:32:15 -0000 Issue 7970

Topics (messages 185169 through 185196):

date conversion
 185169 by: Adam Hardy
 185170 by: Brad A Cupit
 185171 by: Dave Newton
 185175 by: Adam Hardy
 185176 by: Dave Newton
 185183 by: Adam Hardy
 185189 by: Zoran Avtarovski
 185194 by: Alberto A. Flores

Re: another noob..
 185172 by: Berger, Michael
 185173 by: Antonio Petrelli

Re: interesting proxy + action chain issue
 185174 by: Ian Meikle
 185188 by: Jeromy Evans

Simple interceptor is not called
 185177 by: Peter Theissen
 185178 by: Dave Newton
 185179 by: Peter Theissen
 185180 by: Nils-Helge Garli Hegvik
 185185 by: Dave Newton

Request scoped data in Struts2
 185181 by: Raghuveer Kumarakrishnan
 185182 by: Chris Pratt
 185186 by: Raghuveer Kumarakrishnan
 185187 by: Dave Newton

Using fileupload throws,java.lang.RuntimeException: Unable to load bean org.apache.struts2.dispatcher.multipart.MultiPartRequest (jakarta) - [unknown location]
 185184 by: Peter McKeown

problem in file upload
 185190 by: Rajeev Sharma
 185195 by: Jeromy Evans

Struts 2 <s:a> URL tag problems
 185191 by: ancatdubher
 185192 by: 袁嘉铭

how to set dynamic name for html:radio
 185193 by: balaji.m.cs

Re: Problem with struts in JSP
 185196 by: Jeromy Evans

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)

----------------------------------------------------------------------

Attachment: user_185169.ezm (zipped)
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

Attachment: user_185170.ezm (zipped)
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@(protected)
office: 225.578.4774


-----Original Message-----
From: Adam Hardy [mailto:ahardy.struts@(protected)]
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@(protected)
For additional commands, e-mail: user-help@(protected)


Attachment: user_185171.ezm (zipped)
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 <brad@(protected):

> 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@(protected)
> office: 225.578.4774
>
>
> -----Original Message-----
> From: Adam Hardy [mailto:ahardy.struts@(protected)]
> 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@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


Attachment: user_185175.ezm (zipped)
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 <brad@(protected):
>
>> 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@(protected)
>> office: 225.578.4774
>>
>>
>> -----Original Message-----
>> From: Adam Hardy [mailto:ahardy.struts@(protected)]
>> 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?


Attachment: user_185176.ezm (zipped)
--- Adam Hardy <ahardy.struts@(protected):
> 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 <brad@(protected):
> >
> >> 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@(protected)
> >> office: 225.578.4774
> >>
> >>
> >> -----Original Message-----
> >> From: Adam Hardy [mailto:ahardy.struts@(protected)]
> >> 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@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


Attachment: user_185183.ezm (zipped)
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 <ahardy.struts@(protected):
>> 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 <brad@(protected):
>>>
>>>> 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@(protected)
>>>> office: 225.578.4774
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Adam Hardy [mailto:ahardy.struts@(protected)]
>>>> 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?


Attachment: user_185189.ezm (zipped)
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 <ahardy.struts@(protected):
>>> >> 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 <brad@(protected):
>>>> >>>
>>>>> >>>> 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@(protected)
>>>>> >>>> office: 225.578.4774
>>>>> >>>>
>>>>> >>>>
>>>>> >>>> -----Original Message-----
>>>>> >>>> From: Adam Hardy [mailto:ahardy.struts@(protected)]
>>>>> >>>> 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@(protected)
> For additional commands, e-mail: user-help@(protected)
>



Attachment: user_185194.ezm (zipped)
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 <ahardy.struts@(protected):
>>>>>> 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 <brad@(protected):
>>>>>>>>
>>>>>>>>>> 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@(protected)
>>>>>>>>>> office: 225.578.4774
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -----Original Message-----
>>>>>>>>>> From: Adam Hardy [mailto:ahardy.struts@(protected)]
>>>>>>>>>> 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@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>
>
>

--

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


Attachment: user_185172.ezm (zipped)
Hi Antonio,
Thanks for the response. I'm less confused now... I have been
google'ing how to use Struts, etc. Most of the answers I have found have
mentioned doing the following
Coping
Struts.jar, commons-beanutils.jar, commons-xxx.jar into the WEB-INF/lib
folder
Struts-html.tld, struts-bean.tld, struts-logic.tld, struts-nested.tld,
and struts-template.tld into the WEB-INF directory

Is that how things are still done. Am I supposed to unjar these jar
files to get to individual .tld files ?

Thanks for taking the time,
Mike

-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@(protected)]
Sent: Tuesday, April 08, 2008 8:18 AM
To: Struts Users Mailing List
Subject: Re: another noob..

2008/4/8, Berger, Michael <mberger3@(protected)>:
>
> All the .jar files I expected are there, but I can't find any of the
> .tld files.
> What am I mis-understanding / doing wrong ?



The TLD files are under:
META-INF/tld
directory of struts2-core.jar

Antonio

Attachment: user_185173.ezm (zipped)
2008/4/8, Berger, Michael <mberger3@(protected)>:
> Hi Antonio,
>  Thanks for the response. I'm less confused now... I have been
> google'ing how to use Struts, etc. Most of the answers I have found have
> mentioned doing the following
> Coping
> Struts.jar, commons-beanutils.jar, commons-xxx.jar into the WEB-INF/lib
> folder
> Struts-html.tld, struts-bean.tld, struts-logic.tld, struts-nested.tld,
> and struts-template.tld into the WEB-INF directory
>
> Is that how things are still done. Am I supposed to unjar these jar
> files to get to individual .tld files ?

I think you should start from the beginning. Do you want to use Struts 1 or 2?
For Struts 1 see: http://struts.apache.org/1.x/userGuide/index.html
For Struts 2 see: http://struts.apache.org/2.x/docs/home.html

Antonio

Attachment: user_185174.ezm (zipped)
HI,

I have been following this post with interest since I used the PRG pattern
in previous projects.
We are using struts 2 in are current project and I like the errorMessages
behaviour that is part of the Action.

Is it possible to persist these over the PRG cycle ?
By default I assume they would be lost when we get to the GET stage since
they are request scope and the GET is a seperate request than the POST
that caused the error.

Regards
Ian

CSC Solutions Norge AS
Registered Office: Sandsliåsen 57, 5254 Sandsli, Norway
Registered in Norway No: 958 958 455

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery.
NOTE: Regardless of content, this e-mail shall not operate to bind CSC to
any order or other contract unless pursuant to explicit written agreement
or government initiative expressly permitting the use of e-mail for such
purpose.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------




"Brad A Cupit" <brad@(protected)>
08.04.2008 17:16
Please respond to
"Struts Users Mailing List" <user@(protected)>


To
"Struts Users Mailing List" <user@(protected)>
cc

Subject
RE: interesting proxy + action chain issue






Oh thank you so much for the response. I've been reading about the
POST-redirect-GET pattern and I'm starting to see the light. I found the
original article here, in case anyone else is interested:

http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost

Brad Cupit
Louisiana State University - UIS


-----Original Message-----
From: Jeromy Evans [mailto:jeromy.evans@(protected)]
Sent: Monday, April 07, 2008 8:20 PM
To: Struts Users Mailing List
Subject: Re: interesting proxy + action chain issue

Brad A Cupit wrote:
> ServletActionRedirectResult worked when I used it instead of the
> ActionChainResult. This performs an extra round trip back to the
> browser, which isn't terrible unless I want to pass data from one
Action
> to another, and herein lies some concern.
> ...
>
> POSTS should each have their own Action (which may write the data to
the
> DB). This Action should only process the POST. Afterwards, it forwards
> (chains) to another Action, which sits in front of the view. If the
view
> needs data from the DB, it goes in the Action for that view (not the
> POST-handling Action). If the view doesn't need data, then the Action
is
> dumb and just forwards to the view.
>
>

The reason the post-redirect-get pattern is typically preferred over
your approach is for handling of the browser's back button.
By returning a redirect the browser is prevented from reposting
data/showing a warning if the user presses back.

Your approach is clearly more efficient as it removes a request-response

cycle, but unfortunately the repost issue usually supersedes that.

>
> Seems like a nice design, but Action chaining isn't recommended, and
> isn't working with CGLIB proxies :-(
>
>

The main argument for discouraging action chaining is simply to reduce
coupling between actions. I didn't realise Ognl was performing a copy.

I thought the next action was
simply pushed onto the stack above the previous action allowing you to
access the properties of the previous action. I guess I'm wrong.

You may have stumbled upon another reason to discourage use of chaining.




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)



Attachment: user_185188.ezm (zipped)
Ian Meikle wrote:
> HI,
>
> I have been following this post with interest since I used the PRG pattern
> in previous projects.
> We are using struts 2 in are current project and I like the errorMessages
> behaviour that is part of the Action.
>
> Is it possible to persist these over the PRG cycle ?
> By default I assume they would be lost when we get to the GET stage since
> they are request scope and the GET is a seperate request than the POST
> that caused the error.
>
>  

Hi Ian,
This is an issue that Struts2 needs to handle better. It can be done
but its not as straight-forward as it could be.

The scope interceptor [1] provides this feature. It allows you to
specify which properties should be bound to session or application scope
and injected into the action.
The scoped modeldriven interceptor is for modeldriven actions [2]. Both
are included in the default stack.

The scope plugin allows annotations to specify which properties persist
over a cycle. It's not bundled with struts but I have heard good
comments about it [4].

[1] http://cwiki.apache.org/WW/scope-interceptor.html
[2] http://cwiki.apache.org/WW/scoped-model-driven-interceptor.html
[3] http://cwiki.apache.org/S2PLUGINS/scope-plugin.html
[4] http://article.gmane.org/gmane.comp.jakarta.struts.devel/65052

Attachment: user_185177.ezm (zipped)
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

Attachment: user_185178.ezm (zipped)
--- Peter Theissen <peter.theissen@(protected):
> 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



Attachment: user_185179.ezm (zipped)
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



Attachment: user_185180.ezm (zipped)
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 <peter.theissen@(protected):
> 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@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_185185.ezm (zipped)
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 <peter.theissen@(protected):

> 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@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


Attachment: user_185181.ezm (zipped)
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.

Attachment: user_185182.ezm (zipped)
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
<krv4u@(protected):
> 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.

Attachment: user_185186.ezm (zipped)
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 <thechrispratt@(protected):
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@(protected)
For additional commands, e-mail: user-help@(protected)




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.

Attachment: user_185187.ezm (zipped)
--- Raghuveer Kumarakrishnan <krv4u@(protected):
> 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 <thechrispratt@(protected):
>  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@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
>
> 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.


Attachment: user_185184.ezm (zipped)

This is caused by missing dependencies.

Copy
commons-fileupload-1.1.1.jar
commons-io-1.1.jar
from the showcase war.

Recommended changes to the distribution
These two files should be included in the /lib directory update wiki
pages to explicitly mention dependencies.

Regards,
Peter McKeown
www.symmetric.com.au

Attachment: user_185190.ezm (zipped)
Hi All,

I am using file upload interceptor to upload a file. I am returning XML
response (using result type as "stream") to the caller in case of
success or failure. Its all fine, if everything works as expected.

When I try to upload a file which is bigger then the max allowed size,
the file upload interceptor returns "input" and the control does not
come to the execute method of my action class. In this case I can
redirect the result to some JSP, to some other action etc, but how do I
return a xml response with the error description and some error code.

Please help me out.

Regards,
Rajeev Sharma


Attachment: user_185195.ezm (zipped)
Rajeev Sharma wrote:
>
> When I try to upload a file which is bigger then the max allowed size,
> the file upload interceptor returns "input" and the control does not
> come to the execute method of my action class. In this case I can
> redirect the result to some JSP, to some other action etc, but how do I
> return a xml response with the error description and some error code.
>
>  
Hi Rajeev,

It sounds like you just want an action to return an XML result (for an
"input" result).
A very simple way to do that is return a JSP with contentType="text/xml".

in struts.xml:
<result name="input">failed.jsp</result>
in the failed.jsp:

<%@(protected)" %>
<?xml version="1.0" encoding="ISO-8859-1"?>
<message>Too big!</message>


You can use properties in your XML as you would with a JSP result.

There's also an XSLT result type available or you could use a Bean->XML
serializer like XStream.

Hope that helps,
Jeromy Evans


Attachment: user_185191.ezm (zipped)

Hi,

I use the Struts 2  tag to generate my URLs.
For example to generate the URL /account/view.action, I do:

<s:url id="viewURL" namespace="account" action="view" />
<s:a href=%{viewURL}> View Your Account </s:a>

But each click on this URL inserts an extra "namespace" prefix into the
generated URL.
I mean, after clicking 5 times on the "View Your Account" link, my address
bar reads:

http://localhost/mysite/account/account/account/account/account/view.action

This still takes me to the correct page, but...

What am I missing?

Thanks,
Ancat.
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_185192.ezm (zipped)
hi

try it

<s:url id="viewURL" namespace="/account" action="view" />
<s:a href=%{viewURL}> View Your Account </s:a>

My english is not good
hope this can help you

gordian

On Wed, Apr 9, 2008 at 6:00 PM, ancatdubher <ancatdubher@(protected):

>
> Hi,
>
> I use the Struts 2  tag to generate my URLs.
> For example to generate the URL /account/view.action, I do:
>
> <s:url id="viewURL" namespace="account" action="view" />
> <s:a href=%{viewURL}> View Your Account </s:a>
>
> But each click on this URL inserts an extra "namespace" prefix into the
> generated URL.
> I mean, after clicking 5 times on the "View Your Account" link, my address
> bar reads:
>
>
> http://localhost/mysite/account/account/account/account/account/view.action
>
> This still takes me to the correct page, but...
>
> What am I missing?
>
> Thanks,
> Ancat.
> --
> View this message in context:
> http://www.nabble.com/Struts-2-%3Cs%3Aa%3E-URL-tag-problems-tp16583543p16583543.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_185193.ezm (zipped)

hi...

     i am using <html:radio> tag lib in struts 1.3.5, I am in a
requirement that we need to give the names of the html form components
dynamically...(ie)

      if i say <html:radio name="feedbackForm" property="ratting"
indexed="true" value="1" />
            <html:radio name="feedbackForm" property="ratting"
indexed="true" value="2" />
      above code goes inside an interation....

     the html outputs as

        <!--<input type="radio" name="feedbackForm[0].ratting"
value="1"/>--!>
        <!--<input type="radio" name="feedbackForm[0].ratting"
value="2"/>--!>
where the names of the html form components are the indexed property of the
feedbackForm where us i need set some other name say... overalrating for
both the components....

is there any way to achive so...?

thanks in advance...
Balaji.M


--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_185196.ezm (zipped)

This line:

<s:if test="${marca.claseDeMarca != null}">

should read:

<s:if test="%{marca.claseDeMarca != null}">


The first from instructs the container to evaluate the expression as EL.
The second form instructs the tag to evaluate the expression as OGNL.

You must be using struts < 2.0.10 as the first form is no longer
permitted within struts tags.
Assuming your deployments are identical, the only reason the first form
could yield a different result is if the containers are different in
their evaluation of the EL.

De Landa Gil Agustin wrote:
> Hello I have a very strange problem.
>
> I have an application that we developed in JAVA and the application works ok in Windows.
>
> We recentl deployed the same application in Linux REDHAT and the application seemed to worked fine, until the user reported to us a problem.
>
> After doing research it happens that in Linux RedHat instructions like this:
>
> <s:if test="${marca.claseDeMarca != null}">
>
> All of our jsp pages do not work at all, while in Windows they work ok. Looks like a Struts problem to us.
>
> This makes the appplication in linux to work incorrectly as the test always evaluates to FALSE and in windows the test evaluates to TRUE.
>
> We use Oracle Database and the tomcat version we have is JAKARTA-TOMCAT-5.0.28
>
> Any help will be appreciated.
>
> Agustin.
>
>
> Agustín de Landa Gil
>
> Grupo Industrial Saltillo
>
> Tel: (844) 411-7114 Ext. 7114
>
> Fax: (844) 411 7105
>
> agustin.delanda@gis.com.mx<mailto:agustin.delanda@(protected)>
>
> ==================================================
>
> NOTICE: This e-mail transmission, and any other documents, like files or previous-mail messages attached to it, may contain confidential or privileged information. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this message is STRICTLY PROHIBITED. If you have received this transmission in error, please immediately notify the sender, permanently delete it and destroy any copies of it that were printed out. Grupo Industrial Saltillo is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. Thank you.
>
> Visit us at www.gis.com.mx<file:///C:\Documents%20and%20Settings\agustin.delanda\Datos%20de%20programa\Microsoft\Signatures\www.gis.com.mx> <http://www.gis.com.mx/>
>
> AVISO: Este correo electrónico, y cualquier otro documento, como archivos o mensajes previos adjuntos, pueden contener información de tipo privilegiada y/o confidencial. Si usted no es el destinatario, o la persona responsable para entregarlo al destinatario, se le notifica que cualquier revelación, copiado, distribución o uso de cualquier información contenida o adjunta a este mensaje esta ESTRICTAMENTE PROHIBIDA. Si usted recibió este correo electrónico por error, por favor, notifique inmediatamente al remitente, elimínelo permanentemente y destruya cualquier copia que haya sido impresa. Grupo Industrial Saltillo no es responsable por la correcta transmision de la informacion contenida en este medio, o de cualquier retraso del mismo con respecto a la entrega al destinatario. Gracias.
>
> Visite nuestra página en www.gis.com.mx<file:///C:\Documents%20and%20Settings\agustin.delanda\Datos%20de%20programa\Microsoft\Signatures\www.gis.com.mx> <http://www.gis.com.mx/> ==================================================
>
>
>
>
>  
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG.
> Version: 7.5.519 / Virus Database: 269.22.9/1364 - Release Date: 7/04/2008 6:38 PM
>  

©2008 gg3721.com - Jax Systems, LLC, U.S.A.