Inconsistency in Struts2 s:component parameters handling

2012-11-30 Thread Thim Anneessens

  
  
Hello,

We are using Struts 2.3.1.2 and have noticed a strange behavior in
component parameter handling:

We have a component that uses both an "id" parameter and a "title"
parameter. 

What is strange is that when we use s:component, the "title"
parameter value can either be specified using the "title" attribute
of s:component or a s:param. The "id" parameter value can only be
specified using the "id" attribute of s:component. Using the s:param
for "id" has no effect. 

There seems to be no pertinent explanation for this behavior in the
documentation and I was wondering if this behavior would evolve in
further versions. We are currently using s:param to specify our
numerous "title" parameters and hope that it will always be possible
in the future. 

Could anyone shed some light on this inconsistent behavior?

Best regards,
-- 
  
 Thim Anneessens 
  IT Department








  

   ictjob.be 
Tel: +32 2 725 73 00 
Terhulpsesteenweg, 6B 
B-1560 Hoeilaart
  
   ictjob.lu

Tel: +352 621 364 792 
12, rue Eugne Ruppert 
L-2453 Luxembourg
  
   jobtic.fr

Tel: +33 9 81 25 19 66 
19 rue Martel 
75010 Paris
  
   ticjob.es

Tel: +34 911 25 43 11 
Calle Santo Tom 4, 5B 
28004 Madrid
  
   ictjob.de

Tel: +49 711 91 41 07 32 
Humboldtstr. 32 
70771 Leinfelden-Echterdingen
  

  

  

  



Re: Struts2 String ThreadSafe?

2012-11-30 Thread J. Garcia
This is definitely wrong. You can mix data from two different concurrent
sessions!



On Thu, Nov 29, 2012 at 4:42 PM, Rohit Gupta ro...@simplify360.com wrote:

 So given the fact that my beans are not prototype, there is a chance that
 the same action class may be used for two consecutive requests.

 Regards,


 On 29/11/12 9:02 PM, Umesh Awasthi umeshawas...@gmail.com wrote:

 First and foremost for using spring with Struts2 make your action bean
 scope prototype
 and is not be ready for the weird issues
 
 Struts2 itself create a new request instance as well other objects
 associated with itself to make it thread safe.
 
 
 
 On Thu, Nov 29, 2012 at 8:59 PM, rohit ro...@in-rev.com wrote:
 
   Hi,
 We are using Struts2-Spring integration and all my action classes
  implement SessionAware, sample code to action class and their spring
  definition is given below,
   public class IRXxxxAction extends ActionSupport implements
 SessionAware {
  private Map session; public String execute() {//} public void
  setSession(Maplt;String, Objectgt; session) { this.session = session;
 } }
   Spring Configuration
   lt;bean name=userAction class=com.IRXxxxAction gt; lt;property
  name=adminDAO ref=adminDAO /gt; lt;/beangt; If I understand
  correctly, each auto-wired property will be a singleton, so if the
 above is
  true, is there anyway that the session map get shared between two
  simultaneous requests?
   Regards,
 
 
 
 
 
 
 
 
 --
 With Regards
 Umesh Awasthi
 http://www.travellingrants.com/




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




Re: Inconsistency in Struts2 s:component parameters handling

2012-11-30 Thread Thim Anneessens

  
  
Hi Martin,
  
  Thank you for your time but I am not sure that it answers my
  question. Here is some code to illustrate:
  
  This works:
  s:component template='HighlightPanel.jsp' id="newsletter-subscribe-box"
	s:param name="title"Welcome to our site/s:param
	
/s:component

  This does not work:
  s:component template='HighlightPanel.jsp'
	s:param name="title"Welcome to our site/s:param
	s:param name="id"newsletter-subscribe-box/s:param
...
/s:component

  The "id" parameter is not sent to the "HighlightPanel.jsp"
  component.
  
  In the s:component
documentation, there seems to be no distinction between the
  "title" parameter and the "id" parameter. Why this inconsistent
  behavior? Could this behavior change in future releases?
  
  Best regard,
  Thim Anneessens.
  
  
  On 11/30/2012 01:56 PM, Martin Gainty wrote:


  
  

  
s:url var="url" action="" class="code-quote">"Welcome"
  s:param name="request_locale"en/s:param
/s:url
s:a href="" class="code-quote">"%{url}"English/s:a
  

This param tag will 
  1)add the parameter
"?request_locale=en" to the Welcome Action URL,
and 
  2)store it under the name "url". 
  The a tag then injects the "url" reference into the
  hyperlink. This request_locale parameter will be picked up by
  the I18n
