Re: redirectAction not working

2010-01-30 Thread Paweł Wielgus
Hi Rob,
you might try ConfigBrowserPlugin,
see why here:
http://poulwiel.blogspot.com/2009/09/config-browser-plugin-in-struts2.html

Best greetings,
Paweł Wielgus.


2010/1/30 Robby Atchison rob...@msn.com:
 Hello,



 I have the following configuration in a Struts.xml file.  The
 paramsPrepareParamsStack is the default interceptor stack.  AccountAction
 does not implement any interfaces.  Both BankcardAction and ECheckAction
 implement Preparable and ModelDriven.



                action name=account
 class=com.epa.actions.AccountAction

            result name=bankcard_browse      type=redirectAction

                  param name=actionbankcard_browse/param

            /result

            result name=echeck_browse type=redirectAction

                  param name=actionecheck_browse/param

            /result

      /action



      action name=bankcard_* method={1}
 class=com.epa.actions.BankcardAction 

            result name=successbankcarddetail.tile/result

            result name=inputbankcarddetail.tile/result

      /action



      action name=echeck_* method={1}
 class=com.epa.actions.ECheckAction 

            result name=successecheckdetail.tile/result

            result name=inputecheckdetail.tile/result

      /action



 Below is the execute method from AccountAction class..



                public String execute() {

            String actionName = bankcard_browse;

            if (StringUtils.equalsIgnoreCase(recordType, EC)) {

                  actionName = echeck_browse;

            }

            return actionName;

      }



 In my testing I get the error - No result defined for action
 com.epa.actions.AccountAction and result bankcard_browse. I can navigate
 straight to bankcard_browse (not going through AccountAction) without
 incident.  If I try to go to AccountAction first and redirect to
 bankcard_browse or echeck_browse I get the error. What am I doing wrong?
 I'm using Struts 2 version 2.1.8.1., Tiles 2.0.6, OGNL 2.7.3.    I hope I've
 included enough information.  Any help will be greatly appreciated as I've
 been struggling with this problem for too long.



 Best regards,

 Rob

 rob...@msn.com



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



Re: Modifying action mapping per device type

2010-01-30 Thread Marcus Bond

Hi Wes, thanks for the post.

