Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 26 Jun 2008 18:40:05 -0000 Issue 8113

user-digest-help

2008-06-26


Author LoginPost Reply

user Digest 26 Jun 2008 18:40:05 -0000 Issue 8113

Topics (messages 188184 through 188209):

Re: [s2] Whats the most strutsy way of doing....
 188184 by: Al Sutton
 188185 by: Musachy Barroso
 188186 by: Lukasz Lenart
 188187 by: Dave Newton
 188188 by: Al Sutton
 188189 by: Al Sutton
 188190 by: Al Sutton

Re: [struts] Slow performance with Struts2
 188191 by: yorlick kilroy
 188192 by: Al Sutton

Re: Something like getCurrentAction(...)
 188193 by: Jan Froehlich
 188194 by: Musachy Barroso
 188195 by: Jan Froehlich
 188196 by: Jan Froehlich

Help with Combobox
 188197 by: Juan Pablo Pizarro
 188198 by: Dave Newton
 188199 by: Juan Pablo Pizarro
 188200 by: Lukasz Lenart
 188202 by: Juan Pablo Pizarro

Re: Struts Validator Framework: problem with Custom Validator
 188201 by: cacodemon79

Strange problem with content disposition
 188203 by: Paranoid_Fabio

How to read data from nested list elements
 188204 by: Reddy, Ramachandra (IS Consultant)

ClassNotFoundException: org.apache.struts.action.ActionServlet
 188205 by: xeonyk

Re: Struts 2 And Hibernate Problem
 188206 by: cree
 188207 by: Lukasz Lenart

Re: Struts Themes Problem - help
 188208 by: Laurie Harper

[S2] TypeConversion and generics
 188209 by: Pierre Thibaudeau

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_188184.ezm (zipped)
I was thinking more along the lines of encrypting the userId and
password hash using AES, store the value in the cookie, then if the
cookie is available during another session decrypt, check everything
matches, and let them back in.

That way it avoids trying to maintain sync between the user and the server.

Al.

Lukasz Lenart wrote:
> I think there isn't any solution in Struts2, so then, implement that
> with cookies and save such cookie also on the server side in db, you
> can also allow such thing for selected users, etc.
>
>
> Regards
>  


Attachment: user_188185.ezm (zipped)
Be aware of cookie stealing.

musachy

On Thu, Jun 26, 2008 at 10:32 AM, Al Sutton <al.sutton@(protected):
> I was thinking more along the lines of encrypting the userId and password
> hash using AES, store the value in the cookie, then if the cookie is
> available during another session decrypt, check everything matches, and let
> them back in.
>
> That way it avoids trying to maintain sync between the user and the server.
>
> Al.
>
> Lukasz Lenart wrote:
>>
>> I think there isn't any solution in Struts2, so then, implement that
>> with cookies and save such cookie also on the server side in db, you
>> can also allow such thing for selected users, etc.
>>
>>
>> Regards
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>



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

Attachment: user_188186.ezm (zipped)
Hi,

2008/6/26 Al Sutton <al.sutton@(protected)>:
> I was thinking more along the lines of encrypting the userId and password
> hash using AES, store the value in the cookie, then if the cookie is
> available during another session decrypt, check everything matches, and let
> them back in.

But you will have to store keys on the server side for future use,
maybe simple MD5 plus some arbittary text will be better?
http://java.sun.com/developer/technicalArticles/Security/AES/AES_v1.html


Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment: user_188187.ezm (zipped)
Personally I kinda liked my idea of a cookie interceptor that will inject type-converted cookie values into actions; we'll probably use something like that for our new projects.

Dave


--- On Thu, 6/26/08, Al Sutton <al.sutton@(protected):

> From: Al Sutton <al.sutton@(protected)>
> Subject: Re: [s2] Whats the most strutsy way of doing....
> To: "Struts Users Mailing List" <user@(protected)>
> Date: Thursday, June 26, 2008, 10:32 AM
> I was thinking more along the lines of encrypting the userId
> and
> password hash using AES, store the value in the cookie,
> then if the
> cookie is available during another session decrypt, check
> everything
> matches, and let them back in.
>
> That way it avoids trying to maintain sync between the user
> and the server.
>
> Al.
>
> Lukasz Lenart wrote:
> > I think there isn't any solution in Struts2, so
> then, implement that
> > with cookies and save such cookie also on the server
> side in db, you
> > can also allow such thing for selected users, etc.
> >
> >
> > Regards
> >  
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)

Attachment: user_188188.ezm (zipped)
It's going to be a problem with whatever method is used. Even if there
is a server side IP address record for each cookie you still have the
problem of cookies stoled and used at the same location :(.

Unless you have an idea you wish to share? :).

Al.


Musachy Barroso wrote:
> Be aware of cookie stealing.
>
> musachy
>
> On Thu, Jun 26, 2008 at 10:32 AM, Al Sutton <al.sutton@(protected):
>  
>> I was thinking more along the lines of encrypting the userId and password
>> hash using AES, store the value in the cookie, then if the cookie is
>> available during another session decrypt, check everything matches, and let
>> them back in.
>>
>> That way it avoids trying to maintain sync between the user and the server.
>>
>> Al.
>>
>> Lukasz Lenart wrote:
>>  
>>> I think there isn't any solution in Struts2, so then, implement that
>>> with cookies and save such cookie also on the server side in db, you
>>> can also allow such thing for selected users, etc.
>>>
>>>
>>> Regards
>>>
>>>    
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>  
>
>
>
>  


Attachment: user_188189.ezm (zipped)
The key(s) can be a single key per day/week/month. The date of the
cookie generation can be included and the relevant key looked up.