Interceptor, and change your Locale accordingly.

 Any
number of parameters can be added to the URI by adding more
param tags.
  
  the Struts doc explanationappears to be clear on the use of
  params to build out the parameter(s) list
  http://struts.apache.org/2.0.11.2/docs/using-tags.html
  
  so in your case titlewould berequest scoped
  id would not be request scope since every component would
  require an id
  
  does this conform to your understanding
  Martin
  __ 
  Verzicht und Vertraulichkeitanmerkung/Note de dni et de
  confidentialit
  
  Diese Nachricht ist vertraulich. Sollten Sie nicht der
  vorgesehene Empfaenger sein, so bitten wir hoeflich um eine
  Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer
  Kopie ist unzulaessig. Diese Nachricht dient lediglich dem
  Austausch von Informationen und entfaltet keine rechtliche
  Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
  E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
  

Ce message est confidentiel et peut tre privilgi. Si vous n'tes pas le destinataire prvu, nous te demandons avec bont que pour satisfaire informez l'expditeur. N'importe quelle diffusion non autorise ou la copie de ceci est interdite. Ce message sert  l'information seulement et n'aura pas n'importe quel effet lgalement obligatoire. tant donn que les email peuvent facilement tre sujets  la manipulation, nous ne pouvons accepter aucune responsabilit pour le contenu fourni.




  Date: Fri, 30 Nov 2012 10:56:47 +0100
  From: t.anneess...@ictjob.be
  To: user@struts.apache.org
  Subject: Inconsistency in Struts2 s:component parameters
  handling
  
  Hello,
  
  We are using Struts 2.3.1.2 and have noticed a strange
  behavior in component parameter handling:
  
  We have a component that uses both an "id" parameter and a
  "title" parameter. 
  
  What is strange is that when we use s:component, the "title"
  parameter value can either be specified using the "title"
  attribute of s:component or a s:param. The "id" parameter
  value can only be specified using the "id" attribute of
  s:component. Using the s:param for "id" has no effect. 
  
  There seems to be no pertinent explanation for this behavior
  in the documentation and I was wondering if this behavior
  would evolve in further versions. We are currently using
  s:param to specify our numerous "title" parameters and hope
  that it will always be possible in the future. 
  
  Could anyone shed some light on this inconsistent behavior?
  
  Best regards,
  -- 
  Thim
Anneessens 
IT Department 
   
  
   
  
  

  
 ictjob.be
  
  Tel: +32 2 725 73 00 
  Terhulpsesteenweg, 6B 
  B-1560 Hoeilaart 
 

Best way to add to ValueStack in an Interceptor

2012-11-30 Thread Eric Lentz
Inside of an interceptor, I'd like to add a value onto the the ValueStack.
What is the best way to do this?

I tried this:
invocation.getStack().set(myValueStackName, theValueIwantForThisName);

But that pushes that value to the top of the stack, pushing my action class
down which becomes problematic for values getting assigned to the action
class. For example, a JSP field with name=fooId and an action class with
a field of Long fooId. When I have the above code, fooId doesn't get
assigned. When I don't, it works as you would expect.

I guess my interceptor could be later in the stack of interceptors, after
the ParametersInterceptor, but that seems fragile. Some other developer
could come along and move it and now there are bugs. Plus, I'd prefer this
particular interceptor be at or near the beginning of the list of
interceptors.

So, how do I assign, but leave the action class at the top of the stack? I
could pop the action, add my value and then add the action back on, but is
there a better way?

- Eric


RE: Inconsistency in Struts2 s:component parameters handling

2012-11-30 Thread Martin Gainty

correct..ID is a required attribute of the component tag
title is a parameter scoped at request level which will be suffixed for the 
call to your Action e.g. YourAction?title='title'
since ID is already a required attribute for every component it would not make 
sense to *also add ID as the more generalised request parameter*(since ID is 
already specified as the required attribute for the component) Make cents?
Martin 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.

 Date: Fri, 30 Nov 2012 14:20:42 +0100
From: t.anneess...@ictjob.be
To: mgai...@hotmail.com; user@struts.apache.org; w.gha...@ictjob.be
Subject: Re: Inconsistency in Struts2 s:component parameters handling


  

  
  
Hi Martin,

  

  Thank you for your time but I am not sure that it answers my
  question. Here is some code to illustrate:

  

  This works:

  s:component template='HighlightPanel.jsp' id=newsletter-subscribe-box
s:param name=titleWelcome to our site/s:param