I like the idea of being able to decorate screens differently depending 
on device without changing much existing code and I can see a use to 
this for example for pages being given a different footer to provide 
device specific links or adding side menus for devices with enough 
screen space. (The main focus of my web pages are application GUI rather 
than content). I do intend to look into sitemesh but I know nothing 
about it as yet. However, what sitemesh (I don't think anyway) cannot do 
is for example, for an old blackberry that does not support html tables 
very well, allow me to render a list of results in a business card style 
layout instead of a four column table - if it can then I'd be glad to 
know how and investigate it's use further as it would solve some of  the 
problems I encounter.



Wes Wannemacher wrote:

I admit that I haven't read the whole thread, so flame me if you
covered the answer already, but...

Have you looked at Sitemesh? I would suggest look at creating
different decorators for each of the devices you want to support, then
code your undecorated JSPs so that they can be decorated based on the
device accessing it. Sitemesh has a ton of different ways you can pick
the decorator, so I would imagine you'd be able to find a way to
abstract the decorator picking logic outside of your business logic.
Then, the advantage of the decorator pattern is that you can code your
UI screens and business logic once and just have the screens decorated
differently based on the abstracted decorator picking logic. (As a
bonus, you can add new decorators for new devices without changing
much)

-Wes

  



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



Re: Boolean Type Conversion

2010-01-30 Thread Roger
On Friday 29 January 2010 22:30:34 Wes Wannemacher wrote:
 I don't know if I'd go too far creating a TypeConverter... Can you
 just do something like this -
 
 s:if test=%{your.boolean.property}Y/s:ifs:elseN/s:else
 
 Really, you could probably create a .tag file out of it and reuse it
 easier than creating a Type Converter.
 
 -Wes
 
I can see that working to display, but when the user switches a field from Y 
to N how do I get false automagically returned in the relevant list entry?

-
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
        

Modifying action mapping per device type

2010-01-30 Thread Marcus Bond

Hi,

I am wanting to implement a site such that some actions may have a 
different mapping depending upon the device used (e.g. regular browser / 
mobile device etc.) but what I don't want to do is have to litter my 
actions with this type of logic. It could be at the result mapping level 
(i.e. in struts.xml) such that say a result of success would map to a 
jsp of somePage.jsp for regular browsers and somePageMobile.jsp for a 
mobile device (there will be more complications to this as I'd like to 
be able to have fine grained control based on the user agent so there 
may be many versions of a jsp such as somePageWinMobile6_5_htc.jsp).


There are  couple of ways I can think of to do this, but they're ugly:
- JSP level logic to render the page differently - dont want it, I'd 
rather individual jsp's for each supported device (or family) as this 
allows developers who are working on targeting a site to a specific 
device to concentrate on that device.
- Tiles template level logic - again not ideal as I would like to be 
able to use specific templates for device types.


Better but not perfect would be some sort of post action result 
modifying interceptor such that in the struts.xml I could define a 
number of different result mappings such as success, success_winmob, 
success_blackberry_storm and have the result string that has been 
returned from the action (success) modified by some sort of interceptor 
(e.g. appending the suffix prior to struts mapping it off to a view)  - 
the filter itself could be configured as to whether or not to alter 
result strings based on the action and the user device. - Is it possible 
to modify the result string post action but prior to struts resolving 
the mapping? And if so would I have access to the the name of the action?


Any suggestions here are greatly appreciated!
Web technologies being used are Struts2, Tiles2 and JSP.

Regards,
Marcus

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



interceptor is not being called for all action

2010-01-30 Thread Jake Vang
i have written an interceptor implementation, however, it seems i cannot get
it to work. i have followed the instructions at
http://struts.apache.org/2.x/docs/interceptors.html. i have also followed
the instructions at
http://struts.apache.org/2.x/docs/how-do-we-configure-an-interceptor-to-be-used-with-every-action.htmlto
use the interceptor with every action.

however, when any of my actions run, i never see the pre and post processing
logging messages (logging messages inside the intercept method). i do see
the logging messages from the init and destroy methods. this is not a
problem with logging (as for sanity checking, i also use System.out.println,
and have Tomcat running in console mode). i also have placed some break
points in the intercept(ActionInvocation) method, but these break points are
never reached.

this is my struts.xml.

struts
package name=default extends=struts-default
interceptors
interceptor name=dummyInterceptor
class=mypackage.DummyInterceptor/
interceptor-stack name=dummyStack
interceptor-ref name=dummyInterceptor/
interceptor-ref name=defaultStack/
/interceptor-stack
/interceptors
default-interceptor-ref name=dummyStack/
/package
/struts

this is my DummyInterceptor class.

public class DummyInterceptor implements Interceptor {
private static final Log _log =
LogFactory.getLog(DummyInterceptor.class);
public void destroy() {
_log.debug(dummy interceptor destroyed called);
System.out.println(dummy interceptor destroyed
called.toUpperCase());
}
public void init() {
_log.debug(dummy interceptor init called);
System.out.println(dummy interceptor init called.toUpperCase());
}
public String intercept(ActionInvocation actionInvocation) throws
Exception {
_log.debug(dummy interceptor intercept pre processing);
System.out.println(dummy interceptor intercept pre
processing.toUpperCase());

String result = actionInvocation.invoke();

_log.debug(dummy interceptor intercept post processing);
System.out.println(dummy interceptor intercept post
processing.toUpperCase());
return result;
}
}

i am using annotations for my Action classes, so i do not define any
action elements in struts.xml (using the Struts2 Convention jar).

one very interesting thing i did was to get struts-default.xml out of the
struts2-core-2.1.8.1.jar. i then modified struts-default.xml by adding: 1) a
definition of my interceptor and 2) my interceptor onto the defaultStack.
when i did this, my interceptor does work as expected (i see logging output
from the intercept method, i can hit break points set inside this method)
for all my actions.

i wonder if there is some gotcha that i am missing here. is there something
extra that i have to do when mixing annotations with interceptors?

thanks.


Re: interceptor is not being called for all action

2010-01-30 Thread Dave Newton
http://struts.apache.org/2.x/docs/convention-plugin.html#ConventionPlugin-XWorkpackages