The problem with MD5 is it's one way so I'd have to have either a search
and match algorithm, or a database of MD5ed text to user mappings. With
AES I can extract the user ID and a check that the password hasn't
changed from the cookie itself by decrypting the cookie data.

Al.

Lukasz Lenart wrote:
> Hi,
>
> 2008/6/26 Al Sutton <al.sutton@(protected)>:
>  
>> I was thinking more along the lines of encrypting the userId and password
>> hash using AES, store the value in the cookie, then if the cookie is
>> available during another session decrypt, check everything matches, and let
>> them back in.
>>  
>
> But you will have to store keys on the server side for future use,
> maybe simple MD5 plus some arbittary text will be better?
> http://java.sun.com/developer/technicalArticles/Security/AES/AES_v1.html
>
>
> Regards
>  


Attachment: user_188190.ezm (zipped)
Dave,

I'm completely agree it's a great idea and useful thing to do, but the
problem is what to put into the cookie and how to map it to the user.

My current favourite is encrypt the properties you want to store (using
AES for speed and JCE support), then decrypt and inject when needed.
Cookies should be considered limited to 4K (due to the joys of RFC2109
Section 6.3), so as long as the data fits joy shall be mine :).

Al.

Dave Newton wrote:
> Personally I kinda liked my idea of a cookie interceptor that will inject type-converted cookie values into actions; we'll probably use something like that for our new projects.
>
> Dave
>
>
> --- On Thu, 6/26/08, Al Sutton <al.sutton@(protected):
>
>  
>> From: Al Sutton <al.sutton@(protected)>
>> Subject: Re: [s2] Whats the most strutsy way of doing....
>> To: "Struts Users Mailing List" <user@(protected)>
>> Date: Thursday, June 26, 2008, 10:32 AM
>> I was thinking more along the lines of encrypting the userId
>> and
>> password hash using AES, store the value in the cookie,
>> then if the
>> cookie is available during another session decrypt, check
>> everything
>> matches, and let them back in.
>>
>> That way it avoids trying to maintain sync between the user
>> and the server.
>>
>> Al.
>>
>> Lukasz Lenart wrote:
>>  
>>> I think there isn't any solution in Struts2, so
>>>    
>> then, implement that
>>  
>>> with cookies and save such cookie also on the server
>>>    
>> side in db, you
>>  
>>> can also allow such thing for selected users, etc.
>>>
>>>
>>> Regards
>>>  
>>>    
>> ---------------------------------------------------------------------
>> 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_188191.ezm (zipped)
I replaced OGNL 2.6.11 with the latest 2.7.2 Version.
I did a bit of benchmarking comparing the two and it absolutely surprised
me, that 2.7.2 in some cases is almost twice as slow as 2.6.11
The test scenario:
iterate a large java.util.List in a jsp. the List contains a pretty large
tree of objects. in the jsp I access a String property in the last node of
this object graph. OGNL 2.6.11 takes roughly 600 ms to complete, 2.7.2
roughly 1050 ms

From that I gather that OGNL wasn't designed for high performance when
processing large and complex object trees in jsps. I guess I'll have to go
back and do it like in the old Struts1 days: use shallow objects like in
ActionForms

On Wed, Jun 25, 2008 at 8:31 PM, Dale Newfield <Dale@(protected):

> yorlick kilroy wrote:
>
>> Still... the "problem" seems to be the OGNL implementation in struts2.
>>
>
> I'm guessing here, but maybe your issues are related to:
>
> http://jira.opensymphony.com/browse/OGNL-141
>
> Which has been pushed off in Xwork to 2.5:
>
> http://jira.opensymphony.com/browse/XW-631
>
> And which has been pushed off in Struts2 until at least 2.1.3:
>
> https://issues.apache.org/struts/browse/WW-2128
>
> You're welcome to update the version of ognl you're using in your own app
> (but remember to add javassist if so).
>
> <s:iterate ... >
>>   <s:property value="#object.a.b.c.name"/>
>>   <s:property value="#object.a.b.c.phone"/>
>> </s:iterate>
>>
>
> Theoretically this translates to a straight lookup for #object, then
> getA().getB().getC().getName()...
> If A, B, and C are just accessors, it should be fast. If they do much work
> to determine what to return, you're doing that work 2*N times (where N is
> the number of times through the loop) instead of just once...why would you
> put a long lookup like that in an iterator if it doesn't change with each
> iteration?
>
> -Dale
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_188192.ezm (zipped)
If your benchmark uses multiple threads throw in a freemarker upgrade to
2.3.13 and have another spin :).

One thing you might want to bear in mind is that if you're using a
persistance framework there maybe some back end fetching taking place
between a.b.c and a.b.c.d. Even though you write simple beans and
accessors you can't guarentee whats happening to your objects under the
covers.

Al.