/s:component

  This does not work:

  s:component template='HighlightPanel.jsp'
s:param name=titleWelcome to our site/s:param
s:param name=idnewsletter-subscribe-box/s:param
...
/s:component

  The id parameter is not sent to the HighlightPanel.jsp
  component.

  

  In the s:component
documentation, there seems to be no distinction between the
  title parameter and the id parameter. Why this inconsistent
  behavior? Could this behavior change in future releases?

  

  Best regard,

  Thim Anneessens.

  

  

  On 11/30/2012 01:56 PM, Martin Gainty wrote:



  
  

  
s:url var=url action=Welcome
  s:param name=request_localeen/s:param
/s:url
s:a href=%{url}English/s:a
  

This param tag will 

  1)add the parameter
?request_locale=en to the Welcome Action URL,
and 

  2)store it under the name url. 

  The a tag then injects the url reference into the
  hyperlink. This request_locale parameter will be picked up by
  the I18n
Interceptor, and change your Locale accordingly.


 Any
number of parameters can be added to the URI by adding more
param tags.

  

  the Struts doc explanation appears to be clear on the use of
  params to build out the parameter(s)  list

  http://struts.apache.org/2.0.11.2/docs/using-tags.html

   

  so in your case title would be request scoped

  id would not be request scope since every component would
  require an id

   

  does this conform to your understanding

  Martin

  __ 

  Verzicht und Vertraulichkeitanmerkung/Note de déni et de
  confidentialité

  

  Diese Nachricht ist vertraulich. Sollten Sie nicht der
  vorgesehene Empfaenger sein, so bitten wir hoeflich um eine
  Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer
  Kopie ist unzulaessig. Diese Nachricht dient lediglich dem
  Austausch von Informationen und entfaltet keine rechtliche
  Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
  E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

  


Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas 
le destinataire prévu, nous te demandons avec bonté que pour satisfaire 
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de 
ceci est interdite. Ce message sert à l'information seulement et n'aura pas 
n'importe quel effet légalement obligatoire. Étant donné que les email peuvent 
facilement être sujets à la manipulation, nous ne pouvons accepter aucune 
responsabilité pour le contenu fourni.




 

Re: Best way to add to ValueStack in an Interceptor

2012-11-30 Thread Maurizio Cucchiara
Did you try to put the value in the context?

invocation.getStack().getContext().put(myValueStackName,
 theValueIwantForThisName);


Twitter :http://www.twitter.com/m_cucchiara
G+  :https://plus.google.com/107903711540963855921
Linkedin:http://www.linkedin.com/in/mauriziocucchiara
VisualizeMe: http://vizualize.me/maurizio.cucchiara?r=maurizio.cucchiara

Maurizio Cucchiara


On 30 November 2012 14:42, Eric Lentz ericle...@outfastsource.com wrote:

 Inside of an interceptor, I'd like to add a value onto the the ValueStack.
 What is the best way to do this?

 I tried this:
 invocation.getStack().set(myValueStackName, theValueIwantForThisName);

 But that pushes that value to the top of the stack, pushing my action class
 down which becomes problematic for values getting assigned to the action
 class. For example, a JSP field with name=fooId and an action class with
 a field of Long fooId. When I have the above code, fooId doesn't get
 assigned. When I don't, it works as you would expect.

 I guess my interceptor could be later in the stack of interceptors, after
 the ParametersInterceptor, but that seems fragile. Some other developer
 could come along and move it and now there are bugs. Plus, I'd prefer this
 particular interceptor be at or near the beginning of the list of
 interceptors.

 So, how do I assign, but leave the action class at the top of the stack? I
 could pop the action, add my value and then add the action back on, but is
 there a better way?

 - Eric



Re: Inconsistency in Struts2 s:component parameters handling

2012-11-30 Thread Thim Anneessens

  
  
Dear Martin,
  
  According to struts
documentation: "id" is not required. However it
  seems that even if I do not specify a value for "id", Struts will
  assign an empty String value to it, which would prove what you are
  saying. Maybe the documentation should be adapted to indicate that
  id is required and that it has a default value which is an empty
  string.
  
  I note that if a parameter value is specified using both an
  attribute and the param tag, the attribute value will be used.
  This would explain the behavior we are observing for "id". 
  Assuming all this is right, I do not think that it should
influence the way to use s:component. IMO, the fact that a
default value is assigned to a parameter should not impact the
way we can specify/override the parameter value.
  
  Given all these facts, is it reasonable to assume that this
