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


using xwork validator programatically?

2011-11-16 Thread Josep García
Is there any documentation on how to call xwork validation programatically?

The context: I have a dynamic form, which is a freemarker template, which
can have any fields that are then saved as xml in my Struts action.
I would like to have the possibility to call validation with a specific
*-validation.xml, defined at runtime, associated to the freemarker
template, so that I can apply xml defined validators against my action
context value stack. Is that possible?

Cheers,
Josep


RE: provide Helloworld application in Struts2.0

2011-11-16 Thread Praveen Jain
Dear  
Ilya Kazakevich , 
I have tried to put hello.html in the root of my aplication  and put the URL as 
you suggest 

http://localhost:8080/HelloWorldStruts2/hello.html 
But now I am getting error message as under.  

The requested resource (/HelloWorldStruts2/hello.html) is not available.



Please find my Log  status as you require as an attached file. 

Thanks 
Praveen Jain






--- On Tue, 11/15/11, Ilya Kazakevich ilya.kazakev...@jetbrains.com wrote:

From: Ilya Kazakevich ilya.kazakev...@jetbrains.com
Subject: RE: provide Helloworld application in Struts2.0
To: 'Struts Users Mailing List' user@struts.apache.org
Date: Tuesday, November 15, 2011, 11:29 AM

Does your context works?
Try to put hello.html file in the root of your .war file

Then open it: /HelloWorldStruts2/hello.html

Show us your logs please
 


Ilya Kazakevich,
Developer
JetBrains Inc
http://www.jetbrains.com
Develop with pleasure!

-Original Message-
From: Praveen Jain [mailto:jain_praveen_mail...@yahoo.com] 
Sent: Tuesday, November 15, 2011 11:14 PM
To: Struts Users Mailing List
Subject: RE: provide Helloworld application in Struts2.0

On using it is showing the error as follows 

HTTP Status 404 - /HelloWorldStruts2/HelloWorldAction.actiontype Status
reportmessage /HelloWorldStruts2/HelloWorldAction.actiondescription The
requested resource (/HelloWorldStruts2/HelloWorldAction.action) is not
available.


Thanks, Praveen Jain




--- On Tue, 11/15/11, Ilya Kazakevich ilya.kazakev...@jetbrains.com wrote:

From: Ilya Kazakevich ilya.kazakev...@jetbrains.com
Subject: RE: provide Helloworld application in Struts2.0
To: 'Struts Users Mailing List' user@struts.apache.org
Date: Tuesday, November 15, 2011, 10:31 AM

 What URL do you use?

Struts uses .action extension by default. 

Try /HelloWorldStruts2/HelloWorldAction.action if HelloWorldStruts2 is your
.war file name


 


Ilya Kazakevich,
Developer
JetBrains Inc
http://www.jetbrains.com
Develop with pleasure!

-Original Message-
From: Praveen Jain [mailto:jain_praveen_mail...@yahoo.com] 
Sent: Tuesday, November 15, 2011 9:52 PM
To: Struts Users Mailing List
Subject: Re: provide Helloworld application in Struts2.0

Dear Demo, Still it is not running and following error message is occurring 

HTTP Status 404 - /HelloWorldStruts2/


type Status report
message /HelloWorldStruts2/
description The requested resource (/HelloWorldStruts2/) is not 
available.


Apache Tomcat/5.0.28


Thanks Praveen Jain 

--- On Mon, 11/14/11, Damian Krawcewicz dkrawcew...@gmail.com wrote:

From: Damian Krawcewicz dkrawcew...@gmail.com
Subject: Re: provide Helloworld application in Struts2.0
To: Struts Users Mailing List user@struts.apache.org
Date: Monday, November 14, 2011, 8:58 AM

For starters, this line:
package name=Struts2  namespace= / struts-default

either remove struts-default or change it to: extends=struts-default

Damo