yorlick kilroy wrote:
> I replaced OGNL 2.6.11 with the latest 2.7.2 Version.
> I did a bit of benchmarking comparing the two and it absolutely surprised
> me, that 2.7.2 in some cases is almost twice as slow as 2.6.11
> The test scenario:
> iterate a large java.util.List in a jsp. the List contains a pretty large
> tree of objects. in the jsp I access a String property in the last node of
> this object graph. OGNL 2.6.11 takes roughly 600 ms to complete, 2.7.2
> roughly 1050 ms
>
> From that I gather that OGNL wasn't designed for high performance when
> processing large and complex object trees in jsps. I guess I'll have to go
> back and do it like in the old Struts1 days: use shallow objects like in
> ActionForms
>
> On Wed, Jun 25, 2008 at 8:31 PM, Dale Newfield <Dale@(protected):
>
>  
>> yorlick kilroy wrote:
>>
>>  
>>> Still... the "problem" seems to be the OGNL implementation in struts2.
>>>
>>>    
>> I'm guessing here, but maybe your issues are related to:
>>
>> http://jira.opensymphony.com/browse/OGNL-141
>>
>> Which has been pushed off in Xwork to 2.5:
>>
>> http://jira.opensymphony.com/browse/XW-631
>>
>> And which has been pushed off in Struts2 until at least 2.1.3:
>>
>> https://issues.apache.org/struts/browse/WW-2128
>>
>> You're welcome to update the version of ognl you're using in your own app
>> (but remember to add javassist if so).
>>
>> <s:iterate ... >
>>  
>>>   <s:property value="#object.a.b.c.name"/>
>>>   <s:property value="#object.a.b.c.phone"/>
>>> </s:iterate>
>>>
>>>    
>> Theoretically this translates to a straight lookup for #object, then
>> getA().getB().getC().getName()...
>> If A, B, and C are just accessors, it should be fast. If they do much work
>> to determine what to return, you're doing that work 2*N times (where N is
>> the number of times through the loop) instead of just once...why would you
>> put a long lookup like that in an iterator if it doesn't change with each
>> iteration?
>>
>> -Dale
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>  
>
>  


Attachment: user_188193.ezm (zipped)
Can you give me a quick hint, how I can access what I need? Not sure
what I should search for....

Try this:

http://struts.apache.org/2.x/docs/how-do-we-access-the-action-invocation
-action-name-or-namespace-from-a-view.html

On Thu, Jun 26, 2008 at 10:15 AM, Jan Froehlich
<Jan.Froehlich@(protected):
> Something I forgot to tell....
>
> I already tried the way using the <s:property value="#action" /> but
as
> I use a default action for most of my calls its not a possibility...
>
>
>
> Hi all,
>
> As I am not sure if I can explain the whole context of my problem just
a
> short description of what I got and what I want:
> I got an Action extending ActionSupport where I added a
> getCurrentAction() method.
>
>     public String getCurrentAction() {
>           String sRequestURL =
> getRequest().getRequestURL().toString();
>           return
> sRequestURL.substring(sRequestURL.lastIndexOf('/') + 1,
> sRequestURL.length() - 1);
>     }
>
> The problem (with tiles I guess) is that I always get the url from my
> tiles master template and not from the action that was called.
> After I debugged the request object I found an array called
> "specialAttributes" where I found the action name.
>
> Is it possible to access those specialAttributes, or is there any
other
> way?
>
> Regards
> Jan
>
> ---------------------------------------------------------------------
> 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)
>
>



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

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


Attachment: user_188194.ezm (zipped)
That will return an object of this type:

http://struts.apache.org/2.0.11.1/struts2-core/apidocs/org/apache/struts2/dispatcher/mapper/ActionMapping.html

musachy

On Thu, Jun 26, 2008 at 11:21 AM, Jan Froehlich
<Jan.Froehlich@(protected):
> Can you give me a quick hint, how I can access what I need? Not sure
> what I should search for....
>
> Try this:
>
> http://struts.apache.org/2.x/docs/how-do-we-access-the-action-invocation
> -action-name-or-namespace-from-a-view.html
>
> On Thu, Jun 26, 2008 at 10:15 AM, Jan Froehlich
> <Jan.Froehlich@(protected):
>> Something I forgot to tell....
>>
>> I already tried the way using the <s:property value="#action" /> but
> as
>> I use a default action for most of my calls its not a possibility...
>>
>>
>>
>> Hi all,
>>
>> As I am not sure if I can explain the whole context of my problem just
> a
>> short description of what I got and what I want:
>> I got an Action extending ActionSupport where I added a
>> getCurrentAction() method.
>>
>>     public String getCurrentAction() {
>>           String sRequestURL =
>> getRequest().getRequestURL().toString();
>>           return
>> sRequestURL.substring(sRequestURL.lastIndexOf('/') + 1,
>> sRequestURL.length() - 1);
>>     }
>>
>> The problem (with tiles I guess) is that I always get the url from my
>> tiles master template and not from the action that was called.
>> After I debugged the request object I found an array called
>> "specialAttributes" where I found the action name.
>>
>> Is it possible to access those specialAttributes, or is there any
> other
>> way?
>>
>> Regards
>> Jan
>>
>> ---------------------------------------------------------------------
>> 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)
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> 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)
>
>



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

Attachment: user_188195.ezm (zipped)
Well, ok - found that already - but I got no Idea what method returns my
desired action.

That will return an object of this type:

http://struts.apache.org/2.0.11.1/struts2-core/apidocs/org/apache/struts
2/dispatcher/mapper/ActionMapping.html

musachy

On Thu, Jun 26, 2008 at 11:21 AM, Jan Froehlich
<Jan.Froehlich@(protected):
> Can you give me a quick hint, how I can access what I need? Not sure
> what I should search for....
>
> Try this:
>
>
http://struts.apache.org/2.x/docs/how-do-we-access-the-action-invocation
> -action-name-or-namespace-from-a-view.html
>
> On Thu, Jun 26, 2008 at 10:15 AM, Jan Froehlich
> <Jan.Froehlich@(protected):
>> Something I forgot to tell....
>>
>> I already tried the way using the <s:property value="#action" /> but
> as
>> I use a default action for most of my calls its not a possibility...
>>
>>
>>
>> Hi all,
>>
>> As I am not sure if I can explain the whole context of my problem
just
> a
>> short description of what I got and what I want:
>> I got an Action extending ActionSupport where I added a
>> getCurrentAction() method.
>>
>>     public String getCurrentAction() {
>>           String sRequestURL =
>> getRequest().getRequestURL().toString();
>>           return
>> sRequestURL.substring(sRequestURL.lastIndexOf('/') + 1,
>> sRequestURL.length() - 1);
>>     }
>>
>> The problem (with tiles I guess) is that I always get the url from my
>> tiles master template and not from the action that was called.
>> After I debugged the request object I found an array called
>> "specialAttributes" where I found the action name.
>>
>> Is it possible to access those specialAttributes, or is there any
> other
>> way?
>>
>> Regards
>> Jan
>>
>> ---------------------------------------------------------------------
>> 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)
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> 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)
>
>



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

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