- Original Message 
 From: Jake Vang vangj...@googlemail.com
 To: user@struts.apache.org
 Sent: Sat, January 30, 2010 4:10:31 PM
 Subject: interceptor is not being called for all action
 
 i have written an interceptor implementation, however, it seems i cannot get
 it to work. i have followed the instructions at
 http://struts.apache.org/2.x/docs/interceptors.html. i have also followed
 the instructions at
 http://struts.apache.org/2.x/docs/how-do-we-configure-an-interceptor-to-be-used-with-every-action.htmlto
 use the interceptor with every action.
 
 however, when any of my actions run, i never see the pre and post processing
 logging messages (logging messages inside the intercept method). i do see
 the logging messages from the init and destroy methods. this is not a
 problem with logging (as for sanity checking, i also use System.out.println,
 and have Tomcat running in console mode). i also have placed some break
 points in the intercept(ActionInvocation) method, but these break points are
 never reached.
 
 this is my struts.xml.
 
 
 
 
 
 class=mypackage.DummyInterceptor/
 
 
 
 
 
 
 
 
 
 this is my DummyInterceptor class.
 
 public class DummyInterceptor implements Interceptor {
 private static final Log _log =
 LogFactory.getLog(DummyInterceptor.class);
 public void destroy() {
 _log.debug(dummy interceptor destroyed called);
 System.out.println(dummy interceptor destroyed
 called.toUpperCase());
 }
 public void init() {
 _log.debug(dummy interceptor init called);
 System.out.println(dummy interceptor init called.toUpperCase());
 }
 public String intercept(ActionInvocation actionInvocation) throws
 Exception {
 _log.debug(dummy interceptor intercept pre processing);
 System.out.println(dummy interceptor intercept pre
 processing.toUpperCase());
 
 String result = actionInvocation.invoke();
 
 _log.debug(dummy interceptor intercept post processing);
 System.out.println(dummy interceptor intercept post
 processing.toUpperCase());
 return result;
 }
 }
 
 i am using annotations for my Action classes, so i do not define any
 elements in struts.xml (using the Struts2 Convention jar).
 
 one very interesting thing i did was to get struts-default.xml out of the
 struts2-core-2.1.8.1.jar. i then modified struts-default.xml by adding: 1) a
 definition of my interceptor and 2) my interceptor onto the defaultStack.
 when i did this, my interceptor does work as expected (i see logging output
 from the intercept method, i can hit break points set inside this method)
 for all my actions.
 
 i wonder if there is some gotcha that i am missing here. is there something
 extra that i have to do when mixing annotations with interceptors?
 
 thanks.


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



Re: interceptor is not being called for all action

2010-01-30 Thread Jake Vang
what does that have to do with my problem? please enlighten.

On Sat, Jan 30, 2010 at 4:37 PM, Dave Newton newton.d...@yahoo.com wrote:


 http://struts.apache.org/2.x/docs/convention-plugin.html#ConventionPlugin-XWorkpackages


 - Original Message 
  From: Jake Vang vangj...@googlemail.com
  To: user@struts.apache.org
  Sent: Sat, January 30, 2010 4:10:31 PM
  Subject: interceptor is not being called for all action
 
  i have written an interceptor implementation, however, it seems i cannot
 get
  it to work. i have followed the instructions at
  http://struts.apache.org/2.x/docs/interceptors.html. i have also
 followed
  the instructions at
 
 http://struts.apache.org/2.x/docs/how-do-we-configure-an-interceptor-to-be-used-with-every-action.htmlto
  use the interceptor with every action.
 
  however, when any of my actions run, i never see the pre and post
 processing
  logging messages (logging messages inside the intercept method). i do see
  the logging messages from the init and destroy methods. this is not a
  problem with logging (as for sanity checking, i also use
 System.out.println,
  and have Tomcat running in console mode). i also have placed some break
  points in the intercept(ActionInvocation) method, but these break points
 are
  never reached.
 
  this is my struts.xml.
 
 
 
 
 
  class=mypackage.DummyInterceptor/
 
 
 
 
 
 
 
 
 
  this is my DummyInterceptor class.
 
  public class DummyInterceptor implements Interceptor {
  private static final Log _log =
  LogFactory.getLog(DummyInterceptor.class);
  public void destroy() {
  _log.debug(dummy interceptor destroyed called);
  System.out.println(dummy interceptor destroyed
  called.toUpperCase());
  }
  public void init() {
  _log.debug(dummy interceptor init called);
  System.out.println(dummy interceptor init
 called.toUpperCase());
  }
  public String intercept(ActionInvocation actionInvocation) throws
  Exception {
  _log.debug(dummy interceptor intercept pre processing);
  System.out.println(dummy interceptor intercept pre
  processing.toUpperCase());
 
  String result = actionInvocation.invoke();
 
  _log.debug(dummy interceptor intercept post processing);
  System.out.println(dummy interceptor intercept post
  processing.toUpperCase());
  return result;
  }
  }
 
  i am using annotations for my Action classes, so i do not define any
  elements in struts.xml (using the Struts2 Convention jar).
 
  one very interesting thing i did was to get struts-default.xml out of the
  struts2-core-2.1.8.1.jar. i then modified struts-default.xml by adding:
 1) a
  definition of my interceptor and 2) my interceptor onto the defaultStack.
  when i did this, my interceptor does work as expected (i see logging
 output
  from the intercept method, i can hit break points set inside this method)
  for all my actions.
 
  i wonder if there is some gotcha that i am missing here. is there
 something
  extra that i have to do when mixing annotations with interceptors?
 
  thanks.


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