On 14 November 2011 16:53, Praveen Jain
jain_praveen_mail...@yahoo.comwrote:

 Yes I made a Simple hello application in Servlet and it is running fine.
 But my hello world application in struts  is not running please find the
 four files which compose the application i have made 4 files index.jsp ,
 Helloworld.jsp , web.xml , struts.xml

 Please go through the code and help me out to run the application.
 code for index.jsp
 %@ page language=java contentType=text/html; charset=ISO-8859-1
    pageEncoding=ISO-8859-1%
 %@taglib prefix=s uri=/struts-tags %
 !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN 
 http://www.w3.org/TR/html4/loose.dtd;
 html
 head
 meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
 titleHello World/title
 /head
 body
 h1Hello World fron struts 2  /h1
 form action=HelloWorldAction
 label for=name      Please enter ur name/labelbr
 input type=text name=name/
 input type=submit value=Say Hello
 /form
 /body
 /html Code for Helloworld.jsp
 %@ page language=java contentType=text/html; charset=ISO-8859-1
    pageEncoding=ISO-8859-1%
 %@taglib prefix=s uri=/struts-tags %
 !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN 
 http://www.w3.org/TR/html4/loose.dtd;
 html
 head
 meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
 titleHello World JSP/title
 /head

 body
 Hello world,s:property value=name/

 /body
 /html



  Code for Web.xml
 ?xml version=1.0 encoding=UTF-8?
 web-app id=WebApp_ID version=2.4 xmlns=
 http://java.sun.com/xml/ns/j2ee; xmlns:xsi=
 http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=
 http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;

        display-nameHelloWorldStruts2/display-name
        welcome-file-list
                welcome-fileindex.jsp/welcome-file
        /welcome-file-list
        filter
                filter-nameStruts2/filter-name

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

        filter-mapping
                                        filter-nameStruts2/filter-name
  

Re: provide Helloworld application in Struts2.0

2011-11-16 Thread Dave Newton
What libraries are you deploying in your WEB-INF/lib?

Dave

