Re: Apache Struts 2.3.35 Upgrade - backward incompatibility in s:if

2018-08-30 Thread Miguel Almeida
Thanks Lukasz,


On Thu, Aug 30, 2018 at 10:03 AM Lukasz Lenart 
wrote:

> czw., 30 sie 2018 o 10:40 Miguel Almeida 
> napisał(a):
> > Out of curiosity, is the problem the conversion from List to XWorkList
> > mentioned
> > by Yasser
> > <
> https://issues.apache.org/jira/browse/WW-4954?focusedCommentId=16593382=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16593382
> >
> > ?
>
> Yes, XWorkList lays in a excluded package that cannot be used directly
> in OGNL expressions.
>
> > Follow up questions:
> >
> > 1. What is the expected impact of this change? On our previous upgrade
> from
> > 34 to 35 our risk assessment determined no risk, based on the assumption
> > that the change was backwards compatible. Since it is not (and we need to
> > perform the additional change in struts.xml), can you tell us if there is
> > any area we should worry about when upgrading?
>
> Hard to say, we extended the excluded packages to prevent unknown
> feature vulnerabilities that can use those classes. It wasn't caused
> by any security report. So changing struts.xml shouldn't be a problem.
>
> > 2. Should the logs have shown this? With devMode=true, I see no
> difference
> > in the logs from 34 to 35
>
> You should see a WARN from the SecurityMemberAccess class (devMode is
> not needed)
>
> > 3. Is it possible to change the release notes to tell about this
> > incompatibility? Going forward, is there a way to improve the
> compatibility
> > assessments?
>
> Yes, we can change them and not sure what do you mean improving the
> compatibility assessments?
>

I mean being able to provide some more information in the release notes
that allows to spot backward incompatibilities more easily. I know this is
a lot easier said than done, but the end goal is to improve accuracy of the
backward compatibility assessments.
Regards,
Miguel

>
>
> 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: Apache Struts 2.3.35 Upgrade - backward incompatibility in s:if

2018-08-30 Thread Miguel Almeida
Hi Lukasz,

Thanks for your answer. Yes, it seems related, adding this constant works
around the issue.
Out of curiosity, is the problem the conversion from List to XWorkList
mentioned
by Yasser
<https://issues.apache.org/jira/browse/WW-4954?focusedCommentId=16593382=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16593382>
?

Follow up questions:

1. What is the expected impact of this change? On our previous upgrade from
34 to 35 our risk assessment determined no risk, based on the assumption
that the change was backwards compatible. Since it is not (and we need to
perform the additional change in struts.xml), can you tell us if there is
any area we should worry about when upgrading?

2. Should the logs have shown this? With devMode=true, I see no difference
in the logs from 34 to 35

3. Is it possible to change the release notes to tell about this
incompatibility? Going forward, is there a way to improve the compatibility
assessments?

Kind regards,
Miguel


On Thu, Aug 30, 2018 at 7:21 AM Lukasz Lenart 
wrote:

> śr., 29 sie 2018 o 19:04 Miguel Almeida 
> napisał(a):
> > *And *scopesValues was previously set ( > value="scopes">, where scopes is a Listscopes in the
> action)
>
> It is probably related to this issue
>
> https://issues.apache.org/jira/browse/WW-4954?focusedCommentId=16593403=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16593403
>
> You can temporary use the posted workaround but we will fix that in
> incoming two minor releases.
>
>
> 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
>
>


Apache Struts 2.3.35 Upgrade - backward incompatibility in s:if

2018-08-29 Thread Miguel Almeida
We upgraded from 2.3.34 to 2.3.35 in one of our applications, but although
the upgrade is described as backwards compatible, we found a problem in the
UI.

The simplified example is as follows.
*Given* a JSP with:


foo


 bar


*And *scopesValues was previously set (, where scopes is a Listscopes in the action)

*When* the List scopes has [Portuguese Things, XXX]
*Then *the JSP will print: bar[Portuguese Things, XXX]


If I revert to 2.3.34:
*Then *the JSP will print: foo[Portuguese Things, XXX]


What could be causing this? Since this breaks one of our pages we are now
hesitant on what other places could break after the upgrade.

Kind regards,

Miguel


Re: Can we use the decorator pattern in Actions?

2017-03-31 Thread Miguel Almeida
I am resurrecting this very old thread to ask if there have been any
updates to struts itself to solve this.
I was reading some comments on this subject on stackoverflow and
recalled our discussion.

Lukasz - do you know of any developments within Struts in this area?

With regards to your original suggestion, I'm not sure I followed, since
"Thus must be implemented in each interceptor which interacts with
action base on interface (Preparable, ValidationAware, SessionAware,
etc)." sounded like all (or most) Struts  interceptors would need to be
re-written.

Miguel

On Qui, 2012-10-04 at 08:05 +0200, Lukasz Lenart wrote:

> 2012/10/3 Miguel Almeida <mig...@almeida.at>:
> > I was speaking with Lukasz today about this, so I'm resurrecting this
> > old thread.
> >
> > The underlying question in my (rather extensive) post is:
> >
> > How can you perform the following decorator pattern:
> >
> > public OriginalAction implements Preparable,
> > SessionAware,OriginalActionInterface{
> >
> >   public String someFunctionality(){
> > 
> >   }
> > }
> >
> > Decorate like:
> >
> > public DecoratedAction implements Preparable, SessionAware,etc{
> >   private OriginalActionInterface originalAction; //inject
> > OriginalAction here
> >   @Secured
> >   public String someFunctionality(){
> > // do new stuff
> > orignalAction.someFunctionality();
> >   }
> > }
> >
> > Issues:
> > 1) Your OriginalAction will probably rely on some objects injected by
> > struts (eg: session will probably be used). However, because
> > OriginalAction is now only decorating DecoratedAction...those objects
> > won't be automatically populated by Struts.
> >
> >
> > The only way I see it is to use Spring IoC to define these needed
> > objects in OriginalAction. But it would be neat if that was performed by
> > Struts.
> >
> > What are your thoughts on this?
> >
> >
> > Miguel Almeida
> >
> >
> >  On Wed, 2012-05-16 at 11:22 +0100, Miguel Almeida wrote:
> >
> >> Imagine the scenario where you have security implemented at the action
> >> method level with an annotation:
> >>
> >> @Secured("someRole") restricts that action to that role (and it is
> >> checked with an interceptor).
> >>
> >> Discussing this on the TDD mailing list a while back, a decorator
> >> approach was suggested
> >>
> >> To separate concerns and ease up testing, authorization is implemented
> >> as a decorator (a-la GoF decorator pattern) adding authorization to the
> >> underlying (decorated) MVC app.
> >>
> >> The technique to getting there (see pseudo code in [1])
> >> 1. Extract an interface from your main class with all the public methods
> >> 2. Implement a decorator which adds authorization rules to a decorated
> >> underlying object. The decorator implements the authorization rules
> >> using annotations
> >> 3. in your tests, test the decorator providing a mock underlying
> >> decorated object, asserting in each test that given a request with a
> >> user that has certain roles the underlying method should or should not
> >> be called.
> >>
> >>
> >> As you see, tests would have a simple setup as you wouldn't be calling
> >> "the real, possible complicated action code", but the fake decorated
> >> one.
> >> The problem arises when you have superclasses (and maybe also when you
> >> implement interfaces). I exemplify with both.
> >>
> >> Imagine this:
> >> RealAction extends CommonAction implements IAction(){
> >> ...}
> >>
> >> CommonAction implements ServletRequestAware(){
> >> ...
> >> }
> >>
> >> AuthorizingDecorator implements IAction(){
> >> //injected decorated IAction, see [1]
> >> ...
> >> }
> >>
> >> Now, on a regular RealAction implementation, the request object exists:
> >> RealAction extends CommonAction, so the request is injected through its
> >> ServletRequestAware.
> >> If you're using the AuthorizingDecorator, however, the request will be
> >> null: RealAction will be injected, so Struts won't kick in to populate
> >> RealAction's request object.
> >>
> >>
> >> My question is: how would you go on and solve this? Or is the decorator
> >> approach impractical in Struts? I haven't even consider the necessity to
> >> implement every getter/setter on the

Re: Can you use type conversion with JSONInterceptor?

2016-12-02 Thread Miguel Almeida
Thank you Lukasz!

I will check if/how we can inject the converter there. If we manage to
get it working in a way that helps the ticket resolution I'll also post
the information there.



On Sex, 2016-12-02 at 09:50 +0100, Lukasz Lenart wrote:

> Hi,
> 
> JSON plugin uses its own conversation mechanism, check JSONPopulator
> but I think it should be possible to inject XWorkConverter and use it
> to convert objects - this requires implementing your own
> JSONPopulator.
> 
> There is a task to do it so it should happen in Struts 2.5 ;-)
> https://issues.apache.org/jira/browse/WW-3364
> 
> 
> Regards


Can you use type conversion with JSONInterceptor?

2016-12-01 Thread Miguel Almeida
Imagine SearchAction{

private List evaluatedRecords;
}

Record is an interface so to get auto-wiring to work you'd usually
set-up a

SearchAction-conversion.properties:
KeyProperty_evaluatedRecords=id
Element_evaluatedRecords=com.bibliovigilance.model.RecordImpl
CreateIfNull_evaluatedRecords=true


I now want to create an Ajax post on this action. I tried the following:

var evaluatedRecords = [
 {"id": "10672"}
 ]
 
 var json_parameters = {evaluatedRecords:
evaluatedRecords};

$.ajax({
  url: 'SearchmarkSelectedArticlesJSON.action',
  cache: false,
  contentType: 'application/json',
  data: JSON.stringify(json_parameters),
  type: "POST"
});

I believe I need to set-up the JSON interceptor on my action, so I
added:




The problem is that this interceptor doesn't seem to be using the
-conversion.properties, so it throws an error when it tries to
instantiate the Record class:

java.lang.InstantiationException: com.bibliovigilance.model.Record
at java.lang.Class.newInstance(Class.java:368)
at
org.apache.struts2.json.JSONPopulator.convertToCollection(JSONPopulator.java:250)