Re: interceptor is not being called for all action

2010-01-30 Thread Jake Vang
i read that section on that page 10 times and i don't know how that relates
to my problem. there's simply not enough information. i guess it's pointing
me to something about namespaces, but, how do we get around this?

on the other hand, the rest of that page was informative on annotations and
the convention plugin. when i added
interceptorref...@interceptorref(dummyStack)} to the Action class' execute
method, the web application won't start up.

ERROR
com.opensymphony.xwork2.util.logging.commons.CommonsLogger.error(CommonsLogger.java:27)
- Dispatcher initialization failed
...
Caused by: Unable to find interceptor class referenced by ref-name
dummyStack - [unknown location]

how hard can it be to get this to work? interestingly, if i do this,
interceptorref...@interceptorref(defaultStack)}, all is fine and dandy
(but then, my Interceptor is not called).

On Sat, Jan 30, 2010 at 4:37 PM, Dave Newton newton.d...@yahoo.com wrote:


 http://struts.apache.org/2.x/docs/convention-plugin.html#ConventionPlugin-XWorkpackages


 - Original Message 
  From: Jake Vang vangj...@googlemail.com
  To: user@struts.apache.org
  Sent: Sat, January 30, 2010 4:10:31 PM
  Subject: interceptor is not being called for all action
 
  i have written an interceptor implementation, however, it seems i cannot
 get
  it to work. i have followed the instructions at
  http://struts.apache.org/2.x/docs/interceptors.html. i have also
 followed
  the instructions at
 
 http://struts.apache.org/2.x/docs/how-do-we-configure-an-interceptor-to-be-used-with-every-action.htmlto
  use the interceptor with every action.
 
  however, when any of my actions run, i never see the pre and post
 processing
  logging messages (logging messages inside the intercept method). i do see
  the logging messages from the init and destroy methods. this is not a
  problem with logging (as for sanity checking, i also use
 System.out.println,
  and have Tomcat running in console mode). i also have placed some break
  points in the intercept(ActionInvocation) method, but these break points
 are
  never reached.
 
  this is my struts.xml.
 
 
 
 
 
  class=mypackage.DummyInterceptor/
 
 
 
 
 
 
 
 
 
  this is my DummyInterceptor class.
 
  public class DummyInterceptor implements Interceptor {
  private static final Log _log =
  LogFactory.getLog(DummyInterceptor.class);
  public void destroy() {
  _log.debug(dummy interceptor destroyed called);
  System.out.println(dummy interceptor destroyed
  called.toUpperCase());
  }
  public void init() {
  _log.debug(dummy interceptor init called);
  System.out.println(dummy interceptor init
 called.toUpperCase());
  }
  public String intercept(ActionInvocation actionInvocation) throws
  Exception {
  _log.debug(dummy interceptor intercept pre processing);
  System.out.println(dummy interceptor intercept pre
  processing.toUpperCase());
 
  String result = actionInvocation.invoke();
 
  _log.debug(dummy interceptor intercept post processing);
  System.out.println(dummy interceptor intercept post
  processing.toUpperCase());
  return result;
  }
  }
 
  i am using annotations for my Action classes, so i do not define any
  elements in struts.xml (using the Struts2 Convention jar).
 
  one very interesting thing i did was to get struts-default.xml out of the
  struts2-core-2.1.8.1.jar. i then modified struts-default.xml by adding:
 1) a
  definition of my interceptor and 2) my interceptor onto the defaultStack.
  when i did this, my interceptor does work as expected (i see logging
 output
  from the intercept method, i can hit break points set inside this method)
  for all my actions.
 
  i wonder if there is some gotcha that i am missing here. is there
 something
  extra that i have to do when mixing annotations with interceptors?
 
  thanks.


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