behavior will not change in future Struts releases?
  
  Thanks again for your time Martin.
  
  Best regards,
Thim.
  
  On 11/30/2012 03:42 PM, Martin Gainty wrote:


  
  
correct..
ID isa requiredattribute of the component tag
title is a parameter scoped at request level which will
besuffixedfor thecall toyourAction e.g.
YourAction?title='title'

since ID is already arequired attribute for every component it
would not make sense to *alsoaddID as themore
generalisedrequest parameter*
(since ID is already specified as the required attribute for the
component)

Make cents?
Martin 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de dni et de
confidentialit

Diese Nachricht ist vertraulich. Sollten Sie nicht der
vorgesehene Empfaenger sein, so bitten wir hoeflich um eine
Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer
Kopie ist unzulaessig. Diese Nachricht dient lediglich dem
Austausch von Informationen und entfaltet keine rechtliche
Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut tre privilgi. Si vous n'tes pas le destinataire prvu, nous te demandons avec bont que pour satisfaire informez l'expditeur. N'importe quelle diffusion non autorise ou la copie de ceci est interdite. Ce message sert  l'information seulement et n'aura pas n'importe quel effet lgalement obligatoire. tant donn que les email peuvent facilement tre sujets  la manipulation, nous ne pouvons accepter aucune responsabilit pour le contenu fourni.




  Date: Fri, 30 Nov 2012 14:20:42 +0100
  From: t.anneess...@ictjob.be
  To: mgai...@hotmail.com; user@struts.apache.org;
  w.gha...@ictjob.be
  Subject: Re: Inconsistency in Struts2 s:component parameters
  handling
  
  Hi Martin,

Thank you for your time but I am not sure that it answers my
question. Here is some code to illustrate:

This works:
s:component template='HighlightPanel.jsp' id="newsletter-subscribe-box"
	s:param name="title"Welcome to our site/s:param
	
/s:component

This does not work:
s:component template='HighlightPanel.jsp'
	s:param name="title"Welcome to our site/s:param
	s:param name="id"newsletter-subscribe-box/s:param
...
/s:component

The "id" parameter is not sent to the "HighlightPanel.jsp"
component.

In the s:component documentation, there seems
to be no distinction between the "title" parameter and the
"id" parameter. Why this inconsistent behavior? Could this
behavior change in future releases?

Best regard,
Thim Anneessens.


On 11/30/2012 01:56 PM, Martin Gainty wrote:
  
  


  

  s:url var="url" action="" class="ecxcode-quote">"Welcome"
  s:param name="request_locale"en/s:param
/s:url
s:a href="" class="ecxcode-quote">"%{url}"English/s:a

  
  This param tag will 
  1)add the parameter
"?request_locale=en" to the Welcome Action
URL, and 
  2)store it under the name "url". 
  The a tag then injects the "url" reference into
  the hyperlink. This request_locale parameter will be
  picked up by the I18n Interceptor, and change your
  Locale accordingly.
  
  
Any number of parameters 

RE: Inconsistency in Struts2 s:component parameters handling

2012-11-30 Thread Martin Gainty

ok so your take is i want to reference a HTML component to uniquely identify a 
component in lieu of idso we're on the same page the HTML spec says The id 
attribute assigns a unique 
identifier to an element (which may be verified by an SGML parser). 
For example, the following paragraphs are distinguished by their id values: 
P id=myparagraph This is a uniquely named paragraph./P
P id=yourparagraph This is also a uniquely named paragraph./P

The id attribute has several roles in 
HTML:

As a style sheet selector. 
As a target anchor for hypertext links. 
As a means to reference a particular element from a script. 
As the name of a declared OBJECT element. 
For general purpose processing by user agents (e.g. for identifying fields 
when extracting data from HTML pages into a database, translating HTML 
documents 
into other formats, etc.).  Unique quality of id attributehow else can the 
User-Agent Browser uniquely refer to a element in a document if you do not have 
an id...
Suitable alternatives to replace unique idHow would an optional request 
parameter (such as title) be used to uniquely reference a component (instead of 
referring to unique identifier attribute)
http://www.w3.org/TR/html401/struct/global.html#h-7.5.2
Martin Gainty 
__ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und 
Vertraulichkeitanmerkung/Note de déni et de confidentialité
 Ez az
üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.

 Date: Fri, 30 Nov 2012 17:36:19 +0100
From: t.anneess...@ictjob.be
To: user@struts.apache.org
CC: mgai...@hotmail.com; w.gha...@ictjob.be
Subject: Re: Inconsistency in Struts2 s:component parameters handling


  

  
  