I also tried removing the Record type in the List ( List
evaluatedRecords). But in this case the JSON deserialization of the
above mentioned ajax call will create a List evaluatedRecords with 1
element, but that element is a Map (I didn't investigate, but I suppose
it'll have id in the key and 10672 in the value).

How would we configure this correctly? Is it possible for the JSON
interceptor to be aware of the -conversion.properties? If not, what
alternatives do you envision?

Thanks!

Miguel


Re: S:url and s:param and character encoding

2014-09-01 Thread Miguel Almeida


On Mon, 2014-09-01 at 10:20 +0200, Lukasz Lenart wrote:

 2014-08-29 18:11 GMT+02:00 Miguel Almeida mig...@almeida.at:
  I had an issue recently with a download action not finding the
  corresponding file and you might be able to help me with it. The
  filename (on disk) was Calendário (á is the focus here).
 
  I am using the following s:url (Calendário is within the variable
  #answer):
 
  s:url encode=true var=downloadUrl 
  action=Filedownload
  s:param 
  name=answer.id${entityId}/s:param
  s:param 
  name=fileNames:property value=%{#answer}//s:param
  /s:url
  s:a theme=simple 
  href=%{downloadUrl}s:property
  value=%{#answer}//s:a
 
 It can be an issue in DefaultUrlHelper as it uses
 paramValue.toString() (which means it uses server's locale), did you
 try to use s:param name=fileName${answer}/s:param instead of
 s:param name=fileNames:property value=%{#answer}//s:param ?

I actually had s:param name=fileName${answer}/s:param and it
worked corretly. I had to change to the s:property alternative due to
an issue with a JSP page with a grouped view - somewhere in the code the
variable #answer is probably being set differently, so with ${answer} I
would get an array [id1,id2...] whereas with s:property
value=%{#answer}/ I would get the correct fileName.



 
 
 Regards


S:url and s:param and character encoding

2014-08-29 Thread Miguel Almeida
I had an issue recently with a download action not finding the
corresponding file and you might be able to help me with it. The
filename (on disk) was Calendário (á is the focus here).

I am using the following s:url (Calendário is within the variable
#answer):

s:url encode=true var=downloadUrl 
action=Filedownload
s:param 
name=answer.id${entityId}/s:param
s:param name=fileNames:property 
value=%{#answer}//s:param
/s:url
s:a theme=simple 
href=%{downloadUrl}s:property
value=%{#answer}//s:a 

If I use a plain-old a and s:properties I get the normal behaviour:

a 
href=Filedownload.action?answer.id=s:property
value=%{#entityId}/fileName=s:property
value=%{#answer}/s:property value=%{#answer}//a

Is there something missing from s:url?
I also found https://issues.apache.org/jira/browse/WW-2414 which seems
to mention something similar, but marked as solved in 2.0.x.

Cheers,

Miguel


Is the email regex validator in Struts validation incorrect?

2014-08-25 Thread Miguel Almeida
This is the regex for email validation in Struts:

\\b^['_a-z0-9-\\+]+(\\.['_a-z0-9-\\+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)\*
\.([a-z]{2}|aero|arpa|asia|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|
museum|name|nato|net|org|pro|tel|travel|xxx)$\\b

I had a report of this failing for a user with an umlaut email
( shläg...@example.com ).  My regex is not very good, but the above
mentioned regex doesn't seem to allow said characters.

However, International characters above U+007F are permitted by RFC
6531 :

http://sphinx.mythic-beasts.com/~pdw/cgi-bin/emailvalidate



What is your view on this? Could this regex be incorrect and miss out
any special characters?

Miguel Almeida



Re: Is the email regex validator in Struts validation incorrect?

2014-08-25 Thread Miguel Almeida
I have added it to the JIRA -
https://issues.apache.org/jira/browse/WW-4389


I can't seem to find the actual standard though (i.e., the one in place
that essentially doesn't allow these characters). For documentation
purposes, does anyone know what effective standard disallows these
characters?

Cheers!
Miguel

On Mon, 2014-08-25 at 10:51 -0500, Paul Benedict wrote:

 I looked up the RFC. The document lists itself as a proposed standard [1]
 so it's not really available yet for general use (but correct me if wrong).
 I propose that an enhancement should be made in JIRA to handle this.
 
 [1] http://tools.ietf.org/html/rfc6531
 
 
 
 Cheers,
 Paul
 
 
 On Mon, Aug 25, 2014 at 10:46 AM, Miguel Almeida mig...@almeida.at wrote:
 
  This is the regex for email validation in Struts:
 
  \\b^['_a-z0-9-\\+]+(\\.['_a-z0-9-\\+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)\*
  \.([a-z]{2}|aero|arpa|asia|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|
  museum|name|nato|net|org|pro|tel|travel|xxx)$\\b
 
  I had a report of this failing for a user with an umlaut email
  ( shläg...@example.com ).  My regex is not very good, but the above
  mentioned regex doesn't seem to allow said characters.
 
  However, International characters above U+007F are permitted by RFC
  6531 :
 
  http://sphinx.mythic-beasts.com/~pdw/cgi-bin/emailvalidate
 
 
 
  What is your view on this? Could this regex be incorrect and miss out
  any special characters?
 
  Miguel Almeida
 
 


Re: Is the email regex validator in Struts validation incorrect?

2014-08-25 Thread Miguel Almeida
Note: I pasted the wrong JIRA issue. The correct one is:
https://issues.apache.org/jira/browse/WW-4395

On Mon, 2014-08-25 at 12:22 -0400, Dave Newton wrote:

 http://tools.ietf.org/html/rfc2822
 
 IIRC http://tools.ietf.org/html/rfc2047 discusses non-0-127 chars in
 headers, I'm not sure if that extends to addresses.
 
 The bottom line is that any realistic email regex will miss a lot of edge
 cases, and some fairly normal use cases as well. Email regexes are
 generally good enough and that's about it. Regexes isn't the right
 solution for completely-spec-compliant email address validation.
 
 Note that other email validators can be plugged in fairly easily.
 
 Dave
 
 
 
 
 On Mon, Aug 25, 2014 at 12:11 PM, Miguel Almeida mig...@almeida.at wrote:
 
  I have added it to the JIRA -
  https://issues.apache.org/jira/browse/WW-4389
 
 
  I can't seem to find the actual standard though (i.e., the one in place
  that essentially doesn't allow these characters). For documentation
  purposes, does anyone know what effective standard disallows these
  characters?
 
  Cheers!
  Miguel
 
  On Mon, 2014-08-25 at 10:51 -0500, Paul Benedict wrote:
 
   I looked up the RFC. The document lists itself as a proposed standard
  [1]
   so it's not really available yet for general use (but correct me if
  wrong).
   I propose that an enhancement should be made in JIRA to handle this.
  
   [1] http://tools.ietf.org/html/rfc6531
  
  
  
   Cheers,
   Paul
  
  
   On Mon, Aug 25, 2014 at 10:46 AM, Miguel Almeida mig...@almeida.at
  wrote:
  
This is the regex for email validation in Struts:
   
\\b^['_a-z0-9-\\+]+(\\.['_a-z0-9-\\+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)\*
\.([a-z]{2}|aero|arpa|asia|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|
museum|name|nato|net|org|pro|tel|travel|xxx)$\\b
   
I had a report of this failing for a user with an umlaut email
( shläg...@example.com ).  My regex is not very good, but the above
mentioned regex doesn't seem to allow said characters.
   
However, International characters above U+007F are permitted by RFC
6531 :
   
http://sphinx.mythic-beasts.com/~pdw/cgi-bin/emailvalidate
   
   
   
What is your view on this? Could this regex be incorrect and miss out
any special characters?
   
Miguel Almeida
   
   
 
 
 
 


Re: REST question

2014-02-11 Thread Miguel
Hi Ken,

Thanks for the pointer, In fact the app uses open session in view with a
custom interceptor, but does the REST Plugin changes the struts-default and
the json-default packages when you include the
struts2-rest-plugin-2.3.16.jar?


That could explain what is happening, but, how I assing the rest-default
stack to my Rest controllers ONLY, and the other 'old' actions continue to
work with the custom stack (Spring + Open_session_in_view +
paramsPrepareParamsStack), based on package json-default? It's a rather big
application and can't be refactored to be REST only.

Thanks for your time reading an replying the question.




Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino


On Tue, Feb 11, 2014 at 3:42 PM, Ken McWilliams ken.mcwilli...@gmail.comwrote:

 Sounds like you have used the Open Session in View method... probably
 provided by a custom interceptor, when adding the rest plugin you have
 changed your action to the rest package and forgot to put your interceptor
 back in place, so now you don't have a hibernate session and the view
 generates this error.


 On Mon, Feb 10, 2014 at 10:40 PM, Miguel miguel...@gmail.com wrote:

  Hi,
 
  A strange situation happens when I load *struts2-rest-plugin-2.3.16.jar*
  With out the REST plugin my action and jsp's works as always has worked.
  But with the mere inclusion of the REST Plugin, some jsp's stops finding
  variables, because the variable name changes.
  Here is the snippet:
 
  struts.xml
 
  constant name=struts.objectFactory
  value=org.apache.struts2.spring.StrutsSpringObjectFactory /
  constant name=struts.objectFactory.spring.autoWire value=name /
  package name=proyectox extends=json-default 
  !-- Si no le pones este stack, pues no funciona...--
  interceptors
  interceptor name=strutsSpring
 
 
 class=com.proyectox.ui.interceptor.HibernateOpenSessionInViewInterceptor/
  interceptor name=viewuseragentselector
  class=com.proyectox.ui.interceptor.UserAgentResultInterceptor/
  interceptor-stack name=strutsSpringPPPStack
  interceptor-ref name=strutsSpring/
  interceptor-ref name=paramsPrepareParamsStack/
  interceptor-ref name=viewuseragentselector/
  /interceptor-stack
  /interceptors
  ...
  /package
 
  package name=cfdi extends=proyectox namespace=/cfdi
  action name=header_* class=com.fcm.cfdi.ui.HeaderAction
  result type=redirectAction
  param name=actionNameedit/param
  /result
  !--result printHeader.jsp/result--
  result name=inputheaderEdit.jsp/result
  result name=error/facturaerror.jsp/result
  interceptor-ref name=scope
  param name=sessioncontribuyente/param
  param name=autoCreateSessiontrue/param
  param name=keycontribuyenteActual/param
  /interceptor-ref
  interceptor-ref name=scope
  param name=sessionfactura/param
  param name=autoCreateSessionfalse/param
  param name=keycfdi/param
  /interceptor-ref
  interceptor-ref name=strutsSpringPPPStack/
  /action
 
 
 
  HeaderAction.java:
 
  public class HeaderAction extends ActionSupport implements Preparable {
  protected Contribuyente contribuyente;
  protected Long contribuyenteId;
 
  public void prepare() throws Exception {
  ...
  }
 
 
  public String input(){
 
  dirReceptorId = factura.getDomicilioReceptor().getId();
  dirEmisionId  = factura.getDomicilioEmision().getId();
  return INPUT;
  }
  ...
  public Contribuyente getContribuyente() {
  return contribuyente;
  }
 
  public void setContribuyente(Contribuyente contribuyente) {
  this.contribuyente = contribuyente;
  }
  ...
  }
 
  edit.jsp:
  ...
  s:select label=Direccion Emision
 name=dirEmisionId
 list=*contribuyente*.domicilios
 listKey=id
 listValue=nombre
 multiple=false
 size=1
 required=true
 key=factura.direccionEmision.id
  /
  ...
 
  After loading *struts2-rest-plugin-2.3.16.jar* it starts giving the
  following exception:
  Caused by: org.hibernate.LazyInitializationException: failed to lazily
  initialize a collection of role: *contribuyentes.domicilios*, no session
 or
  session was closed
  ...
 
  I know that's a Hibernate exception, but the jsp works fine without the
  REST Plugin.
  It's like the REST Plugin appends that extra s after the variable name
 in
  the .jsp or the value stack changes or something like that.
 
  The action is invoked without error in either case, and has into it's
  fields the required values.
 
 
  Does anyone has any pointer of what can be happening?
 
  Thanks
 
  Si quieres ser más positivo, pierde un electrón

Re: REST question

2014-02-11 Thread Miguel
Thanks Lukasz, the REST namespace makes everything work well with the REST
Plugin loaded.
Now the real work begins, but that will be for tomorrow morning.

Regards

Miguel

Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino


On Tue, Feb 11, 2014 at 11:46 PM, Lukasz Lenart lukaszlen...@apache.orgwrote:

 You can define REST namespace

 http://struts.apache.org/release/2.3.x/docs/rest-plugin.html#RESTPlugin-Settings

 struts.rest.namespace = /rest


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

 2014-02-12 0:15 GMT+01:00 Miguel miguel...@gmail.com:
  Hi Ken,
 
  Thanks for the pointer, In fact the app uses open session in view with a
  custom interceptor, but does the REST Plugin changes the struts-default
 and
  the json-default packages when you include the
  struts2-rest-plugin-2.3.16.jar?
 
 
  That could explain what is happening, but, how I assing the rest-default
  stack to my Rest controllers ONLY, and the other 'old' actions continue
 to
  work with the custom stack (Spring + Open_session_in_view +
  paramsPrepareParamsStack), based on package json-default? It's a rather
 big
  application and can't be refactored to be REST only.
 
  Thanks for your time reading an replying the question.
 
 
 
 
  Si quieres ser más positivo, pierde un electrón
  Miguel Ruiz Velasco Sobrino
 
 
  On Tue, Feb 11, 2014 at 3:42 PM, Ken McWilliams 
 ken.mcwilli...@gmail.comwrote:
 
  Sounds like you have used the Open Session in View method... probably
  provided by a custom interceptor, when adding the rest plugin you have
  changed your action to the rest package and forgot to put your
 interceptor
  back in place, so now you don't have a hibernate session and the view
  generates this error.
 
 
  On Mon, Feb 10, 2014 at 10:40 PM, Miguel miguel...@gmail.com wrote:
 
   Hi,
  
   A strange situation happens when I load
 *struts2-rest-plugin-2.3.16.jar*
   With out the REST plugin my action and jsp's works as always has
 worked.
   But with the mere inclusion of the REST Plugin, some jsp's stops
 finding
   variables, because the variable name changes.
   Here is the snippet:
  
   struts.xml
  
   constant name=struts.objectFactory
   value=org.apache.struts2.spring.StrutsSpringObjectFactory /
   constant name=struts.objectFactory.spring.autoWire
 value=name /
   package name=proyectox extends=json-default 
   !-- Si no le pones este stack, pues no funciona...--
   interceptors
   interceptor name=strutsSpring
  
  
 
 class=com.proyectox.ui.interceptor.HibernateOpenSessionInViewInterceptor/
   interceptor name=viewuseragentselector
   class=com.proyectox.ui.interceptor.UserAgentResultInterceptor/
   interceptor-stack name=strutsSpringPPPStack
   interceptor-ref name=strutsSpring/
   interceptor-ref name=paramsPrepareParamsStack/
   interceptor-ref name=viewuseragentselector/
   /interceptor-stack
   /interceptors
   ...
   /package
  
   package name=cfdi extends=proyectox namespace=/cfdi
   action name=header_* class=com.fcm.cfdi.ui.HeaderAction
   result type=redirectAction
   param name=actionNameedit/param
   /result
   !--result printHeader.jsp/result--
   result name=inputheaderEdit.jsp/result
   result name=error/facturaerror.jsp/result
   interceptor-ref name=scope
   param name=sessioncontribuyente/param
   param name=autoCreateSessiontrue/param
   param name=keycontribuyenteActual/param
   /interceptor-ref
   interceptor-ref name=scope
   param name=sessionfactura/param
   param name=autoCreateSessionfalse/param
   param name=keycfdi/param
   /interceptor-ref
   interceptor-ref name=strutsSpringPPPStack/
   /action
  
  
  
   HeaderAction.java:
  
   public class HeaderAction extends ActionSupport implements Preparable
 {
   protected Contribuyente contribuyente;
   protected Long contribuyenteId;
  
   public void prepare() throws Exception {
   ...
   }
  
  
   public String input(){
  
   dirReceptorId = factura.getDomicilioReceptor().getId();
   dirEmisionId  = factura.getDomicilioEmision().getId();
   return INPUT;
   }
   ...
   public Contribuyente getContribuyente() {
   return contribuyente;
   }
  
   public void setContribuyente(Contribuyente contribuyente) {
   this.contribuyente = contribuyente;
   }
   ...
   }
  
   edit.jsp:
   ...
   s:select label=Direccion Emision
  name=dirEmisionId
  list=*contribuyente*.domicilios
  listKey=id
  listValue=nombre
  multiple=false
  size=1
  required=true
  key

REST question

2014-02-10 Thread Miguel
Hi,

A strange situation happens when I load *struts2-rest-plugin-2.3.16.jar*
With out the REST plugin my action and jsp's works as always has worked.
But with the mere inclusion of the REST Plugin, some jsp's stops finding
variables, because the variable name changes.
Here is the snippet:

struts.xml

constant name=struts.objectFactory
value=org.apache.struts2.spring.StrutsSpringObjectFactory /
constant name=struts.objectFactory.spring.autoWire value=name /
package name=proyectox extends=json-default 
!-- Si no le pones este stack, pues no funciona...--
interceptors
interceptor name=strutsSpring
class=com.proyectox.ui.interceptor.HibernateOpenSessionInViewInterceptor/
interceptor name=viewuseragentselector
class=com.proyectox.ui.interceptor.UserAgentResultInterceptor/
interceptor-stack name=strutsSpringPPPStack
interceptor-ref name=strutsSpring/
interceptor-ref name=paramsPrepareParamsStack/
interceptor-ref name=viewuseragentselector/
/interceptor-stack
/interceptors
...
/package

package name=cfdi extends=proyectox namespace=/cfdi
action name=header_* class=com.fcm.cfdi.ui.HeaderAction
result type=redirectAction
param name=actionNameedit/param
/result
!--result printHeader.jsp/result--
result name=inputheaderEdit.jsp/result
result name=error/facturaerror.jsp/result
interceptor-ref name=scope
param name=sessioncontribuyente/param
param name=autoCreateSessiontrue/param
param name=keycontribuyenteActual/param
/interceptor-ref
interceptor-ref name=scope
param name=sessionfactura/param
param name=autoCreateSessionfalse/param
param name=keycfdi/param
/interceptor-ref
interceptor-ref name=strutsSpringPPPStack/
/action



HeaderAction.java:

public class HeaderAction extends ActionSupport implements Preparable {
protected Contribuyente contribuyente;
protected Long contribuyenteId;

public void prepare() throws Exception {
...
}


public String input(){

dirReceptorId = factura.getDomicilioReceptor().getId();
dirEmisionId  = factura.getDomicilioEmision().getId();
return INPUT;
}
...
public Contribuyente getContribuyente() {
return contribuyente;
}

public void setContribuyente(Contribuyente contribuyente) {
this.contribuyente = contribuyente;
}
...
}

edit.jsp:
...
s:select label=Direccion Emision
   name=dirEmisionId
   list=*contribuyente*.domicilios
   listKey=id
   listValue=nombre
   multiple=false
   size=1
   required=true
   key=factura.direccionEmision.id
/
...

After loading *struts2-rest-plugin-2.3.16.jar* it starts giving the
following exception:
Caused by: org.hibernate.LazyInitializationException: failed to lazily
initialize a collection of role: *contribuyentes.domicilios*, no session or
session was closed
...

I know that's a Hibernate exception, but the jsp works fine without the
REST Plugin.
It's like the REST Plugin appends that extra s after the variable name in
the .jsp or the value stack changes or something like that.

The action is invoked without error in either case, and has into it's
fields the required values.


Does anyone has any pointer of what can be happening?

Thanks

Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino


Re: Best book reference for struts 2

2014-01-16 Thread Miguel Almeida
I've found Dave Newton's Apache Struts to be one of the best Struts
books out there.


Miguel

On Thu, 2014-01-16 at 14:17 +0530, Arvind Gupta wrote:

 Struts2 by Vincent is really good for starting out. Also have a look at
 this one from infoq
 
 http://www.infoq.com/minibooks/starting-struts2
 
 
 On Thu, Jan 16, 2014 at 1:56 PM, Christoph Nenning 
 christoph.nenn...@lex-com.net wrote:
 
   Hi,
  
   I am new to this forum. Just wanted to ask which book is best to follow
   Struts 2.
  
   I am planning to purchase Struts 2 black book. Please advice if any
  other
   book will be nice to get in touch with Struts 2.
  
   Regards,
   Saju
 
 
  In my company we have 'struts2 in action'. I think it's OK.
 
  Don't know the black book so I cannot compare them.
 
 
  regards,
  Christoph
 
  This Email was scanned by Sophos Anti Virus
 




Re: Best book reference for struts 2

2014-01-16 Thread Miguel Almeida
You're welcome! I like to give credit when credit is due, and your book
helped me a lot when I started out, in 2007/2008, knowing virtually
nothing about web development and very little about programming.


Speaking of which, are you thinking about creating a new edition for 2.x
or 3.x ?

Miguel

On Thu, 2014-01-16 at 08:01 -0500, Dave Newton wrote:

 Thank you!
 
 I'd add that the book covers Struts 2.1 (e.g., annotations), and includes
 sections on JavaScript and development in general.
 
 http://packtlib.packtpub.com/apache-struts-2-web-application-development-beginners-guide/book
 
 
 
 On Thu, Jan 16, 2014 at 7:35 AM, Miguel Almeida mig...@almeida.at wrote:
 
  I've found Dave Newton's Apache Struts to be one of the best Struts
  books out there.
 
 
  Miguel
 
  On Thu, 2014-01-16 at 14:17 +0530, Arvind Gupta wrote:
 
   Struts2 by Vincent is really good for starting out. Also have a look at
   this one from infoq
  
   http://www.infoq.com/minibooks/starting-struts2
  
  
   On Thu, Jan 16, 2014 at 1:56 PM, Christoph Nenning 
   christoph.nenn...@lex-com.net wrote:
  
 Hi,

 I am new to this forum. Just wanted to ask which book is best to
  follow
 Struts 2.

 I am planning to purchase Struts 2 black book. Please advice if any
other
 book will be nice to get in touch with Struts 2.

 Regards,
 Saju
   
   
In my company we have 'struts2 in action'. I think it's OK.
   
Don't know the black book so I cannot compare them.
   
   
regards,
Christoph
   
This Email was scanned by Sophos Anti Virus
   
 
 
 
 
 




Re: minimal set of jar files for struts 2.3

2014-01-06 Thread Miguel Almeida
Lukasz,

Incidentally, is this list compiled by hand or is it built automatically
using a (which?) maven plugin?

Miguel
On Sat, 2014-01-04 at 13:18 +0100, Lukasz Lenart wrote:

 The first section compile and optional No
 
 http://struts.apache.org/release/2.3.x/xwork-core/dependencies.html
 http://struts.apache.org/release/2.3.x/struts2-core/dependencies.html
 
 2014/1/4 Dave Evans dsevan...@gmail.com:
  Hello,
 
  I have a couple of old struts 2 apps that are using 2.2.1. I want to
  upgrade them to 2.3.
 
  What is the minimal set of jar files I need in WEB-INF/lib?
 
  I currently have:
  commons-beanutils-1.7.jar
  commons-collections-2.1.jar
  commons-digester-1.7.jar
  commons-fileupload-1.2.1.jar
  commons-io-1.4.jar
  commons-javaflow-20060411.jar
  commons-lang-2.5.jar
  commons-logging-1.0.4.jar
  freemarker-2.3.16.jar
  ibatis-2.3.2.715.jar
  itext-1.3.1.jar
  jasperreports-2.0.5.jar
  javamail.jar
  javassist-3.8.0.GA.jar
  jdt-compiler-3.1.1.jar
  jstl.jar
  jxl-2.6.jar
  log4j-1.2.14.jar
  ognl-3.0.jar
  poi-3.0.1-FINAL-20070705.jar
  spring.jar
  standard.jar
  struts2-core-2.2.1.jar
  struts2-jasperreports-plugin-2.0.11.1.jar
  urlrewrite-3.2.0.jar
  xalan.jar
  xercesImpl.jar
  xwork-core-2.2.1.jar
 
  Thanks,
 
  Dave
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 




Re: Is Struts 2.3.15.2 affected by the security vulnerability S2-018?

2013-12-17 Thread Miguel Almeida
Lukasz,

Just to be sure, does that mean that if you use 2.3.15.3 and you set the
flag to enable the action: prefix it means you'll get the old behaviour
(and vulnerability) back?


Miguel

On Mon, 2013-12-16 at 08:27 +0100, Lukasz Lenart wrote:

 2.3.15.2 and 2.3.15.3 address the same issue, but 2.3.15.2 breaks
 support for action: prefix, that's why we released 2.3.15.3 as well -
 even if you don't use action: prefix functionality it will be better
 upgrade to 2.3.15.3 and use the new flag to disable action: prefix
 which is safer option.
 
 
 Regards




Re: Is Struts 2.3.15.2 affected by the security vulnerability S2-018?

2013-12-17 Thread Miguel Almeida
On Tue, 2013-12-17 at 11:40 +0100, Lukasz Lenart wrote:

 2013/12/17 Miguel Almeida mig...@almeida.at:
  Lukasz,
 
  Just to be sure, does that mean that if you use 2.3.15.3 and you set the
  flag to enable the action: prefix it means you'll get the old behaviour
  (and vulnerability) back?
 
 As I cannot answer your question directly on public forum, I will say
 that there is one more option you should keep false when you enabled
 support for action: prefix.
 
 Anyway, right now I'm working on two most important things: better DMI
 and action: support :-)

Great to hear that. BTW, you've been missed on IRC's #struts, drop by
some time!



 
 
 Regards




Re: Token Session Interceptor and back button

2013-12-06 Thread Miguel Almeida
Paul, I was thinking about this example...what did you have in mind as a
way to achieve that, tough, i.e., that a browser back refreshes the
page? 

I can only see some javascript method/hack for that. Were you thinking
of something else?


Miguel

On Thu, 2013-12-05 at 14:59 -0600, Paul Benedict wrote:

 Make sure your back-button action refreshes the page. You can't reuse a
 token from the browser's cache. It needs to regenerated.
 
 
 On Thu, Dec 5, 2013 at 12:39 PM, semog12 semog1epi...@gmail.com wrote:
 
  Hi,
 
  I am using the token session interceptor for a form and I have this
  situation:
  1) I am in the form page;
  2) I leave the form page;
  3) Go back to the form page by the back button;
  4) Submit the form;
 
  And of course the form is not submitted and the token returns
  invalid.token but do not adds no actionError. It will not be interesting
  to add an action error?
 
  Ok, I can resend to a page with a message but I already have a error page
  that presents the action errors when necessary.
 
  Thanks,
 
  André Gomes
 
 
 
  --
  View this message in context:
  http://struts.1045723.n5.nabble.com/Token-Session-Interceptor-and-back-button-tp5714861.html
  Sent from the Struts - User mailing list archive at Nabble.com.
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 




Re: S2 - custom tag with Spring

2013-12-04 Thread Miguel Almeida
If you @Autowire something into your class you're essentially doing the
same as retrieving the resources from ApplicationContext.

Once you define your class as a Spring bean in Spring's configuration
(either by explicitly defining it in an XML or because it's in a
classpath which you've told Spring to scan) it is managed by spring - so
you'll be able to inject whatever you want onto the bean.

Beware of the scope you give to that bean, though. If it's in a tag, you
might want to give it a request scope.

Miguel

On Wed, 2013-12-04 at 11:00 +0800, Steven Yang wrote:

 Hi
 I am writing some custom tags.
 I want to access some resource from Spring.
 Is there a clean way of doing it, instead of getting the ApplicationContext
 in the Components?
 Will @Inject work for non-Struts values?
 Or @Autowire will work as well?
 
 I am using the spring plugin.
 
 Thanks




Re: security impact after enabling back the action: prefix in Struts 2.3.15.3

2013-11-26 Thread Miguel Almeida
Picking up on this topic, I noticed that disabling this feature will
break any JSPs where you've set the action in the s:submit tag instead
of the s:form tag.

This is particularly problematic in situations where  for some reason
you have one form with two submit tags, since the submit is the only
place where you can distinguish the actions.

This can also be related with a similar situation in s2-019, where the
disabling of the DMI makes the method= parameter of the tags unusable.

I've learnt that this will be better handled in a future version of
struts, so my assumption is that the normal behaviour will return in
both situations on a future non-security release - hopefully the next
one! Maybe someone from the dev team can share their input with us?


Kind regards,
Miguel Almeida

On Wed, 2013-11-20 at 04:33 +0100, Krassen Deltchev wrote:

 Dear Struts2 mailing list,
 
 i have the following question(s)/ i need the following advice:
 by default the action: prefix is set to false in Struts2 v2.3.15.3 as to:
 http://struts.apache.org/release/2.3.x/docs/s2-018
 for security reasons,
 but i need to set it back to true(i.e. the
 struts.mapper.action.prefix.enabled) because my actions do not work
 after the library update and if i decide to go another way to solve this
 issue, i need to do a lot of refactoring on my code;
 So my question is:
 if i enable the action: prefix, does it mean that, i automatically
 compromise/expose my application to the security issues discussed in
 s2-16, s2-17 and s2-18?
 Is there a workaround for my scenario, that i can enable the prefix, but
 still maintain the security level of my application considering the
 enumerated above issues?(can i achieve better results if i tweak
 properly the struts.mapper.action.prefix.crossNamespaces)
 
 many thanks for your opinions and support!
 
 Best,
 
 krassen




Re: Sending email on uncought exception problems

2013-11-26 Thread Miguel Almeida
The first thought I had was also that this might be better suited on an
interceptor. You'll also have more control over the desired behaviour
since interceptors are more easily testable than JSPs.

Miguel
On Tue, 2013-11-26 at 09:43 -0500, Dave Newton wrote:

 Why not use an interceptor?
 
 Dave
 
 
 
 On Tue, Nov 26, 2013 at 7:44 AM, Lukasz Lichota 
 lukasz.lich...@ocado.comwrote:
 
  hello,
 
  I'd like to run some java code on any uncought exception but so far I
  cannot find a solution.
  Under this link I found the exactly same question but I do not know how to
  apply solution.
 
  http://markmail.org/search/?q=global+exception+redirect+list%3Aorg.apache.struts.users%2F#query:global%20exception%20redirect%20list%3Aorg.apache.struts.users%2F+page:1+mid:wmzqlmfqpzd57dhg+state:results
 
  Namely if I have
  s:if test=notifyAdmin(exception)/s:if
  then in which class this method should be? Error.jsp is not associated with
  any action. The author says he has this method in any Action class but for
  me it doesn't work (how could it work anyway? how error.jsp know about any
  Action class?
 
  I tried also s:action element like that:
  s:action name=default-error!notifyAdmin executeResult=false
  s:param%{exception}/s:param
  /s:action
   and having java class with method like that:
  @Action(default-error)
  public boolean notifyAdmin(Exception exception)
 
  but it fails with no error message so I even do not know what is happening
  (by failing I mean nothing is invoked when rendering the error page)
 
  I also found this
  http://www.mkyong.com/struts/struts-global-custom-exception-example/ but
  it
  looks like exception handler was removed in struts 2.0
 
  Can you offer any hint?
 
  Thanks
  Lukasz
 
  --
  Notice:  This email is confidential and may contain copyright material of
  Ocado Limited (the Company). Opinions and views expressed in this message
  may not necessarily reflect the opinions and views of the Company.
 
  If you are not the intended recipient, please notify us immediately and
  delete all copies of this message. Please note that it is your
  responsibility to scan this message for viruses.
 
  Company reg. no. 3875000.
 
  Ocado Limited
  Titan Court
  3 Bishops Square
  Hatfield Business Park
  Hatfield
  Herts
  AL10 9NE
 
 
 
 




s:token doesn't accept data- attributes, cssClass ignored

2013-10-02 Thread Miguel Almeida
Hi,

I am creating an ajax call for a method which is protected by the
TokenSessionStoreInterceptor. This means I need to pass the token onto
the request.

I was expecting the s:token tag to accept data-foo=bar attributes
(they'd be passed along to the corresponding hidden elements), but this
is not happening (I'd use this so I could retrieve the inputs with a
simple jquery select .find(:input[data-scope='save'], which retrieves
me all the needed inputs as long as I mark them with that data-scope ).

My 2nd attempt was also unsuccessful - while s:token
cssClass=someclass/ doesn't break rendering, the class is not passed
onto the hidden input elements.

Is there a reason for this? While in the case of data-foo this seems to
be a missing feature, in the case of cssClass it's also misleading - you
can set the property, but it doesn't have any consequence.

Miguel


Re: Struts 2.3.15.1 How to read external properties files or conf files

2013-09-06 Thread Miguel Almeida
Without any code it's hard to know what's happening.

I do ask you to seriously reconsider refactoring database access out of
the action or you'll end up with a huge, very hard to test action class.

Miguel Almeida

On Fri, 2013-09-06 at 10:50 +0100, Chris wrote:

 Where : server side , in action , like ActionSupport 
 
 First  example : Login.java ( like in struts-2.3.15.1-blank ) 
 class Login extends com.opensymphony.xwork2.ActionSupport 
 to check and validate user/password ( I need access to LDAP or database ) 
 
 Second Example: A User Request 
 After success login, a web user need to access data ( from LDAP or Database ) 
  
 
 
 java.io.FileNotFoundException : jdbc.properties 
 or
 
 java.io.FileNotFoundException : ldapconfiguration.conf
 
 
 Regards
 
 
 
  De : umeshawas...@gmail.com umeshawas...@gmail.com
 À : Struts Users Mailing List user@struts.apache.org; Chris 
 christal...@yahoo.fr 
 Envoyé le : Vendredi 6 septembre 2013 10h50
 Objet : Re: Struts 2.3.15.1 How to read external properties files or conf 
 files
  
 
 Log4j file will be ready by Log4j framework and not exactly by struts2
 
 Can you define where and how you want to read your property files? 
 Sent from BlackBerry® on Airtel
 
 -Original Message-
 From: Chris christal...@yahoo.fr
 Date: Fri, 6 Sep 2013 09:40:03 
 To: Struts Users Mailing Listuser@struts.apache.org
 Reply-To: Struts Users Mailing List user@struts.apache.org
 Subject: Struts 2.3.15.1 How to read external properties files or conf files
 
 Using log4j.properties instead of log4j.xml is not a problem with Struts 
 2.3.15.1 ( or should it be ? ) 
 But with my own properties files ( jdbc.properties ) or configuration files ( 
 ldap.conf ) it doesn't work. 
 
 
 Is there any example with external files .
 Not an upload  file by input forms. .
 
 Or do we have to use another java classes ?




Re: How to set the name parameter on a multiple s:select

2013-05-30 Thread Miguel Almeida
Thanks for the feedback Dale.
A couple of thoughts below.
On Wed, 2013-05-29 at 08:18 -0400, Dale Newfield wrote:

 I would have a setter on my action class that takes an array of ids.  Then 
 the action does the appropriate lookups, and sets the hydrated objects on the 
 appropriate models.

That's an alternative, yes. I do tend to prefer having the model objects
in my actions though, to keep the number of objects to a minimum - it
makes more sense to have a ListSomeObject objects than an Integer[]
ids, but maybe that's personal preference.

 You do recognize that the data you provided is ambiguous, though, right?  
 Nothing you stated is sufficient to know *which* entity2 objects should be 
 set on entity, just which entity3 objects you want those entity2 objects to 
 have.  In fact, if you don't happen to get a number of entity3 ids that 
 matches the number of entity2s on entity, you've left yourself no way of 
 knowing how to proceed. (Remember, all you get is a (potentially unordered) 
 list of ids from the form submission, not tuples.)

I'm not sure where the ambiguity is. Take the following request
parameters:
entity.entity2List[0].entity3.id=10
entity.entity2List[1].entity3.id=20

There is no ambiguity in how the Object should be populated - one
entity, which has two Entity2 on the entity2List object: the first
entity2 has an Entity3.id=10 and the second Entity2 has an
Entity3.id=20.
In fact, this request works as expected (as evidenced by the test case
[1]). The challenge is to create an s:select that generates that request
parameters!

Miguel

[1] Unit Test snippet

request.setParameter(entity.entity2List[0].entity3.id, 2);
request.setParameter(entity.entity2List[1].entity3.id, 11);

createAction(/example/Conversion.action);

executeProxy();

Entity entity = ((TypeConversionAction) action).getEntity();
assertNotNull(entity);
assertNotNull(entity.getEntity2List());
assertEquals(2, entity.getEntity2List().size());

assertEquals(2, 
entity.getEntity2List().get(0).getEntity3().getId());
assertEquals(11, 
entity.getEntity2List().get(1).getEntity3().getId());

 
 -Dale
 
 On May 29, 2013, at 6:27 AM, Miguel Almeida mig...@almeida.at wrote:
 
  Dear all,
  
  Imagine you have the following scenario:
  - a property in your action: private Entity entity;
  
  - Entity has a ListEntity2 entity2List
  - Entity2 has a Entity3 entity3
  
  Now, you need an s:select with multiple=true to populate entity3. This
  corresponds to having a request in the form
  entity.entity2List[n].entity3.id (n=0,1,2...depending on how many items
  are selected).
  
  Question: how should the name parameter of the s:select be like to
  achieve this?
  
  Me and Lukasz  have tried the following without success (meaning
  entity.entity2List has is empty):
  s:select key=centre.choose multiple=true
  name=%{entity.entity2List[].entity3.id} list=#someList listKey=id
  listValue=code/
  s:select key=centre.choose multiple=true
  name=entity.entity2List[].entity3.id list=#someList listKey=id
  listValue=code/
  
  
  Thank you for your help!
  
  Miguel Almeida
  
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 




How to set the name parameter on a multiple s:select

2013-05-29 Thread Miguel Almeida
Dear all,

Imagine you have the following scenario:
- a property in your action: private Entity entity;

- Entity has a ListEntity2 entity2List
- Entity2 has a Entity3 entity3

Now, you need an s:select with multiple=true to populate entity3. This
corresponds to having a request in the form
entity.entity2List[n].entity3.id (n=0,1,2...depending on how many items
are selected).

Question: how should the name parameter of the s:select be like to
achieve this?

Me and Lukasz  have tried the following without success (meaning
entity.entity2List has is empty):
s:select key=centre.choose multiple=true
name=%{entity.entity2List[].entity3.id} list=#someList listKey=id
listValue=code/
s:select key=centre.choose multiple=true
name=entity.entity2List[].entity3.id list=#someList listKey=id
listValue=code/


Thank you for your help!

Miguel Almeida



Re: How to set the name parameter on a multiple s:select

2013-05-29 Thread Miguel Almeida
I've also posted this on
http://stackoverflow.com/questions/16812357/how-to-set-the-name-parameter-on-a-multiple-sselect
 so the knowledge can be shared once the answer is known.
I also plan to add this to struts' documentation!

Miguel

On Wed, 2013-05-29 at 11:27 +0100, Miguel Almeida wrote:

 Imagine you have the following scenario:
 - a property in your action: private Entity entity;
 
 - Entity has a ListEntity2 entity2List
 - Entity2 has a Entity3 entity3
 
 Now, you need an s:select with multiple=true to populate entity3.
 This
 corresponds to having a request in the form
 entity.entity2List[n].entity3.id (n=0,1,2...depending on how many
 items
 are selected).
 
 Question: how should the name parameter of the s:select be like to
 achieve this?
 
 Me and Lukasz  have tried the following without success (meaning
 entity.entity2List has is empty):
 s:select key=centre.choose multiple=true
 name=%{entity.entity2List[].entity3.id} list=#someList
 listKey=id
 listValue=code/
 s:select key=centre.choose multiple=true
 name=entity.entity2List[].entity3.id list=#someList listKey=id
 listValue=code/ 


Private setter method breaking application in Tomcat7

2013-02-20 Thread Miguel Almeida
Following a chat with Lukasz on IRC, I post a weird behaviour I got this
morning.

Example:
- QueryAction class with a int selectedParent property
- url on a webpage pointing to:
QueryqueryConversation.action?selectedParent=2
- an action mapping action name=Query* method={1}
class=queryAction
- Application packaged in .war and deployed in two containers: tomcat6
and tomcat7

Problem:
1) In tomcat7 the selectedParent int was 0 when entering the
queryConversation method. in tomcat6 the variable was correctly set to
2.
2) Get request had the correct string:
GET /edc-test/QueryqueryConversation.action?selectedParent=2 HTTP/1.1
3) Params interceptor was picking up the parameter: DEBUG
ParametersInterceptor:68 - Setting params selectedParent = [ 2 ]

Resolution:
I found out the issue was related to the fact that we had two
setSelectedParent methods in the Action class:
- public void setSelectedParent(int selectedParent)
- private void setSelectedParent(ObjectX anotherObjectType)

Renaming the second method (I've always said naming methods with get/set
prefix should be reserved to..well, getters/setters) solved the problem.

Questions:
Two questions remain a mystery to me thought:
1) Why is Tomcat7 the only container complaining? Neither tomcat6 nor
our embedded jetty containers complain about this
2) Even though the method's name should be changed, I also find it
strange that this is a problem when the 2nd method is private.


Any thoughts appreciated,

Miguel Almeida



Re: Struts application

2013-02-20 Thread Miguel Almeida
Or, if you already use Maven, use the Maven archetypes available at
http://struts.apache.org/


Miguel Almeida

On Wed, 2013-02-20 at 22:31 +0530, Umesh Awasthi wrote:

 download sample application from S2 official download section and you will
 be able to see how things are being configured and how things are working.
 
 This is a good place to start and get overview of the structure
 
 On Wed, Feb 20, 2013 at 10:27 PM, Brajesh Patel 
 brajeshpate...@gmail.comwrote:
 
  Hi all,
 
  I am looking for an application that provide detail about struts 2 app
  directory structure and detail about action, and other thing.
 
  that will help lot to me.
 
  --
  Thanks
  Brajesh Patel
 
  skype: brajesh.patel11
  Cell:- +91 8750709907
 
 
 
 




Re: Issue with maven archetypes - jetty plugin version 8 not refreshing JSPs

2012-11-07 Thread Miguel Almeida
A follow-up on this. I was able to identify the root cause of this
issue. While this is a bit specific to our use case, I share this with
the community nonetheless.

This was basically caused by the timestamps of the files. My work
directory is an NFS mount of another server. For some strange reason*
the clock on that server is delayed. This means that if it's 9:00 and I
change the JSP file, the file will be timestamped with 8:40. 

There might have been a change in Jetty from 6 to 8 regarding the
strategy used for JSP file reloading - while Jetty 6 does not seem to
care about the file's timestamp and refreshes anyway, Jetty 8 is more
sensitive and does not reload the file.

So the solution here was simply to update the remote NFS server's
clock. Why the NTP-aware server is having trouble with the time is
another issue...

Miguel Almeida



On Tue, 2012-11-06 at 13:12 +0100, Lukasz Lenart wrote:

 2012/10/31 Miguel Almeida mig...@almeida.at
 
  Hey Lukasz,
 
  Does your jetty configuration match the ones I provided? More
  specifically, did you remove the  scanTargets element? With
  scanTargets you will see the JSP changes, but only after the automatic
  container reload (so, worse case scenario in 10 seconds, as defined in
  the scanIntervalSeconds element.
 
  If you remove scanTargets, the page will not be refreshed on JSP change
  in jetty 8 but will be refreshed in jetty 6! And reloading the entire
  container for every JSP change seems like an overkill (and slows down
  development process considerably when your webapp has session variables
  and security).
 
  Could you try the configuration without scanTargets for jetty 6 and 8?
 
 
 Yes, I did that and even committed the change [1], there was no Jetty
 restarts when I've been changing jsp file.
 
 [1] https://issues.apache.org/jira/browse/WW-3916
 
 
 Regards




Re: Issue with maven archetypes - jetty plugin version 8 not refreshing JSPs

2012-10-31 Thread Miguel Almeida
Hey Lukasz,

Does your jetty configuration match the ones I provided? More
specifically, did you remove the  scanTargets element? With
scanTargets you will see the JSP changes, but only after the automatic
container reload (so, worse case scenario in 10 seconds, as defined in
the scanIntervalSeconds element.

If you remove scanTargets, the page will not be refreshed on JSP change
in jetty 8 but will be refreshed in jetty 6! And reloading the entire
container for every JSP change seems like an overkill (and slows down
development process considerably when your webapp has session variables
and security).

Could you try the configuration without scanTargets for jetty 6 and 8?

Miguel Almeida


On Tue, 2012-10-30 at 21:57 +0100, Lukasz Lenart wrote:

 Hi,
 
 I've tested with apps/blank and it works as expected, the same with an
 app created base on struts2-archetype-blank (mvn archetype:generate -
 307) and base on struts2-archetype-convention (308). No problems
 spotted :-)
 
 
 Kind regards




Issue with maven archetypes - jetty plugin version 8 not refreshing JSPs

2012-10-29 Thread Miguel Almeida
Dear all,

As I was upgrading the maven jetty plugin in a struts archetype, I
noticed a difference in behaviour between versions 6 and 8 of the
plugin. While this might be due to a change in jetty's configuration, I
thought we should check this and probably update the archetypes
accordingly.

Essentially, with version 6, changes in a JSP are automatically seen
(without redeployment) by refreshing the broswer. In version 8, you need
to redeploy the jetty container to see the changes.

Steps to replicate (in either an IDE or command line):

1) Create a maven project with the struts2-blank-archetype 
2) Edit the pom.xml file so the plugin section matches [1]
3) Run the jetty:run maven goal.
4) Open the browser and see the welcome page
5) Edit the file /src/main/webapp/WEB-INF/content/hello.jsp
6) Refresh the browser. You should see the changes immediately