Re: interceptor is not being called for all action

2010-01-30 Thread Jake Vang
okay, after fiddling around for 2 hours, with the weak documentation out
there, i think i have it figured out. at least empirically, it works now.
just in case there are other users out there who are running into this
problem, let me explain what in the world i did. i know A LOT of other
people have run into this problem on how to get interceptors to work with
the convention plugin (googling). the shame is that although i saw a lot of
thanks, i got it working, no one ever bothered to show how they got it to
work.

at any rate, if you read the original post by me, you will see how my
interceptor stack was defined in struts.xml. you will also see how i
implemented a dummy interceptor. i had to do two things to get my
interceptor working (called on my action).
1. add @ParentPackage(default) to my Action class
2. add @interceptorref...@interceptorref(dummyStack) to my execute method
(in my Action class).

after i did this, my interceptor's intercept(ActionInvocation) method is
called when my Action is called.

here's how my dummy Action class looks like.

@ParentPackage(default)
public class DummyAction extends ActionSupport {
 @Action(value=/dummy,
  result...@result(name=success,location=dummy-success.jsp)},
  interceptorref...@interceptorref(dummyStack)}
 )
 public String execute() {
  return SUCCESS;
 }
}

alright, so, now i'd like to know how to get this interceptor stack
(dummyStack) to work on all actions? in the link i posted, you can do so
using one single line in struts.xml (i.e. default-interceptor-ref
name=dummyStack/). with the convention plugin + annotations, is such a
simple approach possible? or do i have to continuously add @ParentPackage
and @InterceptorRef annotations to the classes and methods i want to use the
stack?

i don't know why this is such a pain (but then again, i'm not a developer on
the struts2 project, so there may be a lot of complexities to get this
working elegantly that i'm unaware of).

On Sat, Jan 30, 2010 at 4:10 PM, Jake Vang vangj...@googlemail.com wrote:

 i have written an interceptor implementation, however, it seems i cannot
 get it to work. i have followed the instructions at
 http://struts.apache.org/2.x/docs/interceptors.html. i have also followed
 the instructions at
 http://struts.apache.org/2.x/docs/how-do-we-configure-an-interceptor-to-be-used-with-every-action.htmlto
  use the interceptor with every action.

 however, when any of my actions run, i never see the pre and post
 processing logging messages (logging messages inside the intercept method).
 i do see the logging messages from the init and destroy methods. this is not
 a problem with logging (as for sanity checking, i also use
 System.out.println, and have Tomcat running in console mode). i also have
 placed some break points in the intercept(ActionInvocation) method, but
 these break points are never reached.

 this is my struts.xml.

 struts
 package name=default extends=struts-default
 interceptors
 interceptor name=dummyInterceptor
 class=mypackage.DummyInterceptor/
 interceptor-stack name=dummyStack
 interceptor-ref name=dummyInterceptor/
 interceptor-ref name=defaultStack/
 /interceptor-stack
 /interceptors
 default-interceptor-ref name=dummyStack/
 /package
 /struts

 this is my DummyInterceptor class.

 public class DummyInterceptor implements Interceptor {
 private static final Log _log =
 LogFactory.getLog(DummyInterceptor.class);
 public void destroy() {
 _log.debug(dummy interceptor destroyed called);
 System.out.println(dummy interceptor destroyed
 called.toUpperCase());
 }
 public void init() {
 _log.debug(dummy interceptor init called);
 System.out.println(dummy interceptor init called.toUpperCase());
 }
 public String intercept(ActionInvocation actionInvocation) throws
 Exception {
 _log.debug(dummy interceptor intercept pre processing);
 System.out.println(dummy interceptor intercept pre
 processing.toUpperCase());

 String result = actionInvocation.invoke();

 _log.debug(dummy interceptor intercept post processing);
 System.out.println(dummy interceptor intercept post
 processing.toUpperCase());
 return result;
 }
 }

 i am using annotations for my Action classes, so i do not define any
 action elements in struts.xml (using the Struts2 Convention jar).

 one very interesting thing i did was to get struts-default.xml out of the
 struts2-core-2.1.8.1.jar. i then modified struts-default.xml by adding: 1) a
 definition of my interceptor and 2) my interceptor onto the defaultStack.
 when i did this, my interceptor does work as expected (i see logging output
 from the intercept method, i can hit break points set inside this method)
 for all my actions.

 i wonder if there is some gotcha that i am missing here. is there something
 extra that i have to do when mixing annotations with 