Dear Martin,

  

  According to struts
documentation: id is not required. However it
  seems that even if I do not specify a value for id, Struts will
  assign an empty String value to it, which would prove what you are
  saying. Maybe the documentation should be adapted to indicate that
  id is required and that it has a default value which is an empty
  string.

  

  I note that if a parameter value is specified using both an
  attribute and the param tag, the attribute value will be used.
  This would explain the behavior we are observing for id. 

  Assuming all this is right, I do not think that it should
influence the way to use s:component. IMO, the fact that a
default value is assigned to a parameter should not impact the
way we can specify/override the parameter value.

  
  Given all these facts, is it reasonable to assume that this
behavior will not change in future Struts releases?

  
  Thanks again for your time Martin.

  
  Best regards,

Thim.

  
  On 11/30/2012 03:42 PM, Martin Gainty wrote:



  
  
correct..

ID is a required attribute of the component tag

title is a parameter scoped at request level which will
be suffixed for the call to your Action e.g.
YourAction?title='title'



since ID is already a required attribute for every component it
would not make sense to *also add ID as the more
generalised request parameter*

(since ID is already specified as the required attribute for the
component)

 

Make cents?

Martin 

__ 

Verzicht und Vertraulichkeitanmerkung/Note de déni et de
confidentialité



Diese Nachricht ist vertraulich. Sollten Sie nicht der
vorgesehene Empfaenger sein, so bitten wir hoeflich um eine
Mitteilung. 

Re: Struts2 Rest Plugin

2012-11-30 Thread Lukasz Lenart
2012/11/28 Davis, Chad chad.da...@emc.com:
 The docs for the REST plugin talk about how it builds on the Convention 
 plugin ( sometimes it says code behind ).  However, I don't see that using 
 the REST plugin pulls in either of these plugins . . . in what sense does it 
 build on them?

I think, the basic idea was to allow cooperate the REST plugin with
the Convention plugin and code behind is a deprecated plugin that will
be discarded soon (with 3.x)


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Re: Best way to add to ValueStack in an Interceptor

2012-11-30 Thread Lukasz Lenart
2012/11/30 Eric Lentz ericle...@outfastsource.com:
 Inside of an interceptor, I'd like to add a value onto the the ValueStack.
 What is the best way to do this?

 I tried this:
 invocation.getStack().set(myValueStackName, theValueIwantForThisName);

 But that pushes that value to the top of the stack, pushing my action class
 down which becomes problematic for values getting assigned to the action
 class. For example, a JSP field with name=fooId and an action class with
 a field of Long fooId. When I have the above code, fooId doesn't get
 assigned. When I don't, it works as you would expect.

use stack.pop() and stack.push()

 I guess my interceptor could be later in the stack of interceptors, after
 the ParametersInterceptor, but that seems fragile. Some other developer
 could come along and move it and now there are bugs. Plus, I'd prefer this
 particular interceptor be at or near the beginning of the list of
 interceptors.

 So, how do I assign, but leave the action class at the top of the stack? I
 could pop the action, add my value and then add the action back on, but is
 there a better way?

No, this is the preferred way. And please keep in mind the stack will
be searched from top to down for given value name.


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Re: Best way to add to ValueStack in an Interceptor

2012-11-30 Thread Eric Lentz
Maurizio, tried your way and no joy. Looks like I'll go with Łukasz' way.

Thanks everyone for your consideration and help!

On Fri, Nov 30, 2012 at 1:31 PM, Lukasz Lenart lukaszlen...@apache.orgwrote:

 2012/11/30 Eric Lentz ericle...@outfastsource.com:
  Inside of an interceptor, I'd like to add a value onto the the
 ValueStack.
  What is the best way to do this?
 
  I tried this:
  invocation.getStack().set(myValueStackName, theValueIwantForThisName);
 
  But that pushes that value to the top of the stack, pushing my action
 class
  down which becomes problematic for values getting assigned to the action
  class. For example, a JSP field with name=fooId and an action class
 with
  a field of Long fooId. When I have the above code, fooId doesn't get
  assigned. When I don't, it works as you would expect.

 use stack.pop() and stack.push()

  I guess my interceptor could be later in the stack of interceptors, after
  the ParametersInterceptor, but that seems fragile. Some other developer
  could come along and move it and now there are bugs. Plus, I'd prefer
 this
  particular interceptor be at or near the beginning of the list of
  interceptors.
 
  So, how do I assign, but leave the action class at the top of the stack?
 I
  could pop the action, add my value and then add the action back on, but
 is
  there a better way?

 No, this is the preferred way. And please keep in mind the stack will
 be searched from top to down for given value name.


 Regards
 --
 Łukasz
 + 48 606 323 122 http://www.lenart.org.pl/

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