7) Repeat 1-6, but update the plugin section in 2 to the contents listed
below [2]

Expected: Same result as before
Actual: You no longer see the jsp changes upon refreshing the bowser.
You need to restart jetty!


[1] - Version 6 of the plugin. The scantarget element was removed
because we don't want  a complete server redeployment when we just
change a JSP.
plugin

groupIdorg.mortbay.jetty/groupId
artifactIdmaven-jetty-plugin/artifactId
version6.1.21/version
configuration
scanIntervalSeconds10/scanIntervalSeconds
/configuration
/plugin

[2] - Version 8 of the plugin. Exact same configuration (except for the 
artifact's name and version)
plugin
groupIdorg.mortbay.jetty/groupId
 artifactIdjetty-maven-plugin/artifactId
 version8.1.7.v20120910/version
configuration
scanIntervalSeconds10/scanIntervalSeconds
/configuration
/plugin


Does anyone know what configuration change is needed so you get the same 
behaviour as before?

Miguel Almeida


Re: Can we use the decorator pattern in Actions?

2012-10-03 Thread Miguel Almeida
I was speaking with Lukasz today about this, so I'm resurrecting this
old thread.

The underlying question in my (rather extensive) post is:

How can you perform the following decorator pattern:

public OriginalAction implements Preparable,
SessionAware,OriginalActionInterface{

  public String someFunctionality(){

  }
}

Decorate like:

public DecoratedAction implements Preparable, SessionAware,etc{
  private OriginalActionInterface originalAction; //inject
OriginalAction here
  @Secured
  public String someFunctionality(){
// do new stuff
orignalAction.someFunctionality();
  }
}

Issues:
1) Your OriginalAction will probably rely on some objects injected by
struts (eg: session will probably be used). However, because
OriginalAction is now only decorating DecoratedAction...those objects
won't be automatically populated by Struts.


The only way I see it is to use Spring IoC to define these needed
objects in OriginalAction. But it would be neat if that was performed by
Struts.

What are your thoughts on this?