Re: interceptor is not being called for all action

2010-01-30 Thread Jake Vang
okay, to answer my own question, yes, if you configure everything correctly,
then you can get a customized stack to work for all Actions. the only thing
you really need to do is add this line to struts.xml

constant name=struts.convention.default.parent.package value=default/

with this defined, you can remove the @ParentPackage and @InterceptorRef
from the classes and methods.

wow, it was that easy.

On Sat, Jan 30, 2010 at 6:14 PM, Jake Vang vangj...@googlemail.com wrote:

 okay, after fiddling around for 2 hours, with the weak documentation out
 there, i think i have it figured out. at least empirically, it works now.
 just in case there are other users out there who are running into this
 problem, let me explain what in the world i did. i know A LOT of other
 people have run into this problem on how to get interceptors to work with
 the convention plugin (googling). the shame is that although i saw a lot of
 thanks, i got it working, no one ever bothered to show how they got it to
 work.

 at any rate, if you read the original post by me, you will see how my
 interceptor stack was defined in struts.xml. you will also see how i
 implemented a dummy interceptor. i had to do two things to get my
 interceptor working (called on my action).
 1. add @ParentPackage(default) to my Action class
 2. add @interceptorref...@interceptorref(dummyStack) to my execute method
 (in my Action class).

 after i did this, my interceptor's intercept(ActionInvocation) method is
 called when my Action is called.

 here's how my dummy Action class looks like.

 @ParentPackage(default)
 public class DummyAction extends ActionSupport {
  @Action(value=/dummy,
   result...@result(name=success,location=dummy-success.jsp)},
   interceptorref...@interceptorref(dummyStack)}
  )
  public String execute() {
   return SUCCESS;
  }
 }

 alright, so, now i'd like to know how to get this interceptor stack
 (dummyStack) to work on all actions? in the link i posted, you can do so
 using one single line in struts.xml (i.e. default-interceptor-ref
 name=dummyStack/). with the convention plugin + annotations, is such a
 simple approach possible? or do i have to continuously add @ParentPackage
 and @InterceptorRef annotations to the classes and methods i want to use the
 stack?

 i don't know why this is such a pain (but then again, i'm not a developer
 on the struts2 project, so there may be a lot of complexities to get this
 working elegantly that i'm unaware of).

 On Sat, Jan 30, 2010 at 4:10 PM, Jake Vang vangj...@googlemail.comwrote:

 i have written an interceptor implementation, however, it seems i cannot
 get it to work. i have followed the instructions at
 http://struts.apache.org/2.x/docs/interceptors.html. i have also followed
 the instructions at
 http://struts.apache.org/2.x/docs/how-do-we-configure-an-interceptor-to-be-used-with-every-action.htmlto
  use the interceptor with every action.

 however, when any of my actions run, i never see the pre and post
 processing logging messages (logging messages inside the intercept method).
 i do see the logging messages from the init and destroy methods. this is not
 a problem with logging (as for sanity checking, i also use
 System.out.println, and have Tomcat running in console mode). i also have
 placed some break points in the intercept(ActionInvocation) method, but
 these break points are never reached.

 this is my struts.xml.

 struts
 package name=default extends=struts-default
 interceptors
 interceptor name=dummyInterceptor
 class=mypackage.DummyInterceptor/
 interceptor-stack name=dummyStack
 interceptor-ref name=dummyInterceptor/
 interceptor-ref name=defaultStack/
 /interceptor-stack
 /interceptors
 default-interceptor-ref name=dummyStack/
 /package
 /struts

 this is my DummyInterceptor class.

 public class DummyInterceptor implements Interceptor {
 private static final Log _log =
 LogFactory.getLog(DummyInterceptor.class);
 public void destroy() {
 _log.debug(dummy interceptor destroyed called);
 System.out.println(dummy interceptor destroyed
 called.toUpperCase());
 }
 public void init() {
 _log.debug(dummy interceptor init called);
 System.out.println(dummy interceptor init called.toUpperCase());
 }
 public String intercept(ActionInvocation actionInvocation) throws
 Exception {
 _log.debug(dummy interceptor intercept pre processing);
 System.out.println(dummy interceptor intercept pre
 processing.toUpperCase());

 String result = actionInvocation.invoke();

 _log.debug(dummy interceptor intercept post processing);
 System.out.println(dummy interceptor intercept post
 processing.toUpperCase());
 return result;
 }
 }

 i am using annotations for my Action classes, so i do not define any
 action elements in struts.xml (using the Struts2 Convention jar).

 one very 