Attachment: user_188196.ezm (zipped)
I'm sorry - found it......
Just ignore my last message!

That will return an object of this type:

http://struts.apache.org/2.0.11.1/struts2-core/apidocs/org/apache/struts
2/dispatcher/mapper/ActionMapping.html

musachy

On Thu, Jun 26, 2008 at 11:21 AM, Jan Froehlich
<Jan.Froehlich@(protected):
> Can you give me a quick hint, how I can access what I need? Not sure
> what I should search for....
>
> Try this:
>
>
http://struts.apache.org/2.x/docs/how-do-we-access-the-action-invocation
> -action-name-or-namespace-from-a-view.html
>
> On Thu, Jun 26, 2008 at 10:15 AM, Jan Froehlich
> <Jan.Froehlich@(protected):
>> Something I forgot to tell....
>>
>> I already tried the way using the <s:property value="#action" /> but
> as
>> I use a default action for most of my calls its not a possibility...
>>
>>
>>
>> Hi all,
>>
>> As I am not sure if I can explain the whole context of my problem
just
> a
>> short description of what I got and what I want:
>> I got an Action extending ActionSupport where I added a
>> getCurrentAction() method.
>>
>>     public String getCurrentAction() {
>>           String sRequestURL =
>> getRequest().getRequestURL().toString();
>>           return
>> sRequestURL.substring(sRequestURL.lastIndexOf('/') + 1,
>> sRequestURL.length() - 1);
>>     }
>>
>> The problem (with tiles I guess) is that I always get the url from my
>> tiles master template and not from the action that was called.
>> After I debugged the request object I found an array called
>> "specialAttributes" where I found the action name.
>>
>> Is it possible to access those specialAttributes, or is there any
> other
>> way?
>>
>> Regards
>> Jan
>>
>> ---------------------------------------------------------------------
>> 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)
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> 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)
>
>



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

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


Attachment: user_188197.ezm (zipped)
Hello, All.

I've a problem, I usa a combobox to show options in a page, but I need
keep the id and show the description.

I use Apache Tomcat 5.5 and Struts 2.0.11

My bean has:

 private String technology;
 private Collection<Technology> lstTechnology;

My page has:

    <s:combobox label="%{getText('technology')}" name="technology"
readonly="true" headerValue="--- Please Select ---" headerKey="1"
listKey="lstTechology" list="lstTechnology.{shortDesc}" />

Thanks!

JP

Attachment: user_188198.ezm (zipped)
Use listValue?

Dave


--- On Thu, 6/26/08, Juan Pablo Pizarro <juanpablo.pizarro@(protected):

> From: Juan Pablo Pizarro <juanpablo.pizarro@(protected)>
> Subject: Help with Combobox
> To: "Struts Users Mailing List" <user@(protected)>
> Date: Thursday, June 26, 2008, 11:40 AM
> Hello, All.
>
> I've a problem, I usa a combobox to show options in a
> page, but I need
> keep the id and show the description.
>
> I use Apache Tomcat 5.5 and Struts 2.0.11
>
> My bean has:
>
>  private String technology;
>  private Collection<Technology> lstTechnology;
>
> My page has:
>
>      <s:combobox
> label="%{getText('technology')}"
> name="technology"
> readonly="true" headerValue="--- Please
> Select ---" headerKey="1"
> listKey="lstTechology"
> list="lstTechnology.{shortDesc}" />
>
> Thanks!
>
> JP
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)

Attachment: user_188199.ezm (zipped)
Sorry, I use:

<s:combobox label="%{getText('technology')}"
       name="technology" readonly="true"
       headerValue="--- Please Select ---" headerKey="1"
list="lstTechnology.{shortDesc}"/>

JP

2008/6/26 Dave Newton <newton.dave@(protected)>:
> Use listValue?
>
> Dave
>
>
> --- On Thu, 6/26/08, Juan Pablo Pizarro <juanpablo.pizarro@(protected):
>
>> From: Juan Pablo Pizarro <juanpablo.pizarro@(protected)>
>> Subject: Help with Combobox
>> To: "Struts Users Mailing List" <user@(protected)>
>> Date: Thursday, June 26, 2008, 11:40 AM
>> Hello, All.
>>
>> I've a problem, I usa a combobox to show options in a
>> page, but I need
>> keep the id and show the description.
>>
>> I use Apache Tomcat 5.5 and Struts 2.0.11
>>
>> My bean has:
>>
>>     private String technology;
>>     private Collection<Technology> lstTechnology;
>>
>> My page has:
>>
>>      <s:combobox
>> label="%{getText('technology')}"
>> name="technology"
>> readonly="true" headerValue="--- Please
>> Select ---" headerKey="1"
>> listKey="lstTechology"
>> list="lstTechnology.{shortDesc}" />
>>
>> Thanks!
>>
>> JP
>>
>> ---------------------------------------------------------------------
>> 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_188200.ezm (zipped)
2008/6/26 Juan Pablo Pizarro <juanpablo.pizarro@(protected)>:
> Sorry, I use:
>
> <s:combobox label="%{getText('technology')}"
>                     name="technology" readonly="true"
>                     headerValue="--- Please Select ---" headerKey="1"
> list="lstTechnology.{shortDesc}"/>