Miguel Almeida


 On Wed, 2012-05-16 at 11:22 +0100, Miguel Almeida wrote:

 Imagine the scenario where you have security implemented at the action
 method level with an annotation:
 
 @Secured(someRole) restricts that action to that role (and it is
 checked with an interceptor).
 
 Discussing this on the TDD mailing list a while back, a decorator
 approach was suggested
 
 To separate concerns and ease up testing, authorization is implemented
 as a decorator (a-la GoF decorator pattern) adding authorization to the
 underlying (decorated) MVC app. 
 
 The technique to getting there (see pseudo code in [1])
 1. Extract an interface from your main class with all the public methods
 2. Implement a decorator which adds authorization rules to a decorated
 underlying object. The decorator implements the authorization rules
 using annotations
 3. in your tests, test the decorator providing a mock underlying
 decorated object, asserting in each test that given a request with a
 user that has certain roles the underlying method should or should not
 be called.
 
 
 As you see, tests would have a simple setup as you wouldn't be calling
 the real, possible complicated action code, but the fake decorated
 one. 
 The problem arises when you have superclasses (and maybe also when you
 implement interfaces). I exemplify with both.
 
 Imagine this:
 RealAction extends CommonAction implements IAction(){
 ...}
 
 CommonAction implements ServletRequestAware(){
 ...
 }
 
 AuthorizingDecorator implements IAction(){
 //injected decorated IAction, see [1]
 ...
 }
 
 Now, on a regular RealAction implementation, the request object exists:
 RealAction extends CommonAction, so the request is injected through its
 ServletRequestAware.
 If you're using the AuthorizingDecorator, however, the request will be
 null: RealAction will be injected, so Struts won't kick in to populate
 RealAction's request object.
 
 
 My question is: how would you go on and solve this? Or is the decorator
 approach impractical in Struts? I haven't even consider the necessity to
 implement every getter/setter on the IAction, which would also make this
 approach a bit cumbersome. The simplicity for testing, however, is
 great!
 
 Cheers,
 
 Miguel Almeida
 
 
 [1] The code might end up like this (semi-pseudo code)
 
 Tests:
 
 test_admin_can_call_method_a()
 
 {
 // setup a fake request with admin role:
 httpRequest = buildRequestWithRole(admin);
 
 // setup a mock app decorated with an authorzation decorator:
 MockApp app = new MockApp();
 AuthorizationDecorator authorizer = new
 AuthorizationDecorator(app);
 
 // act - try calling method A in the decorator:
 authorizer.MethodA(httpRequest);
 
 // assert - underlaying method a should have been called:
 Assert(app.MethodA.WasCalled==true);
 
 }
 
 test_regularUser_cannot_call_method_a()
 {
 
 // setup a fake request with regular user role:
 httpRequest = buildRequestWithRole(regular user);
 
 // setup a mock app decorated with an authorzation decorator:
 MockApp app = new MockApp();
 AuthorizationDecorator authorizer = new
 AuthorizationDecorator(app);
 
 // act - try calling method A in the decorator:
 authorizer.MethodA(httpRequest);
 
 // assert - underlaying method a should not have been called:
 Assert(app.MethodA.WasCalled==false);
 
 }
 
 In the SUT:
 
 interface IAction
 {
 
 String MethodA()
 String MethodB()
 ...
 
 }
 
 // this is the real action implementing methodA, methodB etc
 class RealAction: IAction
 {
 
 String MethodA()
 String MethodB()
 ...
 
 }
 
 // this is responsible for authorization
 class AuthorizingDecoratorAction : IAction
 {
 
 private IAction _decorated;
 public

RE: Type conversion on a Map

2012-09-21 Thread Miguel Almeida
On Fri, 2012-09-21 at 09:04 -0400, Martin Gainty wrote:

 a stupid question but i have to ask

If you mean where is the initialisation of simpleMap e.g. simpleMap=new
java.util.HashMap(); - it's not there. I don't think you need to,
Struts initializes it. (see below)

 
 public class TypeConversionAction extends ActionSupport 
 {
 private MapEntity, String simpleMap;   //where is the initialisation of 
 simpleMap e.g. simpleMap=new java.util.HashMap();
 public MapEntity, String getSimpleMap()  { return simpleMap;  }
 public void setSimpleMap(MapEntity, String simpleMap) {   
 this.simpleMap = simpleMap; }
 public String execute() {  return SUCCESS; }
 }
 
 //then the test-harness:
 
 package test.example;
 import java.util.Map;
 import org.apache.struts2.StrutsTestCase;
 import org.junit.Test;
 import com.opensymphony.xwork2.ActionProxy;
 import com.opensymphony.xwork2.ActionSupport;
 
 public class TypeConversionTest extends StrutsTestCase 
 {
 private ActionProxy actionProxy;
 private ActionSupport action;
 
 @Test
 public void test() throws Exception{
 Entity entity = new Entity();
 entity.setId(1);
 super.setUp();
 
 request.setParameter(simpleMap[1], value);
 createAction(/example/Convesion.action);
 executeProxy();
 
 MapEntity, String complexMap = ((TypeConversionAction) 
 action).getSimpleMap();
 assertNotNull(complexMap);   //getSimpleMap is NULL in the Action so it 
 would always be NULL here

No. The test fails below, not here. executeProxy executed the action and
initialized the map. If you run the test you'll see it fails on the last
assertEquals, not here.

 
 assertFalse(complexMap.isEmpty());  //FAIL it is empty
 assertEquals(value, complexMap.get(entity)); //Never initialised so 
 this would fail as well

This is where it is failing. Not because it hasn't been initialized, but
because it doesn't have that key.

Miguel Almeida


Type conversion on a Map

2012-09-20 Thread Miguel Almeida
Dear all,

Considering:
1) the action property MapCodeProperty, String complexMap;
2) CodeProperty has an int id property

How would you configure type conversion and refer to it on the JSP to
populate it?

I am currently trying the following -conversion configuration:
KeyProperty_complexMap=id
Element_complexMap=java.lang.String
Key_complexMap=persist.model.CodeProperty
CreateIfNull_complexMap=true


However, a simple jUnit test where I populate the request with
getRequest().setParameter(complexMap[ + String.valueOf(33) +
],test) doesn't populate the map as expected.

Is the -conversion file wrong, the parameter set in the unit test, or
both?

Cheers,

Miguel Almeida


OGNL error in log - Error setting expression

2012-07-27 Thread Miguel Almeida
I noticed some OGNL warnings in my log that I show below [1].
User scenario:
1) go to form. no warnings
2) submit form - page is reloaded. warnings appear.

The warning is for property which is being used on a key: s:submit
key=geral.save /. The key is defined in globalmessages.properties.

It seems the question of whether or not these warnings should appear has
been discussed in the mailing list before. What I couldn't find is this:
should there even be a warning in this case, given that the property
should be searched for in the i18n resources and not the action?


Thank you,

Miguel Almeida

[1]
2012-07-27 18:28:12,879 WARN  [CommonsLogger.java:60] : Error setting
expression 'geral.save' with value '[Ljava.lang.String;@5b36cbd0'
ognl.OgnlException: target is null for setProperty(null, save,
[Ljava.lang.String;@5b36cbd0)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2309)
at ognl.ASTProperty.setValueBody(ASTProperty.java:127)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
at ognl.SimpleNode.setValue(SimpleNode.java:301)
at ognl.ASTChain.setValueBody(ASTChain.java:227)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
at ognl.SimpleNode.setValue(SimpleNode.java:301)
at ognl.Ognl.setValue(Ognl.java:737)
at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:217)
at
com.opensymphony.xwork2.ognl.OgnlValueStack.trySetValue(OgnlValueStack.java:186)
at
com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:173)
at
com.opensymphony.xwork2.ognl.OgnlValueStack.setParameter(OgnlValueStack.java:151)
at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:292)
at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:203)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at
org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:90)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
at
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:192)
at
com.opensymphony.xwork2

Re: OGNL error in log - Error setting expression

2012-07-27 Thread Miguel Almeida
Answering my own question: apparently you need to define a name property
for the submit tag.

Thanks to http://www.coderanch.com/t/487063/Struts/Internationalization


Miguel 

On Fri, 2012-07-27 at 18:33 +0100, Miguel Almeida wrote:

 I noticed some OGNL warnings in my log that I show below [1].
 User scenario:
 1) go to form. no warnings
 2) submit form - page is reloaded. warnings appear.
 
 The warning is for property which is being used on a key: s:submit
 key=geral.save /. The key is defined in globalmessages.properties.
 
 It seems the question of whether or not these warnings should appear has
 been discussed in the mailing list before. What I couldn't find is this:
 should there even be a warning in this case, given that the property
 should be searched for in the i18n resources and not the action?
 
 
 Thank you,
 
 Miguel Almeida
 
 [1]
 2012-07-27 18:28:12,879 WARN  [CommonsLogger.java:60] : Error setting
 expression 'geral.save' with value '[Ljava.lang.String;@5b36cbd0'
 ognl.OgnlException: target is null for setProperty(null, save,
 [Ljava.lang.String;@5b36cbd0)
   at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2309)
   at ognl.ASTProperty.setValueBody(ASTProperty.java:127)
   at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
   at ognl.SimpleNode.setValue(SimpleNode.java:301)
   at ognl.ASTChain.setValueBody(ASTChain.java:227)
   at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220)
   at ognl.SimpleNode.setValue(SimpleNode.java:301)
   at ognl.Ognl.setValue(Ognl.java:737)
   at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:217)
   at
 com.opensymphony.xwork2.ognl.OgnlValueStack.trySetValue(OgnlValueStack.java:186)
   at
 com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:173)
   at
 com.opensymphony.xwork2.ognl.OgnlValueStack.setParameter(OgnlValueStack.java:151)
   at
 com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:292)
   at
 com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:203)
   at
 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
   at
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
   at
 com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211)
   at
 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
   at
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
   at
 com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
   at
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
   at
 org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
   at
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
   at
 org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:90)
   at
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
   at
 org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
   at
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
   at
 com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
   at
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
   at
 com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
   at
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
   at
 org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
   at
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
   at
 com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
   at
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
   at
 com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
   at
 com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
   at
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
   at
 com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
   at
 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
   at
 org.apache.struts2.interceptor.ServletConfigInterceptor.intercept

Re: some issues upgrade struts from 2.2.3 to 2.3.4

2012-07-18 Thread Miguel
Also  REST doesn't work in 2.3.3 and 2.3.4. Not even the rest-showcase war.


Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino


On Sun, Jul 15, 2012 at 12:46 PM, ekstse eks...@gmail.com wrote:
 sorry that i do not aware that attachment is not valid  sorry about
 that

 i give more details on my test case:

 - i deployed 2 portlets into the container, one with struts-2.2.3-portlet,
 another is struts-2.3.4-portlet, it uses respective version of struts jar
 (i.e. struts2-convention-plugin,  struts2-core,
 struts2-portlet-plugin, struts2-spring-plugin
 and xwork-core)
 - each portlet have 2 methods, 2 views. called action1 and action2 method
 and view1 and view2.jsp
 - view1.jsp have a s:a action=action2link2/s:a, similar for view2.jsp.

 So, the only difference is the jar. Then test it:

 - both struts-2.2.3-portlet and struts-2.3.4-portlet can display the first
 page at initial load.
 - when i click link2 in struts-2.2.3-portlet, it load view2.jsp
 sucessfully.
 - when i click link2 in struts-2.3.4-portlet, it shows error that
 actions2.action not found (the default .action appended as suffix although
 the configuration file set it to empty string.

 Then, i put a , as the configuration value and change the dtd definition
 of struts.xml from 2.0 to 2.3 and restart the test again.

 - struts-2.2.3-portlet still works as expected.
 - but struts-2.3.4-portlet still have error,

 10:09:16,404 ERROR [jsp:154] Unable to locate action mapping for
 request, probably due to an invalid action path:
 /demoAbc/demoAbc/view/action2 - [unknown location]

 For full stack trace, please refer to my previous mail

 Folks, any hint ??


 On Sun, Jul 15, 2012 at 6:17 PM, ekstse eks...@gmail.com wrote:

 Dear Lukasz,

 Thanks for your help first…

 I have put all details in here…. please search  to see what action i
 have done below. see if you can help further… :) Please see the attached
 zip also.

 Thanks,
 Eric



 ===


  Logs

 Action1

 Action1

  click 2.2.3 go to link 2

 Action2

 Action1

  click 2.3.4 go to link 2 (error, due to extension setting)

 Action2

 10:04:22,834 ERROR [Jsr168Dispatcher:38] Could not find action

 There is no Action mapped for action name action2.action. - [unknown
 location]

 at com.opensymphony.xwork2.DefaultActionProxy.prepare(
 DefaultActionProxy.java:185)

 at org.apache.struts2.impl.StrutsActionProxy.prepare(
 StrutsActionProxy.java:63)

 at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(
 StrutsActionProxyFactory.java:39)

 at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(
 DefaultActionProxyFactory.java:58)

 at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(
 DefaultActionProxyFactory.java:47)

 at org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher.serviceAction(
 Jsr168Dispatcher.java:464)

 at org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher.render(
 Jsr168Dispatcher.java:332)

 at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:101)

 at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(
 PortletFilterUtil.java:64)

 at com.liferay.portal.kernel.servlet.PortletServlet.service(
 PortletServlet.java:92)

 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

 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.ApplicationDispatcher.invoke(
 ApplicationDispatcher.java:646)

 at org.apache.catalina.core.ApplicationDispatcher.doInclude(
 ApplicationDispatcher.java:551)

 at org.apache.catalina.core.ApplicationDispatcher.include(
 ApplicationDispatcher.java:488)

 at com.liferay.portlet.InvokerPortletImpl.invoke(
 InvokerPortletImpl.java:638)

 at com.liferay.portlet.InvokerPortletImpl.invokeRender(
 InvokerPortletImpl.java:723)

 at com.liferay.portlet.InvokerPortletImpl.render(
 InvokerPortletImpl.java:425)

 at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(Unknown
 Source)

 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

 at org.apache.jasper.servlet.JspServletWrapper.service(
 JspServletWrapper.java:377)

 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313
 )

 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)

 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

 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.ApplicationDispatcher.invoke(
 ApplicationDispatcher.java:646)

 at org.apache.catalina.core.ApplicationDispatcher.doInclude(
 ApplicationDispatcher.java:551

Re: Performance issue with nested iterator

2012-07-05 Thread Miguel Almeida
Sure, Lukas:

https://github.com/mmalmeida/struts-performance



On Thu, 2012-07-05 at 06:48 +0200, Lukasz Lenart wrote:

 Could you post somewhere (GitHub) the whole code base ?
 
 
 Regards




Re: Performance issue with nested iterator

2012-07-05 Thread Miguel Almeida
Sorry, I sent the email before explaining.

The repo has a maven project that I stripped down to the most basic to
show the issue. Notice the iterator in index.jsp.

I tried to remove every unused configuration, file and dependency to
make the project as simple as possible.

The original project is using tiles, so I kept it there. However, I
don't think it's being used in the web workflow I created (which just
goes to index.jsp).

Is there anything there that might explain this slowness?

Cheers,

Miguel Almeida

On Thu, 2012-07-05 at 13:05 +0100, Miguel Almeida wrote:

 Sure, Lukas:
 
 https://github.com/mmalmeida/struts-performance
 
 
 
 On Thu, 2012-07-05 at 06:48 +0200, Lukasz Lenart wrote:
 
  Could you post somewhere (GitHub) the whole code base ?
  
  
  Regards
 
 




Re: Performance issue with nested iterator

2012-07-05 Thread Miguel Almeida
I believe I've found the culprit.
While the problem is present in commit
https://github.com/mmalmeida/struts-performance/commit/aba93098174c8c8c1684ffdd9bf332b212a893a
 , it's not present in the latest commit if you turn devMode to false. 

The issue was the freemarker version 2.3.9 in that commit. Updating to
2.3.19 makes performance normal again (the complete project needed
freemarker, hence the direct dependency reference in the pom).

While I don't know what changed between these freemarker versions,
apparently the problem was there.

Miguel Almeida

On Thu, 2012-07-05 at 13:16 +0100, Miguel Almeida wrote:

 Sorry, I sent the email before explaining.
 
 The repo has a maven project that I stripped down to the most basic to
 show the issue. Notice the iterator in index.jsp.
 
 I tried to remove every unused configuration, file and dependency to
 make the project as simple as possible.
 
 The original project is using tiles, so I kept it there. However, I
 don't think it's being used in the web workflow I created (which just
 goes to index.jsp).
 
 Is there anything there that might explain this slowness?
 
 Cheers,
 
 Miguel Almeida
 
 On Thu, 2012-07-05 at 13:05 +0100, Miguel Almeida wrote:
 
  Sure, Lukas:
  
  https://github.com/mmalmeida/struts-performance
  
  
  
  On Thu, 2012-07-05 at 06:48 +0200, Lukasz Lenart wrote:
  
   Could you post somewhere (GitHub) the whole code base ?
   
   
   Regards
  
  
 
 




Re: data injection attack

2012-07-04 Thread Miguel Almeida
Lukas: that's not always viable though. You might need a setter for your
model object elsewhere, but don't want that action to set that property.



On Wed, 2012-07-04 at 14:57 +0200, Lukasz Lenart wrote:

 By removing setter for it ?
 
 
 Regards
 




Performance issue with nested iterator

2012-07-04 Thread Miguel Almeida
Dear all,

I have got a performance issue on a nested iterator, running Struts
2.3.1.1.

Consider the code below, (the example is a Book with chapters and
subchapters and we're displaying the book index -  bookIndex is a
MapChapter,ListSubchapter.

This takes several seconds to load (map has size 10, each list is no
more than 15 items). I tried a lot of different approaches (mainly
regarding the database). However, what really surprised me was the
contents of the innermost td (6th row from the end): if I replace the
s:a with anything else (a xx, or just an axx/a) the page will load
much faster (ie, page load drops from 8 to 2 seconds).

Looking at http://struts.apache.org/2.x/docs/performance-tuning.html, I
double checked the OGNL version loaded in maven and indeed I have 3.0.3.

Is there any obvious reason why I'm getting such a slow performance?

Thanks for the input!

Miguel Almeida


Example code:

s:iterator value=%{#bookIndex} status=row var=chapterIndex
s:set var=chapter value=%{#bookIndex.key}/
s:set var=subchapters value=%{#chapterIndex.value}/
br
s:url id=url action=chapterloadPage
s:param name=page${chapter.firstPage}/s:param
/s:url
s:a href=%{url}${chapter.name}/s:a
table
s:iterator value=%{#subchapters} status=ind 
var=subchapter  
s:url id=url 
action=chapterloadPage
s:param name=pages:property
value=%{#subchapter.page}//s:param
/s:url
tr
td 
s:a 
href=%{url}s:property
value=%{#subchapter.title}//s:a
/td
/tr
/s:iterator
/table
/s:iterator


Can you define variables as the value in struts.properties?

2012-06-18 Thread Miguel Almeida
Lets say I have the following files in my app:

- app-DEV.properties
- app-PROD.properties
- app-TEST.properties

I use Spring's jee:jndi-lookup and PropertyPlaceholderconfigurer (see
[1]) to achieve a multi-environment setup. All files are in the
classpath, but because on each environment I set the capitalized part
differently (eg: IDE has an environment variable defined to DEV, while
the production container has it set to PROD) only one file is loaded,
setting up Spring configuration correctly.

Enter Struts: I wanted to take advantage of these existing properties
further to the UI level.
Eg: 
1) have a jsp with s:text name=app.client/
2) have in your struts.properties the entry
struts.custom.i18n.resources=a,...,environments/app-DEV
3) if you have app.client on the file app-DEV.properties, set to FOO,
you'll see it on the web page

Question: Having multiple environments files, what I really need is
struts.custom.i18n.resources=environments/app-${envName}. Can one have
this, so only the file that makes sense for that environment is loaded?

[1] https://gist.github.com/2948672

Cheers,

Miguel Almeida







Re: Using Spring proxied Session Beans with the ExecAndWaitInterceptor

2012-05-16 Thread Miguel Almeida
Regarding this issue - and considering any interceptor, not just the
ExecAndWaitInterceptor:

1) My issue was, in fact, that I was accessing the request/session
scoped bean in my init method. The init method was being called at app
startup, where no such context exists
2) If we remove that access, you can use the request/session scoped
bean.
3) You can also get the meaning with Spring's ApplicationContext inside
the intercept() method, with the call context.getBean(myBean);

As me and Lukasz were discussing this, we realised the init() method of
the interceptor is only being called at app startup - even if you define
it with, say, a prototype scope in spring. This means that apparently
Struts disregards spring's scope for interceptors, which has thread
safety implications (and you might be better off using the approach in
3) ).