RE: redirectAction not working

2010-01-30 Thread Robby Atchison
Thanks for the suggestion.  The configbrowser plugin indicates there are no 
results for the action in question.  The question is why.

Thanks,
Rob

-Original Message-
From: Paweł Wielgus [mailto:poulw...@gmail.com] 
Sent: Saturday, January 30, 2010 6:03 AM
To: Struts Users Mailing List
Subject: Re: redirectAction not working

Hi Rob,
you might try ConfigBrowserPlugin,
see why here:
http://poulwiel.blogspot.com/2009/09/config-browser-plugin-in-struts2.html

Best greetings,
Paweł Wielgus.


2010/1/30 Robby Atchison rob...@msn.com:
 Hello,



 I have the following configuration in a Struts.xml file.  The
 paramsPrepareParamsStack is the default interceptor stack.  AccountAction
 does not implement any interfaces.  Both BankcardAction and ECheckAction
 implement Preparable and ModelDriven.



action name=account
 class=com.epa.actions.AccountAction

result name=bankcard_browse  type=redirectAction

  param name=actionbankcard_browse/param

/result

result name=echeck_browse type=redirectAction

  param name=actionecheck_browse/param

/result

  /action



  action name=bankcard_* method={1}
 class=com.epa.actions.BankcardAction 

result name=successbankcarddetail.tile/result

result name=inputbankcarddetail.tile/result

  /action



  action name=echeck_* method={1}
 class=com.epa.actions.ECheckAction 

result name=successecheckdetail.tile/result

result name=inputecheckdetail.tile/result

  /action



 Below is the execute method from AccountAction class..



public String execute() {

String actionName = bankcard_browse;

if (StringUtils.equalsIgnoreCase(recordType, EC)) {

  actionName = echeck_browse;

}

return actionName;

  }



 In my testing I get the error - No result defined for action
 com.epa.actions.AccountAction and result bankcard_browse. I can navigate
 straight to bankcard_browse (not going through AccountAction) without
 incident.  If I try to go to AccountAction first and redirect to
 bankcard_browse or echeck_browse I get the error. What am I doing wrong?
 I'm using Struts 2 version 2.1.8.1., Tiles 2.0.6, OGNL 2.7.3.I hope I've
 included enough information.  Any help will be greatly appreciated as I've
 been struggling with this problem for too long.



 Best regards,

 Rob

 rob...@msn.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



gwt and struts 2

2010-01-30 Thread Michael Finney
Hi,

I am curious if / how people are getting GWT and Struts2 to work
together in the GWT development environment.

If you did get it to work, did you just copy files from your existing
struts 2 outputs to the war file so GWT can see it?  ( war file
mentioned at 
http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideDirectoriesPackageConventions
 )

I use eclipse, the GWT eclipse plugin, and ant. I'm considering just
using an ant script to copy files to where GWT needs it.

Thanks for sharing your insights on how to have struts 2 and GWT work
well together.

-- 
Michael Finney - Always Striving To Serve You Better Every Day
http://www.SmilingSoftwareSolutions.com

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