On Wed, Nov 16, 2011 at 1:06 PM, Praveen Jain 
jain_praveen_mail...@yahoo.com wrote:

 Dear   *Ilya Kazakevich* ,


 I have tried to put hello.html in the root of my aplication  and put the
 URL as you suggest


 http://localhost:8080/HelloWorldStruts2/hello.html


 But now I am getting error message as under.


 *The requested resource (/HelloWorldStruts2/hello.html) is not available.*

 *
 *

 *
 *

 *
 *

 *Please find my Log  status as you require as an attached file.
 *

 *
 *

 *Thanks
 *

 *Praveen Jain
 *

 *
 *

 *
 *

 *
 *

 *
 *



 --- On *Tue, 11/15/11, Ilya Kazakevich ilya.kazakev...@jetbrains.com*wrote:


 From: Ilya Kazakevich ilya.kazakev...@jetbrains.com
 Subject: RE: provide Helloworld application in Struts2.0
 To: 'Struts Users Mailing List' user@struts.apache.org
 Date: Tuesday, November 15, 2011, 11:29 AM

 Does your context works?
 Try to put hello.html file in the root of your .war file

 Then open it: /HelloWorldStruts2/hello.html

 Show us your logs please



 Ilya Kazakevich,
 Developer
 JetBrains Inc
 http://www.jetbrains.com
 Develop with pleasure!

 -Original Message-
 From: Praveen Jain 
 [mailto:jain_praveen_mail...@yahoo.comhttp://mc/compose?to=jain_praveen_mail...@yahoo.com]

 Sent: Tuesday, November 15, 2011 11:14 PM
 To: Struts Users Mailing List
 Subject: RE: provide Helloworld application in Struts2.0

 On using it is showing the error as follows

 HTTP Status 404 - /HelloWorldStruts2/HelloWorldAction.actiontype Status
 reportmessage /HelloWorldStruts2/HelloWorldAction.actiondescription The
 requested resource (/HelloWorldStruts2/HelloWorldAction.action) is not
 available.


 Thanks, Praveen Jain




 --- On Tue, 11/15/11, Ilya Kazakevich 
 ilya.kazakev...@jetbrains.comhttp://mc/compose?to=ilya.kazakev...@jetbrains.com
 wrote:

 From: Ilya Kazakevich 
 ilya.kazakev...@jetbrains.comhttp://mc/compose?to=ilya.kazakev...@jetbrains.com
 
 Subject: RE: provide Helloworld application in Struts2.0
 To: 'Struts Users Mailing List' 
 user@struts.apache.orghttp://mc/compose?to=user@struts.apache.org
 
 Date: Tuesday, November 15, 2011, 10:31 AM

 What URL do you use?

 Struts uses .action extension by default.

 Try /HelloWorldStruts2/HelloWorldAction.action if HelloWorldStruts2 is your
 .war file name





 Ilya Kazakevich,
 Developer
 JetBrains Inc
 http://www.jetbrains.com
 Develop with pleasure!

 -Original Message-
 From: Praveen Jain 
 [mailto:jain_praveen_mail...@yahoo.comhttp://mc/compose?to=jain_praveen_mail...@yahoo.com]

 Sent: Tuesday, November 15, 2011 9:52 PM
 To: Struts Users Mailing List
 Subject: Re: provide Helloworld application in Struts2.0

 Dear Demo, Still it is not running and following error message is
 occurring

 HTTP Status 404 - /HelloWorldStruts2/


 type Status report
 message /HelloWorldStruts2/
 description The requested resource (/HelloWorldStruts2/) is not
 available.


 Apache Tomcat/5.0.28


 Thanks Praveen Jain

 --- On Mon, 11/14/11, Damian Krawcewicz 
 dkrawcew...@gmail.comhttp://mc/compose?to=dkrawcew...@gmail.com
 wrote:

 From: Damian Krawcewicz 
 dkrawcew...@gmail.comhttp://mc/compose?to=dkrawcew...@gmail.com
 
 Subject: Re: provide Helloworld application in Struts2.0
 To: Struts Users Mailing List 
 user@struts.apache.orghttp://mc/compose?to=user@struts.apache.org
 
 Date: Monday, November 14, 2011, 8:58 AM

 For starters, this line:
 package name=Struts2  namespace= / struts-default

 either remove struts-default or change it to: extends=struts-default

 Damo

 On 14 November 2011 16:53, Praveen Jain
 jain_praveen_mail...@yahoo.comhttp://mc/compose?to=jain_praveen_mail...@yahoo.com
 wrote:

  Yes I made a Simple hello application in Servlet and it is running fine.
  But my hello world application in struts  is not running please find the
  four files which compose the application i have made 4 files index.jsp ,
  Helloworld.jsp , web.xml , struts.xml
 
  Please go through the code and help me out to run the application.
  code for index.jsp
  %@ page language=java contentType=text/html; charset=ISO-8859-1
 pageEncoding=ISO-8859-1%
  %@taglib prefix=s uri=/struts-tags %
  !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN 
  http://www.w3.org/TR/html4/loose.dtd;
  html
  head
  meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
  titleHello World/title
  /head
  body
  h1Hello World fron struts 2  /h1
  form action=HelloWorldAction
  label for=name  Please enter ur name/labelbr
  input type=text name=name/
  input type=submit value=Say Hello
  /form
  /body
  /html Code for Helloworld.jsp
  %@ page language=java contentType=text/html; charset=ISO-8859-1
 pageEncoding=ISO-8859-1%
  %@taglib prefix=s uri=/struts-tags %
  !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN 
  http://www.w3.org/TR/html4/loose.dtd;
  html
  head
  meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
  titleHello World 

object set in session in interceptor not available to JSP for first launch.

2011-11-16 Thread Jyothrilinga Rao
Hi,

I have the following configuration snippet in my struts.xml:


package name=*default* namespace=*/* extends=*struts-default*
  interceptors
   interceptor name=interceptor1
class=com.abc.interceptors.MenuInterceptor
   /interceptor
   interceptor-stack name=myStack
interceptor-ref name=defaultStack
 param name=exception.logEnabledtrue/param
 param name=exception.logLevelERROR/param
/interceptor-ref
interceptor-ref name=interceptor1 /
   /interceptor-stack
  /interceptors
  default-interceptor-ref name=myStack/default-interceptor-ref

i.e I have a interceptor which I am calling after the defaultStack executes.

My MenuInterceptor has the following code fragment in my intercept method
of MenuInterceptor

ActionContext ac = actionInvocation.getInvocationContext();
String result = actionInvocation.invoke();

  if( null==ac.getSession().get(menu)){
menu = parser.getMenu();
ac.getSession().put(menu, menu);
  }
LOG.debug(menu from session at end of intercept is:
+ac.getSession().get(menu));
return result;

i.e after the action logic executes, I am checking if the sesssion has the
object. if the object is not present I am populating it and storing in the
session.
my LOG outputs valid object in the first launch also.

When I execute for the first time, the menu object is not available in the
JSP, however if I refresh the page, the menu object is available in the JSP.
I could not have my custom interceptor to execute after the default
interceptors stack as the result already gets comitted and I cannot put
object in my session.
I suspect there is something done by some interceptor in the default stack
which I am missing.

Could you please let me know how I can set something in session in
Interceptor and have it available in my JSP.

Thanks,
JK


RE: provide Helloworld application in Struts2.0

2011-11-16 Thread Ilya Kazakevich
 javax.xml.transform.TransformerFactoryConfigurationError: Provider
org.apache.xalan.processor.TransformerFactoryImpl not found
 
1) what is your java version?
2) what is your tomcat version?
3) struts version?
4) do you have any jars inside endorsed folder of your tomcat? If so --
what versions are they? (see META-INF/MANIFEST.MF)
 
Ilya Kazakevich,
Developer
JetBrains Inc
http://www.jetbrains.com http://www.jetbrains.com/ 
Develop with pleasure!




Re: provide Helloworld application in Struts2.0

2011-11-16 Thread bphill...@ku.edu
You may want to read the tutorials here: 
http://struts.apache.org/2.2.3.1/docs/getting-started.html

There are detailed examples applications that you can download and run in
Tomcat.

--
View this message in context: 
http://struts.1045723.n5.nabble.com/provide-Helloworld-application-in-Struts2-0-tp4988490p4998645.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: object set in session in interceptor not available to JSP for first launch.

2011-11-16 Thread Bruno Klava
How about setting your object in session before the action invocation,
i.e, before actionInvocation.invoke()?

Bruno

On Wed, Nov 16, 2011 at 4:09 PM, Jyothrilinga Rao jyoth...@gmail.com wrote:
 Hi,

 I have the following configuration snippet in my struts.xml:


 package name=*default* namespace=*/* extends=*struts-default*
  interceptors
   interceptor name=interceptor1
    class=com.abc.interceptors.MenuInterceptor
   /interceptor
   interceptor-stack name=myStack
    interceptor-ref name=defaultStack
     param name=exception.logEnabledtrue/param
     param name=exception.logLevelERROR/param
    /interceptor-ref
    interceptor-ref name=interceptor1 /
   /interceptor-stack
  /interceptors
  default-interceptor-ref name=myStack/default-interceptor-ref

 i.e I have a interceptor which I am calling after the defaultStack executes.

 My MenuInterceptor has the following code fragment in my intercept method
 of MenuInterceptor

 ActionContext ac = actionInvocation.getInvocationContext();
 String result = actionInvocation.invoke();

  if( null==ac.getSession().get(menu)){
    menu = parser.getMenu();
    ac.getSession().put(menu, menu);
  }
 LOG.debug(menu from session at end of intercept is:
 +ac.getSession().get(menu));
 return result;

 i.e after the action logic executes, I am checking if the sesssion has the
 object. if the object is not present I am populating it and storing in the
 session.
 my LOG outputs valid object in the first launch also.

 When I execute for the first time, the menu object is not available in the
 JSP, however if I refresh the page, the menu object is available in the JSP.
 I could not have my custom interceptor to execute after the default
 interceptors stack as the result already gets comitted and I cannot put
 object in my session.
 I suspect there is something done by some interceptor in the default stack
 which I am missing.

 Could you please let me know how I can set something in session in
 Interceptor and have it available in my JSP.

 Thanks,
 JK

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



Re: object set in session in interceptor not available to JSP for first launch.

2011-11-16 Thread Dave Newton
I think the goal was to do the check after the action executes, though--if
not, then yep, just doing it before the invocation is enough.

If the check needs to happen between action invocation and the JSP
rendering, then the interceptor should implement a PreResultListener, which
is called after invocation, but before JSP rendering.

Dave

On Wed, Nov 16, 2011 at 2:41 PM, Bruno Klava bkl...@gmail.com wrote:

 How about setting your object in session before the action invocation,
 i.e, before actionInvocation.invoke()?

 Bruno

 On Wed, Nov 16, 2011 at 4:09 PM, Jyothrilinga Rao jyoth...@gmail.com
 wrote:
  Hi,
 
  I have the following configuration snippet in my struts.xml:
 
 
  package name=*default* namespace=*/* extends=*struts-default*
   interceptors
interceptor name=interceptor1
 class=com.abc.interceptors.MenuInterceptor
/interceptor
interceptor-stack name=myStack
 interceptor-ref name=defaultStack
  param name=exception.logEnabledtrue/param
  param name=exception.logLevelERROR/param
 /interceptor-ref
 interceptor-ref name=interceptor1 /
/interceptor-stack
   /interceptors
   default-interceptor-ref name=myStack/default-interceptor-ref
 
  i.e I have a interceptor which I am calling after the defaultStack
 executes.
 
  My MenuInterceptor has the following code fragment in my intercept method
  of MenuInterceptor
 
  ActionContext ac = actionInvocation.getInvocationContext();
  String result = actionInvocation.invoke();
 
   if( null==ac.getSession().get(menu)){
 menu = parser.getMenu();
 ac.getSession().put(menu, menu);
   }
  LOG.debug(menu from session at end of intercept is:
  +ac.getSession().get(menu));
  return result;
 
  i.e after the action logic executes, I am checking if the sesssion has
 the
  object. if the object is not present I am populating it and storing in
 the
  session.
  my LOG outputs valid object in the first launch also.
 
  When I execute for the first time, the menu object is not available in
 the
  JSP, however if I refresh the page, the menu object is available in the
 JSP.
  I could not have my custom interceptor to execute after the default
  interceptors stack as the result already gets comitted and I cannot put
  object in my session.
  I suspect there is something done by some interceptor in the default
 stack
  which I am missing.
 
  Could you please let me know how I can set something in session in
  Interceptor and have it available in my JSP.
 
  Thanks,
  JK

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




Re: object set in session in interceptor not available to JSP for first launch.

2011-11-16 Thread Jyothrilinga Rao
if my action determines that what is present in session is no more valid,
then it would clear this object from session. My interceptor has to check
and set the correct object in session after action has returned.

The setting in session has to happen after action invocation and before JSP
rendering.

Interceptor implementing PreResultListener did not work for me.

I could get it working with the following snippet.
invocation.addPreResultListener(new PreResultListener() {
});

Thank you,
JK.

On Wed, Nov 16, 2011 at 11:45 AM, Dave Newton davelnew...@gmail.com wrote:

 I think the goal was to do the check after the action executes, though--if
 not, then yep, just doing it before the invocation is enough.

 If the check needs to happen between action invocation and the JSP
 rendering, then the interceptor should implement a PreResultListener, which
 is called after invocation, but before JSP rendering.

 Dave

 On Wed, Nov 16, 2011 at 2:41 PM, Bruno Klava bkl...@gmail.com wrote:

  How about setting your object in session before the action invocation,
  i.e, before actionInvocation.invoke()?
 
  Bruno
 
  On Wed, Nov 16, 2011 at 4:09 PM, Jyothrilinga Rao jyoth...@gmail.com
  wrote:
   Hi,
  
   I have the following configuration snippet in my struts.xml:
  
  
   package name=*default* namespace=*/* extends=*struts-default*
interceptors
 interceptor name=interceptor1
  class=com.abc.interceptors.MenuInterceptor
 /interceptor
 interceptor-stack name=myStack
  interceptor-ref name=defaultStack
   param name=exception.logEnabledtrue/param
   param name=exception.logLevelERROR/param
  /interceptor-ref
  interceptor-ref name=interceptor1 /
 /interceptor-stack
/interceptors
default-interceptor-ref name=myStack/default-interceptor-ref
  
   i.e I have a interceptor which I am calling after the defaultStack
  executes.
  
   My MenuInterceptor has the following code fragment in my intercept
 method
   of MenuInterceptor
  
   ActionContext ac = actionInvocation.getInvocationContext();
   String result = actionInvocation.invoke();
  
if( null==ac.getSession().get(menu)){
  menu = parser.getMenu();
  ac.getSession().put(menu, menu);
}
   LOG.debug(menu from session at end of intercept is:
   +ac.getSession().get(menu));
   return result;
  
   i.e after the action logic executes, I am checking if the sesssion has
  the
   object. if the object is not present I am populating it and storing in
  the
   session.
   my LOG outputs valid object in the first launch also.
  
   When I execute for the first time, the menu object is not available in
  the
   JSP, however if I refresh the page, the menu object is available in the
  JSP.
   I could not have my custom interceptor to execute after the default
   interceptors stack as the result already gets comitted and I cannot put
   object in my session.
   I suspect there is something done by some interceptor in the default
  stack
   which I am missing.
  
   Could you please let me know how I can set something in session in
   Interceptor and have it available in my JSP.
  
   Thanks,
   JK
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 



Re: object set in session in interceptor not available to JSP for first launch.

2011-11-16 Thread Dave Newton
That's what implementing a PreResultListener means; it's an interface, you
implement one.

I still think the whole PreResultListener thing is a bit opaque, I wrote up
something about that a couple of years ago--I need to dig that up.

Dave

On Wed, Nov 16, 2011 at 5:38 PM, Jyothrilinga Rao jyoth...@gmail.comwrote:

 if my action determines that what is present in session is no more valid,
 then it would clear this object from session. My interceptor has to check
 and set the correct object in session after action has returned.

 The setting in session has to happen after action invocation and before JSP
 rendering.

 Interceptor implementing PreResultListener did not work for me.

 I could get it working with the following snippet.
 invocation.addPreResultListener(new PreResultListener() {
 });

 Thank you,
 JK.

 On Wed, Nov 16, 2011 at 11:45 AM, Dave Newton davelnew...@gmail.com
 wrote:

  I think the goal was to do the check after the action executes,
 though--if
  not, then yep, just doing it before the invocation is enough.
 
  If the check needs to happen between action invocation and the JSP
  rendering, then the interceptor should implement a PreResultListener,
 which
  is called after invocation, but before JSP rendering.
 
  Dave
 
  On Wed, Nov 16, 2011 at 2:41 PM, Bruno Klava bkl...@gmail.com wrote:
 
   How about setting your object in session before the action invocation,
   i.e, before actionInvocation.invoke()?
  
   Bruno
  
   On Wed, Nov 16, 2011 at 4:09 PM, Jyothrilinga Rao jyoth...@gmail.com
   wrote:
Hi,
   
I have the following configuration snippet in my struts.xml:
   
   
package name=*default* namespace=*/* extends=*struts-default*
 interceptors
  interceptor name=interceptor1
   class=com.abc.interceptors.MenuInterceptor
  /interceptor
  interceptor-stack name=myStack
   interceptor-ref name=defaultStack
param name=exception.logEnabledtrue/param
param name=exception.logLevelERROR/param
   /interceptor-ref
   interceptor-ref name=interceptor1 /
  /interceptor-stack
 /interceptors
 default-interceptor-ref name=myStack/default-interceptor-ref
   
i.e I have a interceptor which I am calling after the defaultStack
   executes.
   
My MenuInterceptor has the following code fragment in my intercept
  method
of MenuInterceptor
   
ActionContext ac = actionInvocation.getInvocationContext();
String result = actionInvocation.invoke();
   
 if( null==ac.getSession().get(menu)){
   menu = parser.getMenu();
   ac.getSession().put(menu, menu);
 }
LOG.debug(menu from session at end of intercept is:
+ac.getSession().get(menu));
return result;
   
i.e after the action logic executes, I am checking if the sesssion
 has
   the
object. if the object is not present I am populating it and storing
 in
   the
session.
my LOG outputs valid object in the first launch also.
   
When I execute for the first time, the menu object is not available
 in
   the
JSP, however if I refresh the page, the menu object is available in
 the
   JSP.
I could not have my custom interceptor to execute after the default
interceptors stack as the result already gets comitted and I cannot
 put
object in my session.
I suspect there is something done by some interceptor in the default
   stack
which I am missing.
   
Could you please let me know how I can set something in session in
Interceptor and have it available in my JSP.
   
Thanks,
JK
  
   -
   To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
   For additional commands, e-mail: user-h...@struts.apache.org
  
  
 



RE: autocompleter struts2 onchange parameter not working

2011-11-16 Thread Martin Gainty

autocompleter contains a mechanism that triggers javascript function when value 
of monitored list changes e.g.sx:autocompleter  name=select 
list={'fruits','colors'}  valueNotifyTopics=/changed / Mit Freundlichen 
Gruben
Martin 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

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

  Date: Wed, 16 Nov 2011 10:57:09 +0530
 From: vivek_jaiswa...@yahoo.com
 Subject: autocompleter struts2 onchange parameter not working
 To: user@struts.apache.org
 
 
 
  
 Dear All,
 
 
 
 I want to apply onchange parameter in sx:autocompleter 
 onchange=testjavscriptmethod /
 
 script ...
 function testjavscriptmethod()
 {
 alert('Hi');
 }
 /script
 
 but the method is not call why?
 plz help me
 
 with regards,
 
 VIVEK KUMAR JAISWAL
  

Re: object set in session in interceptor not available to JSP for first launch.

2011-11-16 Thread Jyothrilinga Rao
Oh, when you said implement PreResultListener  the way I tried it out was

public class MenuInterceptor implements Interceptor, PreResultListener {
public String intercept(ActionInvocation actionInvocation) throws Exception
{
  ActionContext ac = actionInvocation.getInvocationContext();
  String result = actionInvocation.invoke();

  LOG.debug(menu from session at end of intercept is:
+ac.getSession().get(menu));
  return result;
}

@Override
public void beforeResult(ActionInvocation actionInvocation, String arg1) {
  ActionContext ac = actionInvocation.getInvocationContext();
   if( null==ac.getSession().get(menu)){
  menu = parser.getMenu();
  ac.getSession().put(menu, menu);
   }
 }
}

I was hoping beforeResult would be invoked by the framework which did not.
Glad that it is working now.
Thank you.

Regards,
JK

On Wed, Nov 16, 2011 at 2:43 PM, Dave Newton davelnew...@gmail.com wrote:

 That's what implementing a PreResultListener means; it's an interface, you
 implement one.

 I still think the whole PreResultListener thing is a bit opaque, I wrote up
 something about that a couple of years ago--I need to dig that up.

 Dave

 On Wed, Nov 16, 2011 at 5:38 PM, Jyothrilinga Rao jyoth...@gmail.com
 wrote:

  if my action determines that what is present in session is no more valid,
  then it would clear this object from session. My interceptor has to check
  and set the correct object in session after action has returned.
 
  The setting in session has to happen after action invocation and before
 JSP
  rendering.
 
  Interceptor implementing PreResultListener did not work for me.
 
  I could get it working with the following snippet.
  invocation.addPreResultListener(new PreResultListener() {
  });
 
  Thank you,
  JK.
 
  On Wed, Nov 16, 2011 at 11:45 AM, Dave Newton davelnew...@gmail.com
  wrote:
 
   I think the goal was to do the check after the action executes,
  though--if
   not, then yep, just doing it before the invocation is enough.
  
   If the check needs to happen between action invocation and the JSP
   rendering, then the interceptor should implement a PreResultListener,
  which
   is called after invocation, but before JSP rendering.
  
   Dave
  
   On Wed, Nov 16, 2011 at 2:41 PM, Bruno Klava bkl...@gmail.com wrote:
  
How about setting your object in session before the action
 invocation,
i.e, before actionInvocation.invoke()?
   
Bruno
   
On Wed, Nov 16, 2011 at 4:09 PM, Jyothrilinga Rao 
 jyoth...@gmail.com
wrote:
 Hi,

 I have the following configuration snippet in my struts.xml:


 package name=*default* namespace=*/*
 extends=*struts-default*
  interceptors
   interceptor name=interceptor1
class=com.abc.interceptors.MenuInterceptor
   /interceptor
   interceptor-stack name=myStack
interceptor-ref name=defaultStack
 param name=exception.logEnabledtrue/param
 param name=exception.logLevelERROR/param
/interceptor-ref
interceptor-ref name=interceptor1 /
   /interceptor-stack
  /interceptors
  default-interceptor-ref name=myStack/default-interceptor-ref

 i.e I have a interceptor which I am calling after the defaultStack
executes.

 My MenuInterceptor has the following code fragment in my intercept
   method
 of MenuInterceptor

 ActionContext ac = actionInvocation.getInvocationContext();
 String result = actionInvocation.invoke();

  if( null==ac.getSession().get(menu)){
menu = parser.getMenu();
ac.getSession().put(menu, menu);
  }
 LOG.debug(menu from session at end of intercept is:
 +ac.getSession().get(menu));
 return result;

 i.e after the action logic executes, I am checking if the sesssion
  has
the
 object. if the object is not present I am populating it and storing
  in
the
 session.
 my LOG outputs valid object in the first launch also.

 When I execute for the first time, the menu object is not available
  in
the
 JSP, however if I refresh the page, the menu object is available in
  the
JSP.
 I could not have my custom interceptor to execute after the default
 interceptors stack as the result already gets comitted and I cannot
  put
 object in my session.
 I suspect there is something done by some interceptor in the
 default
stack
 which I am missing.

 Could you please let me know how I can set something in session in
 Interceptor and have it available in my JSP.

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



[S2] Displaying user entered values after failed type conversion while using getText()?

2011-11-16 Thread Burton Rhodes
I am having an issue with displaying the original value entered on a
form after failed type conversion.  This bug is caused by my use of
getText() in the form value fields.  I'm curious how one solves this
issue for making sure the field is formatted correctly upon display,
but also making sure the users see the orignal malformed entry after
failed type conversion.  I have a few examples below.  The last one
displays works the way it should.  The top two only present an empty
field upon failed type conversion.

[code snippets]

!-- convert to java.util.Date: Will NOT display the incorrectly
entered date --
s:textfield key=xaction.closedDate
value=%{getText('format.dateShort',{xaction.closedDate != null ?
xaction.closedDate :''})} /

!-- convert to BigDecimal: Will NOT display the incorrectly entered
number --
s:textfield key=xaction.listPrice
value=%{getText('format.money',{xaction.listPrice != null ?
xaction.listPrice :''})}/

!-- convert to Integer: Will display the incorrect value --
s:textfield key=xaction.beds /

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



Re: autocompleter struts2 onchange parameter not working

2011-11-16 Thread vivek jaiswal


 
thanks a lot it's working properly


with regards,

VIVEK KUMAR JAISWAL





From: Martin Gainty mgai...@hotmail.com
To: Struts Users Mailing List user@struts.apache.org
Sent: Thursday, 17 November 2011 6:26 AM
Subject: RE: autocompleter struts2 onchange parameter not working


autocompleter contains a mechanism that triggers javascript function when value 
of monitored list changes e.g.sx:autocompleter  name=select 
list={'fruits','colors'}  valueNotifyTopics=/changed / Mit Freundlichen 
Gruben
Martin 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

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

 Date: Wed, 16 Nov 2011 10:57:09 +0530
 From: vivek_jaiswa...@yahoo.com
 Subject: autocompleter struts2 onchange parameter not working
 To: user@struts.apache.org
 
 
 
  
 Dear All,
 
 
 
 I want to apply onchange parameter in sx:autocompleter 
 onchange=testjavscriptmethod /
 
 script ...
 function testjavscriptmethod()
 {
 alert('Hi');
 }
 /script
 
 but the method is not call why?
 plz help me
 
 with regards,
 
 VIVEK KUMAR JAISWAL