Miguel

On Tue, 2012-05-15 at 09:00 +0200, Łukasz Lenart wrote:

 What I mean is that injecting something in ExecAndWaitInterceptor
 which has brought scope can rise concurrency issue because the same
 bean can be used in two different threads (ExecAndWaitInterceptor
 thread and request thread). I would rather pack whatever is needed by
 ExecAndWaitInterceptor and pass to it as a value object and inject
 just stateless services.
 
 That's what I mean by repackaging - to have my own context (a map of
 values, a value bean, etc) that will be passed to
 ExecAndWaitInterceptor and used by it in separation from other
 threads.
 
 And interceptors are singletons per package (package/ tag in
 struts.xml) and even worst ExecAndWaitInterceptor creates its own
 thread ;-)
 
 
 Regards




Can we use the decorator pattern in Actions?

2012-05-16 Thread Miguel Almeida
Imagine the scenario where you have security implemented at the action
method level with an annotation:

@Secured(someRole) restricts that action to that role (and it is
checked with an interceptor).

Discussing this on the TDD mailing list a while back, a decorator
approach was suggested

To separate concerns and ease up testing, authorization is implemented
as a decorator (a-la GoF decorator pattern) adding authorization to the
underlying (decorated) MVC app. 

The technique to getting there (see pseudo code in [1])
1. Extract an interface from your main class with all the public methods
2. Implement a decorator which adds authorization rules to a decorated
underlying object. The decorator implements the authorization rules
using annotations
3. in your tests, test the decorator providing a mock underlying
decorated object, asserting in each test that given a request with a
user that has certain roles the underlying method should or should not
be called.


As you see, tests would have a simple setup as you wouldn't be calling
the real, possible complicated action code, but the fake decorated
one. 
The problem arises when you have superclasses (and maybe also when you
implement interfaces). I exemplify with both.

Imagine this:
RealAction extends CommonAction implements IAction(){
...}

CommonAction implements ServletRequestAware(){
...
}

AuthorizingDecorator implements IAction(){
//injected decorated IAction, see [1]
...
}

Now, on a regular RealAction implementation, the request object exists:
RealAction extends CommonAction, so the request is injected through its
ServletRequestAware.
If you're using the AuthorizingDecorator, however, the request will be
null: RealAction will be injected, so Struts won't kick in to populate
RealAction's request object.


My question is: how would you go on and solve this? Or is the decorator
approach impractical in Struts? I haven't even consider the necessity to
implement every getter/setter on the IAction, which would also make this
approach a bit cumbersome. The simplicity for testing, however, is
great!

Cheers,

Miguel Almeida


[1] The code might end up like this (semi-pseudo code)

Tests:

test_admin_can_call_method_a()

{
// setup a fake request with admin role:
httpRequest = buildRequestWithRole(admin);

// setup a mock app decorated with an authorzation decorator:
MockApp app = new MockApp();
AuthorizationDecorator authorizer = new
AuthorizationDecorator(app);

// act - try calling method A in the decorator:
authorizer.MethodA(httpRequest);

// assert - underlaying method a should have been called:
Assert(app.MethodA.WasCalled==true);

}

test_regularUser_cannot_call_method_a()
{

// setup a fake request with regular user role:
httpRequest = buildRequestWithRole(regular user);

// setup a mock app decorated with an authorzation decorator:
MockApp app = new MockApp();
AuthorizationDecorator authorizer = new
AuthorizationDecorator(app);

// act - try calling method A in the decorator:
authorizer.MethodA(httpRequest);

// assert - underlaying method a should not have been called:
Assert(app.MethodA.WasCalled==false);

}

In the SUT:

interface IAction
{

String MethodA()
String MethodB()
...

}

// this is the real action implementing methodA, methodB etc
class RealAction: IAction
{

String MethodA()
String MethodB()
...

}

// this is responsible for authorization
class AuthorizingDecoratorAction : IAction
{

private IAction _decorated;
public AuthorizationDecorator(IAction decorated)
{
_decorated = decorated;
}

// each method is implemented using annotations and calling the
underlying decorated object
@SecuredRoles(admin, manager)
public void MethodA()
{
_decorated.MethodA();
}

@SecuredRoles(regular user)
public void MethodB()
{
_decorated.MethodB();
}

}


Does the StrutsTestCase test filters defined in web.xml?

2012-05-14 Thread Miguel Almeida
Dear all,

I am using StrutsSpringTestCase (which extends StrutsTestCase) to
perform some acceptance tests (under the skin). I am also using
Displaytag (www.displaytag.org/1.2/ ) to build some tables in the view.
This tag supports excel/pdf export, which uses a filter you configure in
web.xml [1]

The way the filter works is, in short: a (odd looking, numerical)
parameter is added to the request. The filter checks for the existence
of that parameter and, if it exists, creates the pdf/excel. 

I want to test the creation of this file (and its contents). However,
when I debug the StrutsSpringTestCase test with a breakpoint on that
filter it does not stop there, so my questions are:

1) Does the StrutsTestCase not pass through other filters in your
web.xml, and only goes through the struts filter?
2) If so, is there anything else in the struts tests that could help me
out? How do you suggest I perform this test?
 
Thank you,

Miguel Almeida



[1]- see http://www.displaytag.org/1.2/export_filter.html 


RE: Does the StrutsTestCase test filters defined in web.xml?

2012-05-14 Thread Miguel Almeida
Hi Steve, 

On Mon, 2012-05-14 at 11:09 +0100, Steve Higham wrote:

 Hi Miguel,
 
 I haven't used the StrutsSpringTestCase however I have made use of the 
 StrutsTestCase.
 
 This only tests the interceptor stack / Action / Result. There is no web 
 server involved and no attempt to render the resulting page.

Yes, that's what I thought. 

 You could try looking at Apache Cactus or Apache HttpClient to test this 
 behaviour? Alternatively if you generate the file within Struts then the 
 StrutsTestCase will suffice. I've generated exports from Struts this way.
 

Both are no longer maintained (I guess httpclient got replaced with
Apache http components (http://hc.apache.org/ ) but I haven't explored
this yet. 

For this case (testing the pdf output created by the displaytag) I don't
think it'll be worth it to invest in a new testing setup: this is the
only thing that is produced outside the scope of struts and a manual
inspection might suffice.

However, I do want to explore other tools that are available to test the
http request/response, so I'll look into this further.

Cheers,

Miguel Almeida

 Cheers,
 
 Steve
 
 -Original Message-
 From: Miguel Almeida [mailto:mig...@almeida.at] 
 Sent: 14 May 2012 10:16
 To: user@struts.apache.org
 Subject: Does the StrutsTestCase test filters defined in web.xml?
 
 Dear all,
 
 I am using StrutsSpringTestCase (which extends StrutsTestCase) to perform 
 some acceptance tests (under the skin). I am also using Displaytag 
 (www.displaytag.org/1.2/ ) to build some tables in the view.
 This tag supports excel/pdf export, which uses a filter you configure in 
 web.xml [1]
 
 The way the filter works is, in short: a (odd looking, numerical) parameter 
 is added to the request. The filter checks for the existence of that 
 parameter and, if it exists, creates the pdf/excel. 
 
 I want to test the creation of this file (and its contents). However, when I 
 debug the StrutsSpringTestCase test with a breakpoint on that filter it does 
 not stop there, so my questions are:
 
 1) Does the StrutsTestCase not pass through other filters in your web.xml, 
 and only goes through the struts filter?
 2) If so, is there anything else in the struts tests that could help me out? 
 How do you suggest I perform this test?
  
 Thank you,
 
 Miguel Almeida
 
 
 
 [1]- see http://www.displaytag.org/1.2/export_filter.html 
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 




Re: Using Spring proxied Session Beans with the ExecAndWaitInterceptor

2012-05-14 Thread Miguel Almeida
Following up on your suggestion, Lukasz: is concurrency an issue even if 
you scope the interceptor itself as prototype (or request) ?


I was under the impression you could scope the interceptors like this 
(removing concurrency issues), but actually the previous issue makes me 
wonder if they're singleton (in spring beans terms) to the entire 
application.


As for the repackaging you suggest, I'm not sure I follow your 
suggestion. Do you mean getting the ActionContext in the interceptor to 
get to the HttpSession and HttpRequest and populate the variable from there?
I ask you this due to the motivation behind the request scoped bean in 
my case: I basically want to populate it in an interceptor so it is 
available elsewhere (on an hibernate interceptor/event listener - don't 
let the name trick you, this has nothing to do with Struts interceptors. 
It also doesn't know anything about http sessions or requests and should 
really be http agnostic).

Could you clear me up on you meant by your approach?

Thanks,

Miguel Almeida

On 05/14/2012 08:11 PM, Łukasz Lenart wrote:

I think it's better to repackage what you need and pass as a context
variables instead inject session aware beans. It can produce
concurrency issues.


Regards



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



Re: Testing with StrutsTestCase in a Tiles application - NullPointerException

2012-01-30 Thread Miguel Almeida
For future reference, I found the answer in
http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing-struts-2-actions-spring-junit/

Basically, you need to initialize the tiles listener. As I already used
setupBeforeInitDispatcher to set the applicationContext attribute, I
added the code there (inside the if(tilesApplication) segment):

/** Overrides the previous in order to skip applicationContext
assignment: context is @autowired
 * @see
org.apache.struts2.StrutsSpringTestCase#setupBeforeInitDispatcher()
 **/
@Override
protected void setupBeforeInitDispatcher() throws Exception {
//init context


servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
 applicationContext);

if(tilesApplication){

servletContext.addInitParameter(BasicTilesContainer.DEFINITIONS_CONFIG,
WEB-INF/tiles.xml);
final StrutsTilesListener tilesListener = new
StrutsTilesListener();
final ServletContextEvent event = new
ServletContextEvent(servletContext);
tilesListener.contextInitialized(event);
}

}

Miguel Almeida


On Fri, 2012-01-27 at 17:35 +, Miguel Almeida wrote:

 Hi there,
 
 I trying to test an application with the help of StrutsTestCase (a class
 that extends from StrutsSpringTestCase, to be more precise).
 StrutsTestCase (which is in the struts junit plugin) involves proxied
 actions to make tests more light.
 
 I have used the same method in another application that doesn't have
 tiles successfully. Here, however, I am running into an exception when
 running the actionProxy.execute() :
 
 
 java.lang.NullPointerException
   at
 org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
   at
 org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
 
 
 I found a user that described the problem very well on stackOverflow:
 http://stackoverflow.com/questions/5823709/npe-in-strutstestcase-after-enabling-tiles
 
 There is also a 2008 question on the mailing list
 (http://www.mail-archive.com/user@struts.apache.org/msg77582.html ).
 Petrelli tried to answer, but no solution was posted.
 
 From these resources, do you know what the problem might be and if it is
 possible to use StrutsTestCase to test an application that has Tiles
 enabled through the StrutsTilesListener?
 
 
 Cheers,
 
 Miguel Almeida
 




Testing with StrutsTestCase in a Tiles application - NullPointerException

2012-01-27 Thread Miguel Almeida
Hi there,

I trying to test an application with the help of StrutsTestCase (a class
that extends from StrutsSpringTestCase, to be more precise).
StrutsTestCase (which is in the struts junit plugin) involves proxied
actions to make tests more light.

I have used the same method in another application that doesn't have
tiles successfully. Here, however, I am running into an exception when
running the actionProxy.execute() :


java.lang.NullPointerException
at
org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
at
org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)


I found a user that described the problem very well on stackOverflow:
http://stackoverflow.com/questions/5823709/npe-in-strutstestcase-after-enabling-tiles

There is also a 2008 question on the mailing list
(http://www.mail-archive.com/user@struts.apache.org/msg77582.html ).
Petrelli tried to answer, but no solution was posted.

From these resources, do you know what the problem might be and if it is
possible to use StrutsTestCase to test an application that has Tiles
enabled through the StrutsTilesListener?


Cheers,

Miguel Almeida



Maven archetypes not working?

2012-01-20 Thread Miguel Almeida
Hi,

I added the http://struts.apache.org/ Archetype catalog to my maven
(actually, in Eclipse) but I haven't been able to create a new project
with any of the archetypes provided:
I get the error:

Unable to create project from archetype
[org.apache.struts:struts2-archetype-starter:2.3.1.1 -
https://repository.apache.org/content/groups/public/]
The defined artifact is not an archetype

While I've just added the catalog to my workspace, I have used maven
archetypes before. Is there something not working with the archetypes at
the moment?

Cheers,

Miguel Almeida


Message lookup (from key) in Test

2011-11-16 Thread Miguel Almeida
Dear all,

I am unit-testing an application under the skin using
SpringStrutsTestCase as base (actually, things are a bit more
complicated because I'm doing it from Cucumber, but that's another
story).

How do you get the value of your message from within the test? The
assertion I'm trying is:

assertEquals(expectedMessage,
action.getActionErrors().iterator().next());

But actionErrors() contains the key (error.authorisation) and not the
value (you cannot do this). What's the cleanest way to retrieve the
value from the test?


Cheers,

Miguel Almeida


Re: Can Struts Junit plugin be used to test the redirect result of an action

2011-09-24 Thread miguel

On Thu, 2011-09-22 at 10:23 +0200, Maurizio Cucchiara wrote:

 The reason behind is simple: no browser no redirect.
 The redirect is sent as http header, so as long as there is no browser
 to interpret the header there is no way to redirect.
 
 You might call by yourself the second action, WDYT?
 
 PS: FWIW I have not read the optional reading :)
 

Yeah, I tried that, but to no success: I can't replicate the error I
wanted to (see the optional reading :P). Long story short, in my
application, when I have a redirect result, the 2nd action doesn't
retrieve the correct results from the database unless I pause its
execution for a second. Weird. Very. 



 Maurizio Cucchiara
 
 
 
 On 21 September 2011 17:25, Miguel Almeida mig...@almeida.at wrote:
  I am using the Struts Junit plugin
  (http://struts.apache.org/2.2.3.1/docs/struts-2-junit-plugin-tutorial.html 
  ), extending the StrutsSpringTestCase for a regression test of an action in 
  my application.
 
  (Optional reading:
  Long story short on the problem, the action adds a record to a database
  via hibernate. The result is a redirect to execute() of the same class,
  whose prepare() populates a ListRecord object with all the records
  available. For some reason, the prepare fires as it should, but returns
  the old number of items. Only a refresh shows the page with the correct
  results. For an odd reason, sleeping the thread before calling the dao's
  code that retrieves the list for 1 second also makes the result to be
  correctly updated.)
 
  The action result is a redirectAction, that, well, redirects to another
  action. The test doesn't call this second method, though.
  Is it possible with this base test case to make it call the 2nd action?
 
 
  Regards,
 
  Miguel Almeida
 
 
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 


Can Struts Junit plugin be used to test the redirect result of an action

2011-09-21 Thread Miguel Almeida
I am using the Struts Junit plugin
(http://struts.apache.org/2.2.3.1/docs/struts-2-junit-plugin-tutorial.html ), 
extending the StrutsSpringTestCase for a regression test of an action in my 
application.

(Optional reading: 
Long story short on the problem, the action adds a record to a database
via hibernate. The result is a redirect to execute() of the same class,
whose prepare() populates a ListRecord object with all the records
available. For some reason, the prepare fires as it should, but returns
the old number of items. Only a refresh shows the page with the correct
results. For an odd reason, sleeping the thread before calling the dao's
code that retrieves the list for 1 second also makes the result to be
correctly updated.)

The action result is a redirectAction, that, well, redirects to another
action. The test doesn't call this second method, though.
Is it possible with this base test case to make it call the 2nd action?


Regards,

Miguel Almeida




Re: Unit Test Struts2 Action - Custom type converters not being run?

2011-09-21 Thread Miguel Almeida
On Wed, 2011-09-21 at 17:55 +0200, Carl Ballantyne wrote:


 How can I try the nightly build if using Maven? I do not see it listed as an
 option.

Would be nice if Struts released SNAPSHOT versions into maven. Does it?



  Be aware that you can write your test as follow:
 
  public void testValidationRequired() throws Exception {
 request.setParameter(user.roles, );
  executeAction(/your_package/your_action.action);
 
// asserts to check errors etc..
 }
  }

Maurizio: you can't use this if you have to set objects (eg:
action.setSession(session );), does it? In my sessioned test I need:
action.setSession(session );

actionProxy.getInvocation().getInvocationContext().setSession(session);
perhaps the first could be replaced with request.setParameter() (can
it?), but I need the second - otherwise I'll have a nullpointerexception
in my action's session.get() method (because ServletConfigInterceptor's
((SessionAware) action).setSession(context.getSession()); (line 146)
will set it to null and override the action.setSession(session)
instruction)

Miguel


Re: PropertyPlaceholderConfigurer can't read file properties

2011-07-01 Thread Miguel Almeida
On Fri, 2011-07-01 at 08:46 -0500, Paul Benedict wrote:

 Can you clarify? You spoke about reloading -- are you trying to change
 property files on the fly?


Agree: as far as I know, you can't do that with
PropertyPlaceholderConfigurer.

Also agree with previous mail: this is Spring, not Struts.



Re: Multi Devices and Multilanguage

2011-06-29 Thread Miguel
Hello,
I did an interceptor that changes the return code based on the user-agent of
the client.
So there are versions for PC and mobile of each jsp. In your configuration
you need to have all the result codes for all jsp.
Example: I change the result code from browse to iPhone.browse
Stuts 2 can handle natively The international and localization stuff.

Enviado desde mi Nexus S
Miguel Ruiz Velasco Sobrino
On Jun 29, 2011 10:28 AM, Frans Thamura fr...@meruvian.org wrote:
 hi all

 we want to create a multi devices rendering for our apps, which we use
 struts2, for mobile, tablet and web common, we use jquery mobile, i like
the
 JQM beta1.

 and we also want to make web with multi language

 anyone can share the strategy which we can start to make this

 F


Re: getText on XSLT transformation on an Action

2011-06-16 Thread Miguel
Yes, if you want this, you need to create the XSLT on the fly,
You can use freemarker to achieve this. substituying the placeholders
with the appropiate text.
You can use even apache commons StringUtils if you only want to
susbtitute placeholders with fixed text.

Cheers,

Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino



On Thu, Jun 16, 2011 at 19:31, JOSE L MARTINEZ-AVIAL jlm...@gmail.com wrote:
 could you expand that? do you mean to create the XSLT on the fly?

 2011/6/16 Maurizio Cucchiara mcucchi...@apache.org

 The first solution I thought is: a template engine.
 Currently your xslt file is static, you should consider to make dynamic in
 order to include dynamic content.

 Maurizio Cucchiara

 Il giorno 16/giu/2011 19.37, JOSE L MARTINEZ-AVIAL jlm...@gmail.com ha
 scritto:
  Hi,
  I'm using Struts 2.1.8.1. I have an action that retrieves some XML data
  from a webservice, and transform it to HTML using XSLT. The
 transformation
  is done in the action, and the output is returned as a stream and sent to
  the client. It works fine, but now I need to write some labels that
 depend
  on the user's locale. Is there any way to call getText from the XSLT
  stylesheet, so it uses the action that called the transformer as the
 basis
  to look for the package with the labels in the diferent languages? It
 should
  also use the user's locale, but since it gets it from the ActionContext,
 it
  should work fine.
 
  Thanks
 
  Jose



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