Re: Best way to add to ValueStack in an Interceptor

2012-11-30 Thread Chris Pratt
Remember, when you use Maurizio's way, you have to reference the values as
context, not stack variables. So instead of using %{myvar} you have to use
%{#myvar).
  (*Chris*)


On Fri, Nov 30, 2012 at 10:42 AM, Eric Lentz ericle...@outfastsource.comwrote:

 Maurizio, tried your way and no joy. Looks like I'll go with Łukasz' way.

 Thanks everyone for your consideration and help!

 On Fri, Nov 30, 2012 at 1:31 PM, Lukasz Lenart lukaszlen...@apache.org
 wrote:

  2012/11/30 Eric Lentz ericle...@outfastsource.com:
   Inside of an interceptor, I'd like to add a value onto the the
  ValueStack.
   What is the best way to do this?
  
   I tried this:
   invocation.getStack().set(myValueStackName,
 theValueIwantForThisName);
  
   But that pushes that value to the top of the stack, pushing my action
  class
   down which becomes problematic for values getting assigned to the
 action
   class. For example, a JSP field with name=fooId and an action class
  with
   a field of Long fooId. When I have the above code, fooId doesn't get
   assigned. When I don't, it works as you would expect.
 
  use stack.pop() and stack.push()
 
   I guess my interceptor could be later in the stack of interceptors,
 after
   the ParametersInterceptor, but that seems fragile. Some other developer
   could come along and move it and now there are bugs. Plus, I'd prefer
  this
   particular interceptor be at or near the beginning of the list of
   interceptors.
  
   So, how do I assign, but leave the action class at the top of the
 stack?
  I
   could pop the action, add my value and then add the action back on, but
  is
   there a better way?
 
  No, this is the preferred way. And please keep in mind the stack will
  be searched from top to down for given value name.
 
 
  Regards
  --
  Łukasz
  + 48 606 323 122 http://www.lenart.org.pl/
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 



wierd stack trace regarding parsing of struts.xml

2012-11-30 Thread Davis, Chad
So, when I restarted my struts2 app this afternoon I got complains about 
unable to load configuration. - [unknown location].  But, the location of my 
struts.xml - inside of the classes folder of the WAR - has not changes.  And, 
indeed, the file is there.   The stack trace is below.   For starters, I'm 
surprised to see sockets involved?

2012-11-30 20:45:28,357 WARN  [pool-2-thread-1]-ejb.Ejb3Configuration: 
hibernate.connection.autocommit = false break the EJB3 specification
2012-11-30 20:45:58,226 ERROR [pool-2-thread-1]-commons.CommonsLogger: 
Dispatcher initialization failed
Unable to load configuration. - [unknown location]
at 
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
at 
org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)
at 
org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:193)
at 
org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
at 
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
at 
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
at 
org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilterConfig.java:103)
at 
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)
at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: Unable to load 
file:/DTO/EMC/IMF/apache-tomcat/catalina_base/imf/WEB-INF/classes/struts.xml - 
[unknown location]
at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:954)
at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:163)
at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:130)
at 
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:209)
at 
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
... 17 more
Caused by: Connection timed out - [unknown location]
at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)
at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:949)
... 21 more
Caused by: java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.init(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown 
Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown 
Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown 
Source)
at 
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown
 Source)
at 
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(Unknown 
Source)
at 
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(Unknown 
Source)
at 
com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(Unknown
 Source)
at 
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(Unknown
 Source)
 

RE: Struts2 Rest Plugin

2012-11-30 Thread Davis, Chad

 I think, the basic idea was to allow cooperate the REST plugin with the
 Convention plugin and code behind is a deprecated plugin that will be
 discarded soon (with 3.x)

1) So, it doesn't depend on it, in any technical sense?

2) But it's made to work with the convention plugin, if that plugin is also 
installed?

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


Re: wierd stack trace regarding parsing of struts.xml

2012-11-30 Thread Dave Newton
Probably trying to go out to the web for a DTD/XSD or something?