It should be like this

list="lstTechnology"
listKey="technologyId" - this will be the value of technology
listValue="technologyLabel" - what will user see


Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment: user_188202.ezm (zipped)
Thanks!!

It works fine!

Regards.

2008/6/26 Lukasz Lenart <lukasz.lenart@(protected)>:
> 2008/6/26 Juan Pablo Pizarro <juanpablo.pizarro@(protected)>:
>> Sorry, I use:
>>
>> <s:combobox label="%{getText('technology')}"
>>                     name="technology" readonly="true"
>>                     headerValue="--- Please Select ---" headerKey="1"
>> list="lstTechnology.{shortDesc}"/>
>
> It should be like this
>
> list="lstTechnology"
> listKey="technologyId" - this will be the value of technology
> listValue="technologyLabel" - what will user see
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_188201.ezm (zipped)

No-reply? :(

However, I solved. Now all works well.

**********
SERVER-SIDE
**********
To avoid the deprecated method
Resources.getActionMessage(HttpServletRequest request, ValidatorAction va,
Field field)
I used
Resources.getActionMessage(Validator v, HttpServletRequest request,
ValidatorAction va, Field field)
in my custom validator java class.
I added "org.apache.commons.validator.Validator" to methodParams of the
"twofields" custom validator in validator-rules.xml.

**********
CLIENT-SIDE
**********
I changed
oTwoFields = new twofields();
with
eval('oTwoFields = new ' + form.name + '_twofields();');

<validator name="twofields"
     classname="it.sfidiamoci.validator.ValidatorPersonalizzati"
     method="validateTwoFields"
     methodParams="java.lang.Object,
           org.apache.commons.validator.Validator,
           org.apache.commons.validator.ValidatorAction,
           org.apache.commons.validator.Field,
           org.apache.struts.action.ActionMessages,
           javax.servlet.http.HttpServletRequest"
     depends="required"
     msg="errors.twofields">
  <javascript><![CDATA[
    function validateTwoFields(form) {
       var bValid = true;
       var focusField = null;
       var i = 0;
       var fields = new Array();
       eval('oTwoFields = new ' + form.name + '_twofields();');
       for (x in oTwoFields) {
          var field = form[oTwoFields[x][0]];
          var secondField = form[oTwoFields[x][2]("secondProperty")];
       
          if (field.type == 'text' ||
            field.type == 'textarea' ||
            field.type == 'select-one' ||
            field.type == 'radio' ||
            field.type == 'password') {
       
            var value;
            var secondValue;
            // get field's value
            if (field.type == "select-one") {
               var si = field.selectedIndex;
               value = field.options[si].value;
               secondValue = secondField.options[si].value;
            } else {
               value = field.value;
               secondValue = secondField.value;
            }
         
            if (value != secondValue) {
           
               if (i == 0) {
                  focusField = field;
               }
               fields[i++] = oTwoFields[x][1];
               bValid = false;
            }
          }
       }
       
       if (fields.length > 0) {
          focusField.focus();
          alert(fields.join('\n'));
       }
       
       return bValid;
    }]]></javascript>
</validator>

That's all.




cacodemon79 wrote:
>
> I'm using Struts 1.3.
> I'm trying to write a custom validator to check that 2 fields are
> identical.
>
> 1) I modified my validator-rules.xml by adding my own validator (called
> "uguale"):
> **************
> validator-rules.xml
> **************
> <validator name="uguale"
>      classname="it.sfidiamoci.validator.ValidatorPersonalizzati"
>      method="validateUguale"
>    
> methodParams="java.lang.Object,org.apache.commons.validator.ValidatorAction,org.apache.commons.validator.Field,org.apache.struts.action.ActionErrors,javax.servlet.http.HttpServletRequest"
>      depends="required"
>      msg="errors.uguale">
>      
> <javascript><![CDATA[
>      function validateUguale(form) {
>         var bValid = true;
>         var focusField = null;
>         var i = 0;
>         var fields = new Array();
>         oTwoFields = new twofields();
>         for (x in oTwoFields) {
>           var field = form[oTwoFields[x][0]];
>           var secondField =
> form[oTwoFields[x][2]("secondProperty")];
>        
>           if (field.type == 'text' ||
>              field.type == 'textarea' ||
>              field.type == 'select-one' ||
>              field.type == 'radio' ||
>              field.type == 'password') {
>        
>              var value;
>              var secondValue;
>              // get field's value
>              if (field.type == "select-one") {
>                 var si = field.selectedIndex;
>                 value = field.options[si].value;
>                 secondValue = secondField.options[si].value;
>              } else {
>                 value = field.value;
>                 secondValue = secondField.value;
>              }
>          
>              if (value != secondValue) {
>              
>                 if (i == 0) {
>                   focusField = field;
>                 }
>                 fields[i++] = oTwoFields[x][1];
>                 bValid = false;
>              }
>           }
>         }
>        
>         if (fields.length > 0) {
>           focusField.focus();
>           alert(fields.join('\n'));
>         }
>        
>         return bValid;
>      }]]></javascript>
>
> </validator>
>
> 2) I modified my validation.xml by adding the new validator (called
> "uguale"):
> **************
> validator-rules.xml
> **************
> <i<field property="password" depends="required,minlength,mask,uguale">
>        <arg position="0" key="errors.password" />
>        <arg position="1" name="minlength" key="${var:minlength}"
> resource="false" />
>        <msg name="mask" key="errors.mask.password" />
>        <msg name="uguale" key="errors.password.uguale" />
>        <var>
>          <var-name>minlength</var-name>
>          <var-value>8</var-value>
>        </var>
>        <var>
>          <var-name>mask</var-name>
>          <var-value>^[a-zA-Z0-9_.]*$</var-value>
>        </var>
>        <var>
>          <var-name>secondProperty</var-name>
>          <var-value>password2</var-value>
>        </var>
>      </field>
>
> 3) I added the key "errors.password.uguale" in
> ApplicationResources.properties
> ***********************
> ApplicationResources.properties
> ***********************
> errors.password.uguale=Le password inserite non sono uguali
>
> 4) I created the class "ValidatorPersonalizzati" to handle the custom
> validator "validateUguale":
> ********************
> ValidatorPersonalizzati.java
> ********************
> package it.sfidiamoci.validator;
>
> import javax.servlet.http.HttpServletRequest;
>
> import org.apache.commons.validator.Field;
> import org.apache.commons.validator.GenericValidator;
> import org.apache.commons.validator.ValidatorAction;
> import org.apache.commons.validator.util.ValidatorUtils;
> import org.apache.struts.action.ActionErrors;
> import org.apache.struts.validator.Resources;
>
>
> public class ValidatorPersonalizzati{
>  
>  public static boolean validateUguale(Object bean, ValidatorAction
> va,Field field, ActionErrors errors,HttpServletRequest request){
>    
>    String value =
> ValidatorUtils.getValueAsString(bean,field.getProperty());
> System.out.println("value="+value);
>    String sProperty2 = field.getVarValue("secondProperty");
>    String value2 = ValidatorUtils.getValueAsString(bean,sProperty2);
> System.out.println("value2="+value2);
>    if (!GenericValidator.isBlankOrNull(value)){
>      try{
>        if (!value.equals(value2)){
>          errors.add(field.getKey(),Resources.getActionMessage(request, va,
> field));
>          return false;
>        }
>      }
>      catch (Exception e){
>        errors.add(field.getKey(),Resources.getActionMessage(request, va,
> field));
>        return false;
>      }
>    }
>    
>    return true;
>
>  }  
> }
>
> 5) I have two fields ("password", "password2") to check in my jsp:
> ******
> test.jsp
> ******
> <tr>
>              <td class="col1"><bean:message
> key='registrazioneUtente.password.label'/></td>
>              <td><html:password property="password" styleId="password"
> maxlength="<%= passwordMaxLength %>" /></td>
>              <td><bean:message key='registrazioneUtente.password2.label'/></td>
>              <td><html:password property="password2" styleId="password2"
> maxlength="<%= passwordMaxLength %>" /></td>
>            </tr>
>
>
> When I submit the form in my jsp, standard validations (e.g. required,
> minlength, ...) of other fields are performed in the correct way.
> Instead, my own validation called "uguale" ("password==password2") doesn't
> work!
> On the client-side, I see a javascript warning in browser: "twofields is
> not defined" but no javascript alert.
> On the server-side, I get the following exception:
>
> value=cvcxvxvczczx
> value2=czzxcczxczczczcz
> 24-giu-2008 20.54.30 org.apache.commons.validator.ValidatorAction
> executeValidationMethod
> GRAVE: Unhandled exception thrown during validation: null
> java.lang.NullPointerException
>  at
> it.sfidiamoci.validator.ValidatorPersonalizzati.validateUguale(ValidatorPersonalizzati.java:30)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>  at java.lang.reflect.Method.invoke(Unknown Source)
>  at
> org.apache.commons.validator.ValidatorAction.executeValidationMethod(ValidatorAction.java:544)
>  at org.apache.commons.validator.Field.validateForRule(Field.java:796)
>  at org.apache.commons.validator.Field.validate(Field.java:876)
>  at org.apache.commons.validator.Form.validate(Form.java:288)
>  at org.apache.commons.validator.Validator.validate(Validator.java:351)
>  at
> org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java:116)
>  at
> org.apache.struts.chain.commands.servlet.ValidateActionForm.validate(ValidateActionForm.java:58)
>  at
> org.apache.struts.chain.commands.AbstractValidateActionForm.execute(AbstractValidateActionForm.java:120)
>  at
> org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
>  at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
>  at
> org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
>  at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
>  at
> org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
>  at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
>  at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>  at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>  at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
>  at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>  at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>  at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>  at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>  at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
>  at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>  at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>  at java.lang.Thread.run(Unknown Source)
>
> In the log I have left 2 System.out.println to be sure that "value" and
> "value2" variables had the correct value submitted through the form.
>
> Moreover, I'm not sure that
> Resources.getActionMessage(request, va, field)
> method in my custom validator class is correct. This method is deprecated
> and I don't know how to replace it.
>
> I can't understand where is the problem both on client-side and on
> server-side validation.
>
> Can you help me?
>
> Thanks in advance.
>

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