Re: Adding a JNDI lookup yields unexpected Struts errors (Spring injection)

2011-06-08 Thread Miguel
Really? That's odd.

could you please try the test project at : 
https://issues.apache.org/jira/browse/WW-3647

Thanks for the help!

Enviado a partir do meu HTC

- Reply message -
De: Lukasz Lenart lukasz.len...@googlemail.com
Data: qua, Jun 8, 2011 13:42
Assunto: Adding a JNDI lookup yields unexpected Struts errors (Spring injection)
Para: Struts Users Mailing List user@struts.apache.org

It works for me ...

Hello Lukasz, today is 2011/06/08


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/


2011/6/8 Miguel mig...@almeida.at:
 Hi,

 I have created a test maven project to demonstrate the issue, based on
 struts archetype.

 To see the problem:

 1) run the maven goal jetty:run
 2) browse to http://localhost:8080
 3) Write issue on the top form and submit

 Expected:
 - The action has an if issue, return login. Login has a global
 redirectAction result to index. I'd expect the action to redirect do index,
 which in turn redirects to /jsp/index.jsp

 Actual:
 Error - Problem accessing /zzz/index!zzz.action.

 Happens when:
 1) applicationContext.xml - jee:jndi-lookup is active. If you comment this
 line and the referring  property name=wtf... , the redirect is correct.
 Notice that zzz is the default for that jndi-lookup (and we haven't
 configured jndi, so the default is being used)
 2) The login result is a redirectAction. If you change the line in
 struts.xml to, say, result name=login /jsp/index.jsp/result, the
 problem isn't visible.

 Can someone try to understand why this is happening. It might be a very
 basic problem, but I've been looking at this for hours and can't figure out
 what is wrong.

 Thank you in advance,

 Miguel Almeida

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


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



Re: Adding a JNDI lookup yields unexpected Struts errors (Spring injection)

2011-06-08 Thread Miguel
Hey Lukasz,

On Wed, 2011-06-08 at 15:40 +0200, Lukasz Lenart wrote:


 and the result
 
 Hello test, today is 2011/06/08
 ***zzz***
 

To display the problem you have to write issue in the name, not
test.
Take a look at the HelloWorldAction - the redirectAction is with login,
whose result is triggered by writing issue in the field name.

Can you try it again? You should see the error then!

Miguel


Re: Adding a JNDI lookup yields unexpected Struts errors (Spring injection)

2011-06-08 Thread Miguel
To ease inspection of the problem, I created a unit test in the JIRA
issue (https://issues.apache.org/jira/browse/WW-3647 ):

run JNDIProblemTestCase in
https://issues.apache.org/jira/secure/attachment/12481828/redirectActionErrorWithJunitTest.zip
 


On Wed, 2011-06-08 at 16:08 +0100, Miguel wrote:

 Hey Lukasz,
 
 On Wed, 2011-06-08 at 15:40 +0200, Lukasz Lenart wrote:
 
 
  and the result
  
  Hello test, today is 2011/06/08
  ***zzz***
  
 
 To display the problem you have to write issue in the name, not
 test.
 Take a look at the HelloWorldAction - the redirectAction is with login,
 whose result is triggered by writing issue in the field name.
 
 Can you try it again? You should see the error then!
 
 Miguel




Adding a JNDI lookup yields unexpected Struts errors

2011-06-07 Thread Miguel
Dear all,

I am having a strange problem and was hoping anyone knows why this is
happening.

My web app was working correctly and running in development in jetty
running with maven. I'm using Spring's to inject dependencies.

The problem arises when I add a JNDI entry. To do so I:

1) change my container configuration in Maven's pom, so that it sees
jetty-env.xml:
webAppConfig
contextPath//contextPath
jettyEnvXml${basedir}/src/main/resources/jetty/jetty-env.xml
/jettyEnvXml
/webAppConfig

2) Configure a new env-entry in the jetty-env.xml:
Configure id=myApp class=org.eclipse.jetty.webapp.WebAppContext
New class=org.eclipse.jetty.plus.jndi.EnvEntry
ArgRef id=myApp//Arg
ArgxoxoGG/Arg
Arg type=java.lang.StringAAA/Arg
Arg type=booleantrue/Arg
/New
/Configure

3) Add a spring bean definition for this JNDI entry:
jee:jndi-lookup jndi-name=java:comp/env/xoxoGG
id=currentEnvironment  /

The outcome of this is that all links are appended with the value of
xoxoGG (AAA), yielding errors like:
There is no Action mapped for action name
AAA/tutorial/randomiseRedirect. -
or trying to reach http://localhost:8080/AAA/welcome!AAA.action#AAA (why
it is appending so many AAA I don't know)

While this is not strictly a problem with struts, perhaps somehow this
configuration is conflicting with Struts. 
Any help is appreciated in trying to understand this problem!

Regards,

Miguel Almeida




Re: Adding a JNDI lookup yields unexpected Struts errors

2011-06-07 Thread Miguel
On a follow-up of the previous post, the error is the same in Tomcat. It
happens whenever this line is added to applicationContext.xml:
jee:jndi-lookup jndi-name=java:comp/env/xoxoGG
id=currentEnvironment  /

Even if no xoxoGG env property is defined, if I add a
default-value=YYY to the above property Struts will say (for every
action):
There is no Action mapped for action name
YYY/tutorial/randomiseRedirect.

Why is it adding my jndi property to the URL?

On Tue, 2011-06-07 at 18:07 +0100, Miguel wrote:

 Dear all,
 
 I am having a strange problem and was hoping anyone knows why this is
 happening.
 
 My web app was working correctly and running in development in jetty
 running with maven. I'm using Spring's to inject dependencies.
 
 The problem arises when I add a JNDI entry. To do so I:
 
 1) change my container configuration in Maven's pom, so that it sees
 jetty-env.xml:
 webAppConfig
   contextPath//contextPath
   jettyEnvXml${basedir}/src/main/resources/jetty/jetty-env.xml
   /jettyEnvXml
 /webAppConfig
 
 2) Configure a new env-entry in the jetty-env.xml:
 Configure id=myApp class=org.eclipse.jetty.webapp.WebAppContext
   New class=org.eclipse.jetty.plus.jndi.EnvEntry
   ArgRef id=myApp//Arg
   ArgxoxoGG/Arg
   Arg type=java.lang.StringAAA/Arg
   Arg type=booleantrue/Arg
   /New
 /Configure
 
 3) Add a spring bean definition for this JNDI entry:
 jee:jndi-lookup jndi-name=java:comp/env/xoxoGG
 id=currentEnvironment  /
 
 The outcome of this is that all links are appended with the value of
 xoxoGG (AAA), yielding errors like:
 There is no Action mapped for action name
 AAA/tutorial/randomiseRedirect. -
 or trying to reach http://localhost:8080/AAA/welcome!AAA.action#AAA (why
 it is appending so many AAA I don't know)
 
 While this is not strictly a problem with struts, perhaps somehow this
 configuration is conflicting with Struts. 
 Any help is appreciated in trying to understand this problem!
 
 Regards,
 
 Miguel Almeida
 
 




Can we use spring-plugin to inject a HttpServletRequest onto a bean?

2011-05-27 Thread Miguel
Hi,

I'm using spring to inject dependencies in my application. 
I added a module I had previously developed that had the code in some
class (request is a HttpServletRequest):

private String getIpAddress() {
request = ServletActionContext.getRequest();
...
}

This now seems wrong on a few levels:
a) it creates a dependency in the containing project to struts that
shouldn't be there (the ServletActionConfiguration)
b) My database integration tests fail because on their context of
execution there is no ServletActionContext

I was thinking of a solution that involves injecting the request onto
the class. In the test environment I'll have no problems, I'll just
inject a mock HttpServletRequest.

However, in my application, I fail to see how I can inject the proper
request onto that class. Struts injects a request onto the actions. I'm
using spring-plugin. But @autowire-ing the request doesn't work, and in
my springcontext.xml, I fail to see how to fetch struts' request (whose
spring bean would be XXX in the following code):

bean id=auditInterceptor class=audit.AuditLogInterceptor
scope=prototype
property name=request ref=XXX/property
/bean

Is what I am trying to achieve possible?

Regards,

Miguel Almeida



Re: Can we use spring-plugin to inject a HttpServletRequest onto a bean?

2011-05-27 Thread Miguel
Hi Dave,

On Fri, 2011-05-27 at 08:10 -0400, Dave Newton wrote:

 What specifically do you need an actual request for? This strikes me
 as coupling your design to the servlet spec, and there's rarely a
 strong reason to do that past the web layer itself. The idea on
 injecting a request just seems wrong.
 
 Is that a Struts 2 interceptor you're trying to inject it in to?
 

It's an hibernate interceptor. It kicks in when you're committing the
transaction to the database. This audit interceptor stores who changed
what information. In very simple terms:

date || user || property || old value || new value || ipaddress||
2011-05-27 13:18 || dnewton || patient[22].age || 27 || 40 ||
83.999.21.21||

This class is the one responsible for:
a) detecting what changes are being made
b) Detecting who made the changes 
c) log that info onto the database.

This interceptor extends an org.hibernate.EmptyInterceptor (that kicks
in with methods like onSave, onDelete, etc). I need the
HttpServletRequest because it's the only way I've found to:
a) retrieve the username (request.getUserPrincpal.getName)
b) retrieve the user's IP address.

Do you see any other better alternative and/or a solution to my previous
mails' question?

Thanks a lot for your quick reply!

Miguel Almeida


Re: Can we use spring-plugin to inject a HttpServletRequest onto a bean?

2011-05-27 Thread Miguel
On Fri, 2011-05-27 at 13:24 +0100, Miguel wrote:

 Hi Dave,
 
 On Fri, 2011-05-27 at 08:10 -0400, Dave Newton wrote:
 
  What specifically do you need an actual request for? This strikes me
  as coupling your design to the servlet spec, and there's rarely a
  strong reason to do that past the web layer itself. The idea on
  injecting a request just seems wrong.
  


Following my previous email and agreeing with you on this,  I might, of
course, get off the request hook by changing the request injection with
injecting, for example, those two properties (username and ipaddress) to
this class, but the underlying problem is the same: I'm not seeing how I
can inject that requests' username and IP address to that class...


Re: Can we use spring-plugin to inject a HttpServletRequest onto a bean?

2011-05-27 Thread Miguel
On Fri, 2011-05-27 at 09:00 -0400, Dave Newton wrote:

 On Friday, May 27, 2011, Miguel wrote:
  Following my previous email and agreeing with you on this,  I might, of
  course, get off the request hook by changing the request injection with
  injecting, for example, those two properties (username and ipaddress) to
  this class, but the underlying problem is the same: I'm not seeing how I
  can inject that requests' username and IP address to that class...
 
 I'd probably keep a session-scoped bean containing the desired
 properties and inject that into the Hibernate interceptor. Spring
 understands session-scoped beans; fill the bean on login, etc.
 

I never used session-scoped beans, would you mind shedding some light on
this please?  The link
http://struts.apache.org/2.2.3/docs/spring-session-components-workarounds.html 
in http://struts.apache.org/2.2.3/docs/spring-plugin.html (To use 
session-scoped components with Spring and Struts, see...) leads to an empty 
page. What session are we referring to, the http session?


 I guess I thought that Hibernate interceptors were normally
 singletons, but maybe not.
 

I believe they can have any scope. In this case they need to be
prototype exactly due to the fact that they need the user's details and
the list of changes he's making.

Miguel


Where's the best way to test session timeout?

2011-05-23 Thread Miguel
Dear all,

Today's question is on the borderline between Struts and general good
testing practises.

I have an application requirement users must re-login after 5 minutes
of inactivity.

Now, the way to do this is to add to the web.xml:

session-config session-timeout5/session-timeout /session-config

However, how does one test it? More specifically:

1) Can we test it with a struts integration test?
2) How can we mock the time span (ie, we obviously don't want to wait 5
minutes for the test to finish...).


Thanks for the input,

Miguel Almeida


Re: S2 TEst Best Practices

2011-05-20 Thread Miguel
Hi Frans,
On Fri, 2011-05-20 at 14:52 +0700, Frans Thamura wrote:

 
 and i have several question, and i think that is good if we can share it here
 
 i want to know, the test mechanisme , best practices of testing in Struts2 
 world
 

I work in TDD, which means I write the tests first and then develop the
functionality (check Lasse Koskela's book on the subject).

My usual methodology is:

- Pick up a story/use case (eg: click on People list button shows the
list of all people in the phone book list)
- Write a Test class for the PeopleAction.list() method
- There will be a couple of tests: happy path, what if there aren't any
people, what if there's a problem accessing the database?
- Recently I've been developing a lot with services. this means the
action will usually be simple, something like manipulate the properties
that come from the request (if necessary) and pass them to the service
- The last sentence means I can mock up the service here: I am
interested in testing if the action behaves correctly - ie, if it
catches exceptions, sends to the correct result, I am not really
interested  in knowing if the database is being accessed correctly. So
EasyMock is a good library to use
- After building the test and the Action, I do have the problem: is my
service (eg service.getAllPeople() ) working as expected? Time for some
integration test. Bare in mind I'm working in TDD: I've build an
interface for the service, but the implementation doesn't exist yet
- I repeat the test-build cycle, this time to build the correct
implementation of service.getAllPeople(). 
- Work done

Now, some remarks:
- This unit testing doesn't do struts integration, such as:
- Struts validation
- My custom authorisation (I have developed a @AuthorisedRoles
annotation that only authorised users with some roles to execute that
action

I'm not really sure what/when/where is the best way to test this. Right
now I test this in a separate class that I suffix with, eg,
*ValidationIntegrationTest. I'm not 100% happy with this approach, as
a) I end up testing my action in 2 or 3 different places
b) I'm not completely happy with my validation test class yet, which
currently extends from StrutsSpringTestCase


Regards,

Miguel Almeida


Re: S2 TEst Best Practices

2011-05-20 Thread Miguel
On Fri, 2011-05-20 at 16:41 +0700, Frans Thamura wrote:

 my idea to setup jenkins/hudson server
 
 so we can test it there
 
 can TDD do this?
 

TDD stands for test driven development. It is a development methodology.
The end result is (better and working) code and (more) tests. So of
course you can set that up in jenkins.

I am actually starting with jenkins and have little experience with CI
systems. Everything is easy until you have environment specific settings
(like different databases and database credentials, or upload paths).

Miguel Almeida


RE: S2 TEst Best Practices

2011-05-20 Thread Miguel
On Fri, 2011-05-20 at 15:38 +0400, Ilya Kazakevich wrote:

 Hello,
 
 In pure struts your action is just a presenter (see MVP pattern). So you can
 test it using unit testing engines like testNG and jUnit.
 
 For GUI testing you can use selenium.

Ilya, what kind of tests do you usually run with selenium? 

An interesting view on this from Gojko Adzic seems to almost suggest
these tests should be avoided: see in
http://gojko.net/2010/04/13/how-to-implement-ui-testing-without-shooting-yourself-in-the-foot-2/




RE: S2 TEst Best Practices

2011-05-20 Thread Miguel
On Fri, 2011-05-20 at 09:29 -0400, Dave Newton wrote:

 On May 20, 2011 9:26 AM, Ilya Kazakevich wrote:
  There should not be logic in view. If there is no logic -- there is
 nothing
  to test:)
 
 Sure there is, and I'm not even including JavaScript-based functionality.
 Are the right things displayed? Does the UI reflect proper state? Is the
 flow correct? Etc.
 

I'm with Dave on this one. It's curious, because as we speak I am
thinking how to test authorisation. My authorisation is based on 2
things:

1 - @Roles(role1,role2) annotation on the method/class