On Fri, Nov 30, 2012 at 3:06 PM, Davis, Chad chad.da...@emc.com wrote:
 So, when I restarted my struts2 app this afternoon I got complains about 
 unable to load configuration. - [unknown location].  But, the location of 
 my struts.xml - inside of the classes folder of the WAR - has not changes.  
 And, indeed, the file is there.   The stack trace is below.   For starters, 
 I'm surprised to see sockets involved?

 2012-11-30 20:45:28,357 WARN  [pool-2-thread-1]-ejb.Ejb3Configuration: 
 hibernate.connection.autocommit = false break the EJB3 specification
 2012-11-30 20:45:58,226 ERROR [pool-2-thread-1]-commons.CommonsLogger: 
 Dispatcher initialization failed
 Unable to load configuration. - [unknown location]
 at 
 com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
 at 
 org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)
 at 
 org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:193)
 at 
 org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
 at 
 org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
 at 
 org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
 at 
 org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilterConfig.java:103)
 at 
 org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)
 at 
 org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)
 at 
 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at 
 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
 at 
 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
 at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
 at java.util.concurrent.FutureTask.run(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)
 Caused by: Unable to load 
 file:/DTO/EMC/IMF/apache-tomcat/catalina_base/imf/WEB-INF/classes/struts.xml 
 - [unknown location]
 at 
 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:954)
 at 
 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:163)
 at 
 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:130)
 at 
 com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:209)
 at 
 com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
 ... 17 more
 Caused by: Connection timed out - [unknown location]
 at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)
 at 
 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:949)
 ... 21 more
 Caused by: java.net.ConnectException: Connection timed out
 at java.net.PlainSocketImpl.socketConnect(Native Method)
 at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
 at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
 at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
 at java.net.SocksSocketImpl.connect(Unknown Source)
 at java.net.Socket.connect(Unknown Source)
 at java.net.Socket.connect(Unknown Source)
 at sun.net.NetworkClient.doConnect(Unknown Source)
 at sun.net.www.http.HttpClient.openServer(Unknown Source)
 at sun.net.www.http.HttpClient.openServer(Unknown Source)
 at sun.net.www.http.HttpClient.init(Unknown Source)
 at sun.net.www.http.HttpClient.New(Unknown Source)
 at sun.net.www.http.HttpClient.New(Unknown Source)
 at 
 sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
 at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown 
 Source)
 at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
 at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown 
 Source)
 at 
 com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown
  Source)
 at 
 com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(Unknown 
 Source)
 at 
 com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(Unknown
 

Re: Best way to add to ValueStack in an Interceptor

2012-11-30 Thread Eric Lentz
Good call Chris! I didn't realize that. The context solution Maurizio
offered now works for me. Pros/cons to both
approaches. The context approach could be confusing to the uninitiated on
the UI side. Pop/push could be confusing or mysterious at the interceptor
level (again, for the casual Struts coder). The context solution will be
the quickest for me (already done), so I guess that's the winner of the
coin toss.

Thanks again everyone!


On Fri, Nov 30, 2012 at 2:15 PM, Chris Pratt thechrispr...@gmail.comwrote:

 Remember, when you use Maurizio's way, you have to reference the values as
 context, not stack variables. So instead of using %{myvar} you have to use
 %{#myvar).
   (*Chris*)


 On Fri, Nov 30, 2012 at 10:42 AM, Eric Lentz ericle...@outfastsource.com
 wrote:

  Maurizio, tried your way and no joy. Looks like I'll go with Łukasz' way.
 
  Thanks everyone for your consideration and help!
 
  On Fri, Nov 30, 2012 at 1:31 PM, Lukasz Lenart lukaszlen...@apache.org
  wrote:
 
   2012/11/30 Eric Lentz ericle...@outfastsource.com:
Inside of an interceptor, I'd like to add a value onto the the
   ValueStack.
What is the best way to do this?
   
I tried this:
invocation.getStack().set(myValueStackName,
  theValueIwantForThisName);
   
But that pushes that value to the top of the stack, pushing my action
   class
down which becomes problematic for values getting assigned to the
  action
class. For example, a JSP field with name=fooId and an action class
   with
a field of Long fooId. When I have the above code, fooId doesn't get
assigned. When I don't, it works as you would expect.
  
   use stack.pop() and stack.push()
  
I guess my interceptor could be later in the stack of interceptors,
  after
the ParametersInterceptor, but that seems fragile. Some other
 developer
could come along and move it and now there are bugs. Plus, I'd prefer
   this
particular interceptor be at or near the beginning of the list of
interceptors.
   
So, how do I assign, but leave the action class at the top of the
  stack?
   I
could pop the action, add my value and then add the action back on,
 but
   is
there a better way?
  
   No, this is the preferred way. And please keep in mind the stack will
   be searched from top to down for given value name.
  
  
   Regards
   --
   Łukasz
   + 48 606 323 122 http://www.lenart.org.pl/
  
   -
   To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
   For additional commands, e-mail: user-h...@struts.apache.org
  
  
 



RE: wierd stack trace regarding parsing of struts.xml

2012-11-30 Thread Davis, Chad
 
 Probably trying to go out to the web for a DTD/XSD or something?
 

Okay.  It does appear to be finding the struts.xml file, and then timing out 
while trying to get something else over the network.   I guess my first 
reaction is . . . . does my struts app really need to be able to reach out onto 
the internet to execute ?  But maybe that shows my lack of knowledge on this 
point.


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



Re: wierd stack trace regarding parsing of struts.xml

2012-11-30 Thread Dave Newton
Without knowing what you're specifying in your struts config it's tough to say.

The times I've seen this are when there's a mismatch between what's in
the config and what's in the libraries, like if it can't find the file
locally, it goes on to the network.

I also recall this being container-dependent, but I may be mis-recalling that.

Dave

On Fri, Nov 30, 2012 at 3:42 PM, Davis, Chad chad.da...@emc.com wrote:

 Probably trying to go out to the web for a DTD/XSD or something?


 Okay.  It does appear to be finding the struts.xml file, and then timing out 
 while trying to get something else over the network.   I guess my first 
 reaction is . . . . does my struts app really need to be able to reach out 
 onto the internet to execute ?  But maybe that shows my lack of knowledge on 
 this point.


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




-- 
e: davelnew...@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton
b: Bucky Bits
g: davelnewton
so: Dave Newton

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



RE: wierd stack trace regarding parsing of struts.xml

2012-11-30 Thread Davis, Chad

 Without knowing what you're specifying in your struts config it's tough to 
 say.
 
 The times I've seen this are when there's a mismatch between what's in the
 config and what's in the libraries, like if it can't find the file locally, 
 it goes on
 to the network.
 

So, I think the issue is that I went from webwork to struts 2.3 on this app.  I 
did the migration a while back, and the struts.xml files still worked fine even 
without migrating them to the new dtd ( declarations as well as actual 
structure ).  But in on this one installation they fail.  My theory is that if 
the internet is available, the struts.xml with xwork DTD will still work.  
This makes me think that the DTD resolution must have someone of resolving the 
dTD from the classpath prior to hitting the web URL, but I've not had a change 
to investigate that yet.

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



Re: wierd stack trace regarding parsing of struts.xml

2012-11-30 Thread Dave Newton
IMO it just needs to match the DTD in the jar; as I said, I've
generally seen this happen when there's a mis-match.

In regards to your SO question, it would depend completely on the
implementation and its configuration.

Dave

On Fri, Nov 30, 2012 at 6:52 PM, Davis, Chad chad.da...@emc.com wrote:

 Without knowing what you're specifying in your struts config it's tough to 
 say.

 The times I've seen this are when there's a mismatch between what's in the
 config and what's in the libraries, like if it can't find the file locally, 
 it goes on
 to the network.


 So, I think the issue is that I went from webwork to struts 2.3 on this app.  
 I did the migration a while back, and the struts.xml files still worked fine 
 even without migrating them to the new dtd ( declarations as well as actual 
 structure ).  But in on this one installation they fail.  My theory is that 
 if the internet is available, the struts.xml with xwork DTD will still 
 work.  This makes me think that the DTD resolution must have someone of 
 resolving the dTD from the classpath prior to hitting the web URL, but I've 
 not had a change to investigate that yet.

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




-- 
e: davelnew...@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton
b: Bucky Bits
g: davelnewton
so: Dave Newton

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



RE: wierd stack trace regarding parsing of struts.xml

2012-11-30 Thread Davis, Chad

 IMO it just needs to match the DTD in the jar; as I said, I've generally seen
 this happen when there's a mis-match.
 
 In regards to your SO question, it would depend completely on the
 implementation and its configuration.
 

Here's the one that doesn't work:

?xml version=1.0 encoding=UTF-8?
!DOCTYPE xwork PUBLIC 
-//OpenSymphony Group//XWork 1.1.1//EN
http://www.opensymphony.com/xwork/xwork-1.1.1.dtd;

xwork


But what do you think needs to match the jar file?  I mean, struts2-core.jar 
doesn't contain xwork-1.1.1.dtd, but the xwork jar does . . . so why wouldn't 
it find it if it was just taking the xwork-1.1.1.dtd and checking the classpath.



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