Attachment: user_188203.ezm (zipped)

Hello. I've a very strange problem using content disposition in stream
result:

<result name="success" type="stream">
      ${contentType}
     downloadStream
     filename=${fileName}
     1024
</result>

fileName is a field of my action class.
When filename contains no spaces, everything goes fine. But if filename is
something like "hello song.mp3"
the browser shows that the file is "hello". I'm sure that the filename is
correct in my action class because i logged it out.
Any idea????

thank u!

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


Attachment: user_188204.ezm (zipped)

Hi Folks,
I have particular requirement where I have nested elements and within that again some elements… So the nesting is up to 3 levels.

Top most element is   
ModulesList= it has N modules
 Module = it has N  Parts
Part= it has N Elements

Here is the class hieirarchy
Parent class that holds all modules.
public class FSModuleListForm extends ActionForm {

            private List mModuleList = new ArrayList();
      public List getModuleList() {return mModuleList;}
      public void setModuleList(List aModuleList) {mModuleList=aModuleList;}
     
public FSModuleForm getModule(int index)
      {
                  return (FSModuleForm) mModuleList.get(index);
      }

public void reset(ActionMapping aMapping, HttpServletRequest aRequest)
    {
        super.reset(aMapping, aRequest);
        moduleList = new ArrayList();
        for (int i=0; i < 25; i++)
        {
            mModuleList.add(i, new FSModuleForm());
        }
    }

}
==============================================
//Module Description
      public class FSModuleForm extends ActionForm
        {
            Public FSModuleForm()  
            {    
              moduleId = -1;
              moduleName=null;
              moduleType=null;
              moduleLabel=null;
              partsList = new ArrayList();

              //Lets initialize the list
              for (int i= 0 ; i < 10; i++ ){
                  partsList.add(i,new FSPartForm());
              }
            } 
            public FSPartForm getPart(int index) {
                  return (FSPartForm) partsList.get(index);
            }
            public void reset(ActionMapping aMapping, HttpServletRequest aRequest)
            {
                  partsList = new ArrayList();
                    //Lets initialize the list
                    for (int i= 0 ; i < 10; i++ ){
                        partsList.add(i,new FSPartForm());
                  }
            }
     
      }