This is easily tested with, eg, java reflection that compares the roles
with an expected list of roles (you can ever automate it so that you
fetch the list of all authorisations from a file and test all mehtods in
the same test class

2 - customtag:roles allowed=somerole content /customtag:roles,
which gets displayed or not depending on what roles the user has.

Like Dave points out, this falls into the category of Are the right
things displayed. 


Re: Type conversion of ListSomeInterface - how does one do it?

2011-05-18 Thread Miguel


On Tue, 2011-05-17 at 14:42 -0700, Jeffrey Black wrote:

 Hey there Miguel.
  
 Have a look here:
  
 http://struts.apache.org/2.0.14/docs/type-conversion.html#TypeConversion-GenericsandErasure


Thanks Jb. In my case a possible solution is to remove the generic
reference to the list (ie, changing ListMyInterface to List). 

This isn't usually necessary because Spring automatically injects the
implementations in non-collection objects (ie, a private SomeInterface
property is automatically injected with whichever bean we defined for
SomeInterface in Spring), but doesn't work with collections (or I
haven't figured out how to configure that in Spring).

Given that an implementation-agnostic solution is preferable, the advice
on the page instantiate the target implementation first (eg. in a
prepare method) or substitute in an implementation. is not, in my
opinion, preferable.


Miguel


Type conversion of ListSomeInterface - how does one do it?

2011-05-17 Thread Miguel
I've always struggled with type conversion of lists and I'd appreciate a
more experienced brain to help me out.

Consider the following multiple select box:

s:select   multiple=true name=users.id list=userslistKey=id
listValue=usernamevalue=%{centre.users.{user.id}} /

As per the documentation, name your element people.name and the
framework will understand that it should create a new Person object for
each selected item and set its name accordingly.

This works correctly, without even needing an
MyAction-conversion.properties file if my action has:

private ListUserImpl users;

However, because I usually work with interfaces (and Spring-inject my
dependencies), to have my action implementation-agnostic I want to have.

private ListUser users;

where User is an interface and UserImpl implements User.

However, as soon as the List (and getter/setters) are changed to use
User, the type conversion no longer works, yielding:

2011-05-17 11:17:13,554 WARN  [CommonsLogger.java:60] : Error setting
expression 'users.id' with value '[Ljava.lang.String;@13d344e7'
ognl.OgnlException: Error converting given String values for Collection.
[org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'com.itclinical.iwrs.model.User': Could not resolve
matching constructor (hint: specify index/type/name arguments for simple
parameters to avoid type ambiguities)]

This happens even if I have a UserEditAction-conversion.properties with:
#KeyProperty_users=id
#Element_users=iw.persist.model.UserImpl
#CreateIfNull_users=true


So, how can one use the automatic type conversion when your list is
defined for an interface?

Thank you in advance,

Miguel Almeida


Re: Pagination using Struts library

2011-05-13 Thread Miguel
Speaking of which, Dave, have you used displaytag recently?

It seems to have been abandoned. It's good for regular usage, but as
time goes by we start having some problems.

For example, with the export options (displaytag can export to excel,
pdf, etc automatically) we see a ognl WARN:

WARN  [CommonsLogger.java:60] : Error setting expression '6578706f7274'
with value '[Ljava.lang.String;@385b5df0'
ognl.ExpressionSyntaxException: Malformed OGNL expression: 6578706f7274
[ognl.ParseException: Encountered  INT_LITERAL 7274  at line 1,
column 9.

This is due to the fact that displaytag's export url is
Someaction.action?6578706f7274=1d-16533-e=5 and 6578706f7274 doesn't
seem to be valid on recent versions.

Miguel Almeida


Dave,On Wed, 2011-05-11 at 08:06 -0400, Dave Newton wrote:

 
 DisplayTag is open-source, BTW. 


jsp's outside WEB-INF in maven archetype?

2011-05-10 Thread Miguel
The other day I tried out a simple maven archetype (either
struts2-archetype-starter or -convention, I don't recall). Anyway, it's
one that comes configured with sitemesh.

What stroke me as odd was that the sample jsp's were in the path
src/webapp/jsp, and not inside WEB-INF.

Isn't it preferable to store the jsp's inside WEB-INF (to reduce their
visibility)? If so, shouldn't the archetypes be changed in accordance? 

Regards,

Miguel Almeida


Re: [ANN] Struts2 jQuery Plugin Version 3.0.0 is available

2011-05-09 Thread miguel
Johannes,

Have you posted 3.0.0 on maven repositories yet?

I have used jquery extensively, but never jquery plugin. I am trying it
out on a pet project. Well done!

Miguel

On Mon, 2011-05-09 at 11:22 -0700, Johannes Geppert wrote:

 arin_12 wrote:
  
  Seems that we have some issue in the GRID. The search function in the GRID
  - Editable is not working fine.
  
 
 Thank you for reporting this. New Version 3.0.1 should fix this problem.
 
 Johannes
 
 -
 
 --
 web: http://www.jgeppert.com
 twitter: http://twitter.com/jogep
 --
 View this message in context: 
 http://struts.1045723.n5.nabble.com/ANN-Struts2-jQuery-Plugin-Version-3-0-0-is-available-tp4375901p4382555.html
 Sent from the Struts - User mailing list archive at Nabble.com.
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 


Re: help with MethodFailedException in ognl.OgnlRuntime.callAppropriateMethod

2011-05-03 Thread Miguel
Which means: try changing your property name to something else; the tagId may 
already be in use.

I also had a problem with a property name once. It might be useful to have a 
wiki page with names already in use in struts.

Enviado a partir do meu HTC

- Reply message -
De: Eric Reed ere...@mail.nysed.gov
Data: ter, Mai 3, 2011 13:37
Assunto: help with MethodFailedException in 
ognl.OgnlRuntime.callAppropriateMethod
Para: Struts Users Mailing List user@struts.apache.org

Justin,
 
Your error:
 [java.lang.NoSuchMethodException:
 org.robbins.flashcards.model.Tag.setTagId([Ljava.lang.String;)] STRING
 
public void setTagId(int tagId) {  -- INT
this.tagId = tagId;
}
Eric Reed
NYS Education Department
 

 Justin Robbins justinhrobb...@gmail.com 5/3/2011 8:32 AM 
Since the stack trace is at Warn level and doesn't actually seem to be
breaking my code then maybe I'm best off just adjusting the log4j
level higher for the Ognl related packages?

# Struts OgnlUtil issues unimportant warnings
log4j.logger.com.opensymphony.xwork2.util.OgnlUtil=error
log4j.logger.com.opensymphony.xwork2.ognl.OgnlValueStack=error

On Mon, May 2, 2011 at 9:27 PM, Justin Robbins justinhrobb...@gmail.com wrote:
 Nope, my bad.  After a full refactor I get the same error.  Below are
 snippets of the new code and most recently generated error.

 Stack Trace excerpt:
 2011-05-02 21:24:49,887 175361 [http-bio-8080-exec-7] WARN
 com.opensymphony.xwork2.ognl.OgnlValueStack - Error setting expression
 'tagId' with value '[Ljava.lang.String;@1e73e0d'
 ognl.MethodFailedException: Method setTagId failed for object
 org.robbins.flashcards.model.Tag@144dc7b [name='my tag' ]
 [java.lang.NoSuchMethodException:
 org.robbins.flashcards.model.Tag.setTagId([Ljava.lang.String;)]
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1285)
at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1474)

 JSP excerpt:
 s:form action=saveOrUpdateTag method=post
s:hidden name=tagId /
s:textfield name=name key=label.tag.name size=20 /
s:submit label=label.flashcard.submit align=center /
 /s:form

 POJO excerpt:
 public class Tag  implements java.io.Serializable {


 private int tagId;

public int getTagId() {
return this.tagId;
}

public void setTagId(int tagId) {
this.tagId = tagId;
}

 On Mon, May 2, 2011 at 8:53 PM, Justin Robbins justinhrobb...@gmail.com 
 wrote:
 I tested it just now and I do NOT get the error when I refactor the
 code from the POJO on down to the JSP to use myId instead of id.

 On Mon, May 2, 2011 at 8:43 PM, Dave Newton davelnew...@gmail.com wrote:
 Just out of curiosity, does it do the same thing if it's not named id?

 d.

 On Mon, May 2, 2011 at 8:32 PM, Justin Robbins justinhrobb...@gmail.com 
 wrote:
 Anyone have any ideas on this one?  I'd be most grateful for some advice.

 Someone suggested I use a newer version of the ognl jar.  I was using
 ognl-3.0.jar which is what came with the Struts 2.2.1.1
 distribution.  I've since replaced it with ognl-3.0.1.jar but I'm
 still receiving the same error.

 Any help is greatly appreciated.

 On Mon, May 2, 2011 at 11:26 AM, Justin Robbins
 justinhrobb...@gmail.com wrote:
 Hi folks,

 I have a working Action and JSP form that I'm using for creating new
 entities in my very basic Struts 2.2.1.1 app.  I'm trying to modify
 the app to re-use the JSP form with editing of entities.  I added a
 hidden ID tag and now I'm getting errors when I submit the form.
 Can someone please give me some assistance?  I've Googled this issue
 and seen others posting similar errors but I'm not sure how to resolve
 it.

 Excerpt from Stack Trace when I submit the form:
 2011-05-02 11:09:36,132 3198497 [http-bio-8080-exec-23] WARN
 com.opensymphony.xwork2.ognl.OgnlValueStack - Error setting expression
 'id' with value '[Ljava.lang.String;@100ac03'
 ognl.MethodFailedException: Method setId failed for object
 org.robbins.flashcards.model.Tag@1b9eb34 [name='null' ]
 [java.lang.NoSuchMethodException:
 org.robbins.flashcards.model.Tag.setId([Ljava.lang.String;)]
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1285)
at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1474)

 Excerpt from JSP:
 %@ taglib prefix=s uri=/struts-tags%
 ...
 s:form action=saveOrUpdateTag method=post
s:hidden name=id /
s:textfield name=name key=label.tag.name size=20 /
s:submit label=label.flashcard.submit align=center /
 /s:form

 Excerpt from Action Class:
 public class TagAction extends FlashCardsAppBaseAction implements
 ModelDrivenTag {

Tag tag = new Tag();

public Tag getTag() {
return tag;
}

public void setTag(Tag tag) {
this.tag = tag;
}
public String createTag() {
...
   }
 }

 Excerpt from POJO:
 public class Tag  implement

Overriding interceptor in stack

2011-04-28 Thread Miguel
Today's question actually follows yesterday's suggestion by Dave of
using the preparable interface and is really an
architecture/convention-over-configuration question:

- what do you think about the possibility to override an interceptor by
reassigning it in the configuration? I don't think this is possible, but
the idea would be this:

1. You are using the interceptor-ref name=defaultStack /
2. If you define interceptor name=prepareclass=xxx / before this,
the defaultStack would use xxx instead of the default class.

The usefulness is to be able to use a different implementation of the
interceptor without having to copy-paste te entire stack just to change
this interceptor.


I thought of this while testing. My prepare method has a database call.
Now, I have a MyActionValidationIntegrationTest using
StrutsSpringTestCase where the main interest is to test validation. To
increase speed, I am not interested in the database call. With
interceptor name=prepare class=xxx / I could simply define a fake
xxx for my tests that didn't invoke the prepare() method.

I believe this also follows the convention-over-configuration pattern:
the default (interceptor) is used unless you redefine it (by writing an
interceptor with the same name)


How to make s:action run when validation fails?

2011-04-27 Thread Miguel
Dear all,

I am having problems implementing the suggestion of struts' suggestion
of how to populate a page when validation fails. My idea was to have a
s:action in the jsp that will be the input result of the failing
validation action. 
However, it seems that the interceptor stack of the 2nd action (the
s:action in the jsp) still thinks there is an error. I confirmed this by
debugging the DefaultWorkflowInterceptor, where
validationAwareAction.hasErrors() is true. It shouldn't be (at least not
according to the suggestion in
https://cwiki.apache.org/WW/how-do-we-repopulate-c...ols-when-validation-fails.html
  ); should it?

I've posted the question with a simple code snippet at
http://www.coderanch.com/t/535806/Struts/Populating-jsp-page-when-validation , 
so you can have a look at the code there.

My questions are: 
1) Why doesn't the method mapped to s:action name=xxx get called
when the form fails, ie, why is its interceptor stack picking up an
error when it shouldn't?
2) How does one solve this, ie, how do I call the xxx action to populate
the rest of the page if I have a form with validation and an xxx action
bellow (the xxx action's purpose is to populate a table that should be
shown with the form, even when validation fail)


Your help is greatly appreciated,

Miguel Almeida


Re: How to make s:action run when validation fails?

2011-04-27 Thread Miguel
Thanks for the prompt reply Dave. I have a couple of follow-up questions
regarding this.

On Wed, 2011-04-27 at 08:59 -0400, Dave Newton wrote:

 It's not making a separate *browser* request, it's all internal to S2.
 

Does this mean that struts' FAQ in
https://cwiki.apache.org/WW/how-do-we-repopulate-controls-when-validation-fails.html
 is incorrect in suggesting s:action for this?


 Personally, I think things like this are better handled through
 Preparable or similar mechanism.
 

I haven't used the Preparable approach much, mainly because my actions
are usually grouped by domain objects. Eg: I'll have a PersonAction
where  I'll put a add, list, remove methods which I'll map actions to.
This saves a bit of configuration in things like adding the
corresponding service (personService) and setter. With a preparable I'll
have:

1) unused logic (say, if I have a findPerson() method/action, it won't
probably need a list = personService.getAll() that I'll put in my
preparable method. So an extra db call

2) funny looking empty actions (eg: the list() method/action will now be
an empty return something, because the logic is in the preparable.
Isn't this odd-looking?


That said, I don't use validation very often. It appears to over
complicate things a bit (a bit egg vs chicken theory, perhaps that's why
I don't use it very often).

Regards,

Miguel


Re: Restrict direct access to static content

2011-02-22 Thread Miguel
You can always make a request aware struts action that returns a stream (not
a jsp) and inside the action You can put everything You want to check the
user.
Open the file with a fileinputstream from an internal resource directory.

Enviado desde mi Nexus S
Miguel Ruiz Velasco Sobrino
On Feb 16, 2011 11:55 AM, Brian Thompson elephant...@gmail.com wrote:
 On Wed, Feb 16, 2011 at 11:34 AM, Dave Newton davelnew...@gmail.com
wrote:

 2011/2/16 Luis Eric López Fernández wrote:
  I am thinking to do something that will completely destroy the purpose
of
  struts hehe.. I will add a servlet to handle all the requests different
 than
  .action and there I will redirect to an error page. =S

 How will you request them from within the JSP?



 About the only way I see to accomplish this requirement is to check on
 HTTP_REFERER somehow ... but that's hardly reliable.

 Really, this seems a lot like a requirement that leads to ... mean people
 writing javascript to replace the context menu with Copyright
Crazy-People
 alerts.

 -Brian


Re: Struts2 - implementing SSL

2010-11-10 Thread Miguel
Hello Pawel,
No, I don't have any benchmarks about the speed of mod_ssl vs tomcat
ssl. I prefer apache with mod_ssl because I'm familiar with the
configuration of open_ssl, I have the perception of being more secure
to separate the application web server from the front webserver, and
because mod_jk has clustering capabilities, and that permits me to add
and remove tomcat instances to manage capacity using a single apache
httpd server (and a single IP).
Beyond that, you need to take into account that you can operate tomcat
in pure java mode using the java ssl (configured in the java way),
or in native mode using tomcat native, using openssl (and is
configured in the openssl way), and the performance difference is
significative.
Those are my reasons for my preference.
Regards,

Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino



2010/11/10 Paweł Wielgus poulw...@gmail.com:
 Hi Miguel,
 do You have or know of any real life benchmarks that shows that tomcat
 ssl is slower than apache mod_ssl?

 Best greetings,
 Paweł Wielgus.

 2010/11/9 Miguel miguel...@gmail.com:
 Hello,
 I haven't used that plugin, but I recomend you to use the SSL provided
 by tomcat or your web container, it's easier.
 But if you want the best speed, i really suggest yo to use apache
 httpd with mod_ssl for the ssl work and mod_jk, to forward the traffic
 to tomcat or jetty. You can find documentation about this in the
 tomcat connectors page and the httpd documentation.
 Regards,

 Si quieres ser más positivo, pierde un electrón
 Miguel Ruiz Velasco Sobrino



 On Tue, Nov 9, 2010 at 15:12, Ken McWilliams ken.mcwilli...@gmail.com 
 wrote:
 I'm just looking into this and have never implemented ssl before.

 I found this: http://code.google.com/p/struts2-ssl-plugin/ and was
 wondering if anyone here has used it?

 I looked on this list https://cwiki.apache.org/S2PLUGINS/home.html
 and didn't see any explicit mention of SSL, nor did I find reference in
 Struts2 in Action or Apache Struts 2 Web Application Development.


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



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



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



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



Re: Struts2 - implementing SSL

2010-11-09 Thread Miguel
Hello,
I haven't used that plugin, but I recomend you to use the SSL provided
by tomcat or your web container, it's easier.
But if you want the best speed, i really suggest yo to use apache
httpd with mod_ssl for the ssl work and mod_jk, to forward the traffic
to tomcat or jetty. You can find documentation about this in the
tomcat connectors page and the httpd documentation.
Regards,

Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino



On Tue, Nov 9, 2010 at 15:12, Ken McWilliams ken.mcwilli...@gmail.com wrote:
 I'm just looking into this and have never implemented ssl before.

 I found this: http://code.google.com/p/struts2-ssl-plugin/ and was
 wondering if anyone here has used it?

 I looked on this list https://cwiki.apache.org/S2PLUGINS/home.html
 and didn't see any explicit mention of SSL, nor did I find reference in
 Struts2 in Action or Apache Struts 2 Web Application Development.


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



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



Re: Struts2 - Html to PDF

2010-07-24 Thread Miguel
FOP is good, but it transforms from XML-FO to PDF (and lots of other
target formats).
If you want to tranform html to pdf you need a 3 stage process:
first you write XHTML with CSS using what ever you have/know/like.
Then you transform it to XML-FO using CSS2XSLFO
(www.re.be/css2xslfo/index.xhtml)
Then you transform this to PDF using FOP (or others front-ends)

Please be warned that this combination is very flexible but has very
odd limitations.
For reporting uses, you may want also to look jasper reports and BIRT
that also exports to PDF.


Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino



On Sat, Jul 24, 2010 at 09:08, Martin Gainty mgai...@hotmail.com wrote:

 i dont know how Crystal can ingest either XSD schema entities or POJOs..maybe 
 someone out there knows of a converter?


 FOP transform is the best solution offered

 http://xmlgraphics.apache.org/fop/



 Good Call!
 Martin
 __
 Verzicht und Vertraulichkeitanmerkung

 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.



 Date: Fri, 23 Jul 2010 17:33:23 -0400
 Subject: Re: Struts2 - Html to PDF
 From: w...@wantii.com
 To: user@struts.apache.org

 I'd assume it's possible, but probably not the best choice... I would
 take a look at doing either a Jasper report or using Apache FOP. The
 choice will have to do with the nature of the PDF you are trying to
 generate. Jasper is a reporting platform... Think of Crystal Reports,
 there is a report designer, you then back the report with data and
 render. Jasper uses iText to generate PDFs, and it will let you create
 more of a document than a bunch of code.

 If your output will be hard to model in a traditional reporting
 platform, then take a look at Apache FOP. It's very complicated, but
 think of it this way -

 You start with XML modelling your data, then pass it through a
 transform that kicks out XSL-FO, then you have Apache FOP turn it into
 a PDF. I don't have any real experience with it, so I might be giving
 you bad information (and hope someone will correct me). But, in this
 scenario, you are generating XML which represents the data you are
 passing to the output. The transform is done using XSLT? Which is
 another standard. What you generate is an XSL-FO document. This
 document can be rendered as a PDF by FOP. Although it's a more
 complicated process than the first choice, it does add some
 flexibility since you can drop-in replace different components (the
 transformer, the FO-to-PDF converter, probably), plus, you can create
 other XSLTs that generate other output. With Jasper, you'll probably
 be locked into PDF, HTML and Excel (CSV).

 -Wes

 On Fri, Jul 23, 2010 at 4:43 PM, CRANFORD, CHRIS
 chris.cranf...@setech.com wrote:
  Is it possible to extend the default ServletDispatcherResult to parse
  the HTML output and pass the result content to the browser as a PDF
  document?  Or is there a better approach to doing this?  What I want to
  be able to do is to allow easy creation of PDF documents from HTML
  content.  Presently I am looking to use iText but this isn't a firm
  choice and another option that may work better is possible.
 
  Chris
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 



 --
 Wes Wannemacher

 Head Engineer, WanTii, Inc.
 Need Training? Struts, Spring, Maven, Tomcat...
 Ask me for a quote!

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


 _
 The New Busy is not the too busy. Combine all your e-mail accounts with 
 Hotmail.
 http://www.windowslive.com/campaign/thenewbusy?tile=multiaccountocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

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



Re: jsp in WEB-INF

2010-07-16 Thread Miguel
On Fri, Jul 16, 2010 at 03:24, Johannes Geppert jo...@web.de wrote:

 together with convention plugin ther exists this constant

    constant name=struts.convention.result.path value=/WEB-INF/jasp/

 this works fine for me, bit I don't know a solution without convention
 plugin.

 Best Regards

 Johannes Geppert

This solution sounds very interesting, and it's exactly what I'm
seeking, but I don't use convention.
Does anyone knows if this can be done with plain struts2?
Maybe it would be an interesting addition, and with some luck not so difficult.
Regarding the access rules in web.xml, there are lot's of directories,
and some are assembled dynamically at build time from sub-projects, so
I think it's somewhat difficult that way as it needs a lot of manual
bookkeeping.
Thanks for the help from everyone.

Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino

 Miguel-55 wrote:

 Hello,

 I use struts 2.1.81. and I don't want that my users access directly my
 .jsp, so I put them inside WEB-INF.
 But the struts.xml is difficult to mantain, so I have a question:
 Is there some sort of constant that defines a prefix for the JSP
 inside struts.xml?
 Apparently in struts1 there is something like this.

 Putting the jsp directly in the app (world accessible) makes your
 struts.xml look like this:
 ...
 package name=administracion extends=proyectox namespace=/admin
    action name=pais_* method={1} class=com.proyectox.ui.PaisAction
       resultpaisDetail.jsp/result
    /action
 ...
 and the JSP is: /admin/paisDetail.jsp (relative to the app root)

 but if you protect your JSP, you need to write this:
 ...
 package name=administracion extends=proyectox namespace=/admin
    action name=pais_* method={1} class=com.proyectox.ui.PaisAction
       result/WEB-INF/admin/paisDetail.jsp/result
    /action
 ...
 and your JSP is : /WEB-INF/admin/paisDetail.jsp
 and you lose the auto namespace prepend (let's say it's called that
 way), and also makes the struts.xml difficult to read.

 So the thing I'm asking is if there is something like this:
 ...
 constant name=struts.jsp_prefix value=/WEB-INF/jsp/ /
 package name=administracion extends=proyectox namespace=/admin
    action name=pais_* method={1} class=com.proyectox.ui.PaisAction
       resultpaisDetail.jsp/result
    /action
 ...
 and makes struts2 search the jsp as: /WEB-INF/jsp/admin/paisDetail.jsp

 Is there something like this?
 Thanks

 Si quieres ser más positivo, pierde un electrón
 Miguel Ruiz Velasco Sobrino

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





 -
 ---
 web: http://www.jgeppert.com
 twitter: http://twitter.com/jogep

 --
 View this message in context: 
 http://old.nabble.com/jsp-in-WEB-INF-tp29179165p29181264.html
 Sent from the Struts - User mailing list archive at Nabble.com.


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



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



jsp in WEB-INF

2010-07-15 Thread Miguel
Hello,

I use struts 2.1.81. and I don't want that my users access directly my
.jsp, so I put them inside WEB-INF.
But the struts.xml is difficult to mantain, so I have a question:
Is there some sort of constant that defines a prefix for the JSP
inside struts.xml?
Apparently in struts1 there is something like this.

Putting the jsp directly in the app (world accessible) makes your
struts.xml look like this:
...
package name=administracion extends=proyectox namespace=/admin
   action name=pais_* method={1} class=com.proyectox.ui.PaisAction
resultpaisDetail.jsp/result
   /action
...
and the JSP is: /admin/paisDetail.jsp (relative to the app root)

but if you protect your JSP, you need to write this:
...
package name=administracion extends=proyectox namespace=/admin
   action name=pais_* method={1} class=com.proyectox.ui.PaisAction
result/WEB-INF/admin/paisDetail.jsp/result
   /action
...
and your JSP is : /WEB-INF/admin/paisDetail.jsp
and you lose the auto namespace prepend (let's say it's called that
way), and also makes the struts.xml difficult to read.

So the thing I'm asking is if there is something like this:
...
constant name=struts.jsp_prefix value=/WEB-INF/jsp/ /
package name=administracion extends=proyectox namespace=/admin
   action name=pais_* method={1} class=com.proyectox.ui.PaisAction
resultpaisDetail.jsp/result
   /action
...
and makes struts2 search the jsp as: /WEB-INF/jsp/admin/paisDetail.jsp

Is there something like this?
Thanks

Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino

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



Re: How to prevent direct access to JSP

2010-07-05 Thread Miguel
Hello,
if you want to prevent direct access to your .jsp's, you need to put
them inside the WEB-INF/classes directory. That one is a question that
popup in the list from time to time.
But if you want your users to go throu the links at the home, you have
to implement some trickery, in the form of some parameter that if not
present will redirect the user to the home, or some trickery to
redirect the user to the home if there is no session or something in
the line. I'ts difficult to do that, and almost for sure isn't worth
the hassle to do it.
Regards,


Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino



On Mon, Jul 5, 2010 at 23:53, Kushan Jayathilake kusha...@gmail.com wrote:
 Hi Guys,

 Can anyone suggest me how to prevent an user entering a direct URL for the
 JSP instead of action,

 ie : *search.jsp* instead of *search.action*

 I want to control this, so the users must enter an URL ends with
 *.action*and i also wants to control access some pages by typing its
 action name
 also,
 like it shouldn't be allowed to go anyother page directly, instead users
 must go through the buttons and links appears on the home page

 ie: if anyone want to go to *summary.action* he must first go to the *
 search.action* first.

 Hope im clear enough.. :) can anyone suggest me how to do this?

 --
 Regards
 Kushan Jayathilake


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



Re: Different results with spring

2010-01-30 Thread Miguel
On Fri, Jan 29, 2010 at 19:09, Miguel miguel...@gmail.com wrote:
 Hi,
 Thanks for answering!!
 I'll post my relevant configurations. I'm using spring 2.5.6 and struts 
 2.1.8.1.
 I have the spring plugin in the struts.conf, and my actions are
 correctly autowired by name.
 I also have an include in struts.conf where the relevant action is called.
 The thing here is I have two beans of the same type but configured to
 access different hibernate entity-names (a DAO), and in the part that
 misbehaves, i need to access the second one that has a different name,
 but is of the same type.
 When I make spring instanciate the action, the prepare() method in the
 action is called correctly, and it uses the autowired DAO, it gets the
 desired data but the details() method is not called and the result is
 automatically redirected to INPUT result.
 When I make struts (using the spring factory( instanciate the action,
 the prepare() method in the action is called correctly, and it uses
 the autowired DAO, it gets the desired data, the details() method is
 called and the result is shown correctlly.
  Curiosly the browse method is correctly called en each config.
 The thing here is I have replicated some part of the system, and I
 have identical class names in different packages (the code in the
 classes is not the same), and those classes are called from different
 urls in struts.conf. The action has no validators but it's twin class
 in a different package does.

 struts.conf:
        constant name=struts.devMode value=true /
        constant name=struts.objectFactory
 value=org.apache.struts2.spring.StrutsSpringObjectFactory /
        constant name=struts.freemarker.templatesCache value=true /

    package name=proyectox extends=json-default !-- struts-default --
 !-- Si no le pones este stack, pues no funciona...--
        interceptors
                interceptor name=strutsSpring
 class=com.proyectox.ui.interceptor.HibernateOpenSessionInViewInterceptor/
                interceptor-stack name=strutsSpringPPPStack
                        interceptor-ref name=strutsSpring/
                        interceptor-ref name=paramsPrepareParamsStack/
                /interceptor-stack
        /interceptors
        include file=com/fcm/sectorPrimario2009/sectorPrimario.struts.xml/
 


 com/fcm/sectorPrimario2009/sectorPrimario.struts.xml:
 package name=receptorsectorprimario extends=proyectox
 namespace=/sectorprimario/receptor

                action name=lista method=browse
 class=com.fcm.sectorPrimario2009.ui.ReceptorAction
                        resultlistaReceptor.jsp/result
                        result name=errorlistaReceptor.jsp/result
                        interceptor-ref name=scope
                            param name=sessioncontribuyente/param
                            param name=autoCreateSessiontrue/param
                            param name=keycontribuyenteActual/param
                        /interceptor-ref
                        interceptor-ref name=strutsSpringPPPStack/
                /action

                action name=receptor_* method={1}
 class=com.fcm.sectorPrimario2009.ui.ReceptorAction
                        resultreceptorDetail.jsp/result
                        result name=detailreceptorDetail.jsp/result
                        result name=inputreceptorNuevo.jsp/result
                        result name=modificarreceptorNuevo.jsp/result
                        result name=borrar type=redirectAction
                                param name=actionNamelista/param
                        /result
                        result name=error/error.jsp/result
                        interceptor-ref name=scope
                            param name=sessioncontribuyente/param
                            param name=autoCreateSessiontrue/param
                            param name=keycontribuyenteActual/param
                        /interceptor-ref
                        interceptor-ref name=scope
                            param name=sessionreceptor/param
                            param name=autoCreateSessiontrue/param
                            param name=keyreceptorActualSP/param
                        /interceptor-ref
            interceptor-ref name=strutsSpringPPPStack/
                /action
 ...


 sectorPrimario.spring.xml:

 beans xmlns=http://www.springframework.org/schema/beans;
        xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:jee=http://www.springframework.org/schema/jee;
        xmlns:sec=http://www.springframework.org/schema/security;
 xmlns:tx=http://www.springframework.org/schema/tx;
        xmlns:aop=http://www.springframework.org/schema/aop;
        xsi:schemaLocation=http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/jee
        http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
        http://www.springframework.org/schema

Re: Different results with spring

2010-01-29 Thread Miguel
-classorg.springframework.web.context.ContextLoaderListener/listener-class
/listener
listener
  
listener-classorg.springframework.security.ui.session.HttpSessionEventPublisher/listener-class
/listener
filter
filter-namestruts2/filter-name

filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-class
/filter

filter-mapping
filter-namestruts2/filter-name
url-pattern/*/url-pattern
/filter-mapping
/web-app

In past projects I have made the same trick of making spring
instanciate actions, and this is the first time I have this behavior.
In the other project, I use the same spring version, but struts 2.1.6,
and the struts.conf has not includes. I'll test it without includes to
see if the error appears or not.

Thanks for your help.


Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino



On Fri, Jan 29, 2010 at 14:27, Wes Wannemacher w...@wantii.com wrote:
 What you are doing should work the way you expect... I use the Spring
 integration all the time :)

 A few simple questions, do you have the spring-plugin installed? Do
 you have the Spring ContextLoaderListener setup in the web.xml? Do you
 have any non-default configuration settings in any of web.xml,
 applicationContext.xml or struts.xml? Are you using any plugins other
 than the Spring plugin? What version of Spring and Struts are you
 using?

 -Wes

 On Fri, Jan 29, 2010 at 1:19 AM, Miguel miguel...@gmail.com wrote:
 Hello all,
 I have a problem when using spring and the spring aplication context.
 If I configure the action class directly from struts.conf, my action
 does just the correct behavior. (1)
 But if I configure the action in a spring file and in struts.conf put
 only the spring bean name everything gets piped to the input result
 (the prepare method is executed, but not the action method).(2)
 I would benefit if the second scenario worked, because in the spring
 configuration is quite complex and have more than one bean of the same
 type

 (1) action name=receptor_* method={1}
 class=com.fcm.sectorPrimario2009.ui.ReceptorAction (struts.conf)

 (2)  action name=receptor_* method={1} class=receptorSPAction
 (struts.conf)

 bean id=receptorSPAction
 class=com.fcm.sectorPrimario2009.ui.ReceptorAction
 scope=prototype (spring.xml)
                property name=receptorDAOref
 local=receptorDAOSectorPrimario//property
        /bean

 I hope someone can help me




 Si quieres ser más positivo, pierde un electrón
 Miguel Ruiz Velasco Sobrino

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





 --
 Wes Wannemacher

 Head Engineer, WanTii, Inc.
 Need Training? Struts, Spring, Maven, Tomcat...
 Ask me for a quote!

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



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



Different results with spring

2010-01-28 Thread Miguel
Hello all,
I have a problem when using spring and the spring aplication context.
If I configure the action class directly from struts.conf, my action
does just the correct behavior. (1)
But if I configure the action in a spring file and in struts.conf put
only the spring bean name everything gets piped to the input result
(the prepare method is executed, but not the action method).(2)
I would benefit if the second scenario worked, because in the spring
configuration is quite complex and have more than one bean of the same
type

(1) action name=receptor_* method={1}
class=com.fcm.sectorPrimario2009.ui.ReceptorAction (struts.conf)

(2)  action name=receptor_* method={1} class=receptorSPAction
(struts.conf)

bean id=receptorSPAction
class=com.fcm.sectorPrimario2009.ui.ReceptorAction
scope=prototype (spring.xml)
property name=receptorDAOref
local=receptorDAOSectorPrimario//property
/bean

I hope someone can help me




Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino

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



Re: Where to disable encrypting of non latin chars?

2009-11-27 Thread Miguel
I use lots of pages with accented latin characters, and in the source
you can see the native characters, not encoded as html entities.
The thing I use, in the %@ page ...%  header, that should be the
first thing in a jsp, I define the charset as utf-8, and that does the
magic, at least for me.

%@ page language=java contentType=text/html; charset=UTF-8
pageEncoding=UTF-8%

Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino



On Fri, Nov 27, 2009 at 20:14, Saeed Iqbal saee...@gmail.com wrote:
 I mean if you want to display decoded HTML value, then feed in encoded
 values or the other option first

 On Sat, Nov 28, 2009 at 6:50 AM, Saeed Iqbal saee...@gmail.com wrote:

 These are encoded characters. Either output this but first you must imo try
 s:property with escape=false


 On Sat, Nov 28, 2009 at 5:57 AM, Alex Siman aleksandr.si...@gmail.comwrote:


 I don't know... Do I need these extra bytes in output? And are that
 entities
 good for SEO (Google, others)?

 Saeed Iqbal-2 wrote:
 
  I personally feel that is a good feature of Struts.
 
  On Fri, Nov 27, 2009 at 8:22 AM, Saeed Iqbal saee...@gmail.com wrote:
 
  escape=false can help you or show those characters as encoded values
 
 
  On Fri, Nov 27, 2009 at 8:17 AM, Alex Siman
  aleksandr.si...@gmail.comwrote:
 
 
  I just have found another issue after upgrading from [2.1.6] -
 [2.1.8].
  Struts now encode any non latin char to its HTML entity of property.
 
  E.g. now I have such a mess in  HTML output (in browser it looks OK):
  #1086;#1087;#1080;#1089;#1072;#1085;#1080;#1077;
 
  How to disable encoding of every char but leave only encoding of
 special
  chars like?:
' 
  --
  View this message in context:
 
 http://old.nabble.com/Where-to-disable-encrypting-of-non-latin-chars--tp26535859p26535859.html
  Sent from the Struts - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 
  --
  Saeed Iqbal
  http://www.iqbalconsulting.com
  Struts - J2EE - Application Architect / Developer
 
 
 
 
  --
  Saeed Iqbal
  http://www.iqbalconsulting.com
  Struts - J2EE - Application Architect / Developer
 
 

 --
 View this message in context:
 http://old.nabble.com/Where-to-disable-encrypting-of-non-latin-chars--tp26535859p26545411.html
 Sent from the Struts - User mailing list archive at Nabble.com.


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




 --
 Saeed Iqbal
 http://www.iqbalconsulting.com
 Struts - J2EE - Application Architect / Developer




 --
 Saeed Iqbal
 http://www.iqbalconsulting.com
 Struts - J2EE - Application Architect / Developer


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



Re: jQuery Plugin

2009-06-09 Thread Miguel
I have a little js script that allows multiple targets (using jquery
selectors), using a comma separated list.

Should I mail it or put in on the wiki?
Also, I think better control is acchieved using selectors, than plain
targets. what do you think?

Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino



On Tue, Jun 9, 2009 at 15:34, Johannes Geppertjo...@web.de wrote:

 You can easily use Themes created with jQuery Themeroller.
 Take a look in the Wiki about Custume Themes

 http://code.google.com/p/struts2-jquery/wiki/HeadTag

 BTW: I also have handcoding befor but a taglib can speed up
 the development and reduce the javaScript Code in my jsp.


 mgainty wrote:


 anything different with ThemeRoller?

 BTW: nothing wrong with handcoding
 its what us old-timers had to do before IDEs

 Muchas Gracias/Vielen Danke
 Martin Gainty


 --
 View this message in context: 
 http://www.nabble.com/jQuery-Plugin-tp23925854p23950801.html
 Sent from the Struts - User mailing list archive at Nabble.com.


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



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



weird display tag behavior

2009-06-09 Thread Miguel
Hi all,
I decided to externally paginate the display tag, by implementing the
org.displaytag.pagination.PaginatedList interface in my struts action.
As I already had all the fields the interface defined (but with
different names), it's only adding some extra getters.
The weirdness comes here:
The PaginatedList is the action itself, so I put in my jsp:

s:set value=%{[0]} var=list/
display:table name=list ... .../display:table

The above didn't work, so I decided to put the following in my action:

public PaginatedList getPaginatedList ( ){ return this; }

and in the jsp,

display:table name=paginatedList ... .../display:table

and i worked!!

Can anyone explain why the second code works, but not the first?

Thanks

Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino

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



Re: jQuery Plugin

2009-06-08 Thread Miguel
I'll test it. I use jquery with s2 by hand (didn't understood the
dojo tags, so i made my own code), so it would be a great help to stop
hard coding the same 3 lines page by page.
Does uses the same syntax and names of the sx tags?

I'll post my findings.

Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino



On Mon, Jun 8, 2009 at 10:07, Johannes Geppertjo...@web.de wrote:

 Hello,

 since last Friday i have lunched a new jQuery plugin for struts2 at Google
 Code.
 http://code.google.com/p/struts2-jquery/

 It provides an AJAX Support for Links, Forms and Divs.
 Support for Themes from jQuery Themeroller and some
 Widgets from jQuery UI like Tabs, Datepicker, Dialog
 and Accordion.

 It would be great if anyone has some response for me,
 because its my first plugin fro struts2.

 Have fun with this

 Johannes Geppert
 http://www.jgeppert.com
 --
 View this message in context: 
 http://www.nabble.com/jQuery-Plugin-tp23925854p23925854.html
 Sent from the Struts - User mailing list archive at Nabble.com.


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



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



Re: Autowired and PostConstruct with Struts + Spring

2009-04-27 Thread Miguel
Check you only have one ocurrence of myService in your spring
configuration specially if it's in more than one file. Maybe there is
more than one instance and spring uses the last wins design
principle.

Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco Sobrino



On Mon, Apr 27, 2009 at 14:29, e_sli...@yahoo.it e_sli...@yahoo.it wrote:
 Hi Norris and Dave!

 Thank you for your answers.
 Yes, I have get/set methods for myService.

 If you means declaring: constant name=struts.objectFactory value=spring 
 / in my struts.xml for my object factory, yes. I don't have @Component for 
 Spring injection, but I suppose Spring work well as far as the myService bean 
 is available in my context for other beans in my app.

 I'm just wondering about @Autowired and @PostConstruct behaviour when passing 
 by Struts + Spring.
 Probably @PostConstruct is executed just before the @Autowired?
 Using pure Spring without Struts works well: running a JUnit test with my 
 @PostConstruct annotated method show myService is not null, but when this is 
 in a Struts action does not work...

 Has anybody see this behaviour?

 Thank you for your help!

 Emanuele

 Norris Shelton wrote:
 Did you set Spring to be your object factory in your struts.xml.  If you 
 used Spring annotations, did you annotate your bean to be injected with 
 @Component and designate a base package for Spring to scan for beans?


 Norris Shelton
 Software Engineer
 Sun Certified Java 1.1 Programmer
 Shelton Consulting, LLC
 ICQ# 26487421
 AIM NorrisEShelton
 YIM norrisshelton

 Is there a public myService setter?

 (I hardly even use annotations; maybe that's not necessary?)

 Dave



 
 From: e_sli...@yahoo.it e_sli...@yahoo.it
 To: user@struts.apache.org
 Sent: Monday, April 27, 2009 12:41:01 PM
 Subject: Autowired and PostConstruct with Struts + Spring

 Hello everybody!

 I'm trying to use my service into a Struts action but with no success.

 My struts action contains :

 @Autowired
 private MyService myService

 @PostConstruct
 public void init() {
   // use here myService
 }

 Unfortunately myService is always null and I cannot use myService in the 
 init() method...

 The bean myService should correctly declared in my application-context.xml:
 bean id=myService class=com.mypackage.MyServiceImpl
   property name=... ref=... /
   ...
 /bean

 and my struts.xml contains:
 constant name=struts.objectFactory value=spring /

 Where I'm wrong?
 Many Thanks!

 Emanuele








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



Re: Web Services

2009-03-17 Thread Miguel
You may take a look at Spring-WS. Remoting is like RMI over http,
meanwhile Spring-WS is a contract-first approach.

Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco S.



On Tue, Mar 17, 2009 at 09:02, Griffith, Michael *
michael.griff...@fda.hhs.gov wrote:
 Spring has excellent remoting abilities. If you are already using
 Spring, I'd check out Spring Remoting as my first option.

 -Original Message-
 From: Rafael Taboada [mailto:kaliman.fore...@gmail.com]
 Sent: Tuesday, March 17, 2009 7:39 AM
 To: user@struts.apache.org
 Subject: Web Services

 Hi list!

 I have a Struts2+Dojo+JPA+Spring project working fine in a production
 environment, but suddenly I have the requirement of exposing web
 services from my project. I mean, I need to implement web services about
 my project funcionality which other systems can consume.

 I'm completely new at web services. Please can you guide me how I can
 implement web services? Would Spring Web Services be a good point to
 start?

 Thanks in advance for your help!

 --
 Rafael Taboada

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



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



redirectAction with parameters

2009-02-17 Thread Miguel
)

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:419)

org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:378)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)
java.lang.Thread.run(Unknown Source)




Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco S.

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



  1   2   >