==============================================

// PART Description
public class FSPartForm extends ActionForm {
     
     
      public FSPartForm()
       {
              partId=-1;
              sortOrder=0;
              partName=null;
              partLabel=null;
              partType=null;
              optionalFlag=null;
              partFootnote=null;
              elementList= new ArrayList();
            //Lets initialize the list
              for (int i= 0 ; i < 20; i++ ){
                  elementList.add(i,new FSElementForm());
              }
       }  

      public FSElementForm getElement(int index)
      {
           
                  return (FSElementForm) mElementList.get(index);
      }
      public void reset(ActionMapping aMapping, HttpServletRequest aRequest)
                  for (int i= 0 ; i < 50; i++ ){
                        elementList.add(i,new FSElementForm());
                    }
      }

}

==============================================
//Elemet Description.
public FSElementForm extends ActionForm {
 public FSElementForm()
      {
     
           elementId=-1;
           elementName=null;
           elementType=null;
           optionalFlag=null;
           defaultValue=null;
           sortOrder=0;
      }
     
}

Here is my JSP

      <logic:iterate id="module" name="FSModuleListForm" property="moduleList">
                        <tr>
                              <tr >  <!—Module info →
                                          <bean:write name="module" property="moduleName" /> <tr>
                                                Desc:<html:text name="module" property="moduleDesc"   indexed="true" />
                                                Label:<html:text name="module" property="moduleLabel"  indexed="true" />
                                    <html:hidden name="module" property="moduleId"        indexed="true" />
                              </tr>
                              <logic:present id="part" name="module" property="partsList">
                                    <logic:iterate id="part" name="module" property="partsList">
                                          <tr>
                                                <tr><bean:write name="part" property="partName" /></tr>
                                                <tr>Label:<html:text name="part" property="partLabel"    indexed="true" /></tr>
                                                <html:hidden name="part" property="partId" indexed="true" />
                                          </tr>
                                                <!—code to get each element will go here →
                                    </logic:iterate>
                              </logic:present>
                        </tr>
                        <hr>
                  </logic:iterate>


ISSUE:
1. Should I extend actionform for all classes or just the top most class is good (in my eg  FSModuleListForm) ?
2. I am able to display data on screen but when I submit only the module information gets populated
Not the parts associated to each module. Though indexing  value displayed looks good.
           
Html generated some what looks like
            InvestMent Objective1:
                        Desc:  <input type="text" name="module[0].moduleDesc" value="InvestMent Objective – first ">
                        Label:<input type="text" name="module[0].moduleLabel" value="InvestMent Objective First">
                        <input type="hidden" name="module[0].moduleId" value="1">
                                    This is Investment Objective1 Part NAME
                                                            Label:<input type="text" name="part[0].partLabel" value="This is Investment Objective1 Part Label">
                                                                        <input type="text" name="part[0].partId" value="1">

----------------------------------------------------------------------
            InvestMent Objective2:
                        Desc:  <input type="text" name="module[0].moduleDesc" value="InvestMent Objective – Second ">
                        Label:<input type="text" name="module[0].moduleLabel" value="InvestMent Objective second">
                        <input type="hidden" name="module[0].moduleId" value="2">
                                                This is Investment Objective2 Part NAME
                                                            Label:<input type="text" name="part[0].partLabel" value="This is Investment Objective2 Part Label">
                                                            <input type="text" name="part[0].partId" value="2">




Can some one please help me on this issue or is this not possible in Struts ?

Thanks in advance.







Warm Regards
Ramachandra Reddy



Attachment: user_188205.ezm (zipped)


i want to ask about error when i creating application with struts framework

the error is : ClassNotFoundException:
org.apache.struts.action.ActionServlet in my glassfish server console

i create web project and put struts framework form netbeans
i look in my library and it's already add struts 1.2.9 struts.jar inside
(WEB-INF/lib)
i'm using glassfish v.2

how can i solve this problem??

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


Attachment: user_188206.ezm (zipped)

So I have been doing some testing and it seems the the same two action
objects are persisting. So when I invoke the first action class the
ActionInvocation has on the stack (for lack of a better name)
PrepareTestAction@(protected)
get some other arbitrary action.

When I leave the page and come to it again the same class
PrepareTestAction@(protected).
This would explain why the list of persistent objects is still showing.
However in my other struts 2 environment where I am not using hibernate nor
spring there are new objects each time (PrepareTestAction@(protected)...).

I hope this sheds some light on what can be going wrong because I can still
not find the solution.

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


Attachment: user_188207.ezm (zipped)
Hi,

Are you using spring to instantiate your actions? If so, did you setup
to not use singletons?


Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment: user_188208.ezm (zipped)
To repeat my previous question:

>> How is it failing? Note that the 'simple' theme generates a lot less
>> markup, and doesn't generate everything the other themes do. Are I18N
>> resources failing to get resolved, or is the theme just not
generating the
>> things you were expecting to see?

With the simple theme, I would expect the s:label to work the same way,
but the s:textfield to generate no label (because the simple theme
doesn't do that). If that's what you're seeing, that's the correct
behaviour. If you are seeing something different, you need to describe
exactly what that is.

L.

Narayana S wrote:
> Hi laurie,
>
>       <s:form action="TestAction" method="post">
>      <s:label key="app.indexheader" />
>      <s:textfield name="cname" key="app.cname"/><br>
>
> This is part of the form i am creating, when the theme is default the label
> could get value app.indexheader from resource bundle and working fine, the
> text fields also could generate a label with the values given for app.cname,
> but when simple theme is given ( like <s:form action="TestAction"
> method="post" theme="simple"> ) the label is not rendered!!
>
> can you help me on solving this >?
>
>
> On Mon, Jun 23, 2008 at 11:18 PM, Laurie Harper <laurie@(protected):
>
>> Narayana S wrote:
>>
>>> Hi Dave,
>>>
>>>   thanks for your reply, but when i use simple theme, my application is
>>> not getting any values from resource bundle..
>>>
>> How is it failing? Note that the 'simple' theme generates a lot less
>> markup, and doesn't generate everything the other themes do. Are I18N
>> resources failing to get resolved, or is the theme just not generating the
>> things you were expecting to see?
>>
>> will this problem be solved by extending theme ?
>>> can you provide any best link to extend a theme if it is the solution... ?
>>>
>> See the Themes and Templates documentation:
>>
>> http://struts.apache.org/2.0.11.1/docs/themes-and-templates.html
>>
>> L.
>>
>>
>> On Sun, Jun 22, 2008 at 8:25 PM, Dave Newton <newton.dave@(protected)>
>>> wrote:
>>>
>>> --- On Sun, 6/22/08, Narayana S <narayanasgs1@(protected):
>>>>> The problem is here struts 2 is applying it's own styles to
>>>>> my page, i want to give my own styles instead of using struts
>>>>> default styles,
>>>>>
>>>> The easiest answer is to just supply your own CSS styles. You can also
>>>> extend an existing, or create your own, theme.
>>>>
>>>> Dave
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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_188209.ezm (zipped)
I am aware that, when applying request parameters to an action, Struts
cannot guess the actual type of parameters determined by a generic type
(because of erasure at compile time).

However, I am assuming that if a non-generic action class extends an
abstract generic one, it should be possible in the non-generic child to
force the type conversion explicitely. Isn't that the case? At the moment,
I seemingly cannot get Struts to realize that I did specify a type
conversion and I keeping getting the following exception (whether my forced
conversion is in place or not):
java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to
java.lang.Integer

Underneath are the relevant parts of my setup.
*What am I forgetting?* (For example, am I missing an interceptor
somewhere?)*
Can anyone suggest how to trace what's happening at the point when a
converter should be applied (and is clearly not)?
*

In web.xml, I specify the location of the action package:

  <filter>
    <filter-name>action2</filter-name>

<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    <init-param>
       <param-name>actionPackages</param-name>
       <param-value>com.mywebapp.actions2</param-value>
    </init-param>
  </filter>


In struts.xml, here's the bit about the concrete (non-generic) child:

  <package name="contrib" extends="struts-default" abstract="false"
namespace="/contrib" >
    <interceptors>
       <interceptor name="autoLogin"
class="com.mywebapp.interceptors.AutoLoginInterceptor" />
       <interceptor-stack name="contribStack">
          <interceptor-ref name="autoLogin"/>
          <interceptor-ref name="paramsPrepareParamsStack"/>
       </interceptor-stack>
    </interceptors>
    <default-interceptor-ref name="contribStack" />
    <action name="groupContrib" class="groupContribAction">
       <result>/struts2/groupContrib2.jsp</result>
    </action>
  </package>


The previous reference to "groupContribAction" is in fact a Spring bean:

  <bean id="groupContribAction"
class="com.mywebapp.actions2.GroupContribAction"
parent="abstractContribAction" scope="prototype">
    <property name="contrib" ref="groupContrib" />
    <property name="contribService" ref="groupContribService" />
  </bean>


Here is an excerpt of the concrete action class itself. Notice the
conversion annotations. (I also half-heartedly tried without annotations,
using instead GroupContribAction-conversion.properties.)

@Conversion
public class GroupContribAction extends ContribAction<Integer> {
  private Integer propertyId;

  @Override
  public Integer getPropertyId() { return propertyId; }

  @Override
  @TypeConversion(converter =
"com.mywebapp.converters.StringToIntegerConverter")
  public void setPropertyId(Integer propertyId) { this.propertyId =
propertyId; }
}


And finally, here is an excerpt of the abstract generic parent:

public abstract class ContribAction<K extends Serializable>
       extends ActionSupport implements ServletRequestAware, Preparable
{

  public abstract void setPropertyId(K propertyId);
  public abstract K getPropertyId();
}
©2008 gg3721.com - Jax Systems, LLC, U.S.A.