Re: struts2-jquery-plugin: form submit returns twice the submit and textfield
Hi Dave, targets=formResult in s:aj is unnecessary in my case. Simply removing it solved the problem. Thanks! - Mounir Am 29.02.2012 00:50, schrieb Dave Newton: You update the div with the same jsp as the form, so you're adding the page to itself. d. (pardon brevity and typos, on cell) On Feb 28, 2012 6:44 PM, Mounir Benzidm...@meetingmasters.de wrote: Here's a simple enough example of how to use thesj:a tag available in the struts2-jquery plugin (v 3.2.1) http://www.weinfreund.de/**struts2-jquery-showcase/index.**actionhttp://www.weinfreund.de/struts2-jquery-showcase/index.action Well what I get though is somehow mysterious (to me). The first time when I call the action [1] given by its URL http://localhost:8080/myApp/**test/mehttp://localhost:8080/myApp/test/me I get the correct server response, that is - a line saying Echo: Hello me! - underneath it a textfield containig the phrase Hello me ! - followed by a submit button This is what it looks like: Before: http://i40.tinypic.com/vf8782.**jpghttp://i40.tinypic.com/vf8782.jpg Nice. But after I submit the form the textfield and the submit button get somehow mysteriously duplicated! (but not the Echo:... textline) So there's still the initial textfield with the updated Hello + whatever-you-typed-in phrase but yet another textfield and yet another submit button. The only difference I can tell between the initial and the duplicated textfield is that the latter never gets a refresh. It always contains the initial Hello me ! phrase. This is how it looks like after the submit: After: http://i41.tinypic.com/2ji44j.**jpghttp://i41.tinypic.com/2ji44j.jpg Maybe someone can tell what I'm missing here. Thanks! [1] http://pastebin.com/Wq0Ek1H4http://pastebin.com/Wq0Ek1H4**(Action class) [2] http://pastebin.com/6yF2xwu4 (jsp) --**--** --**--** --**-- [1] ACTION class package xxx.actions.yyy; import org.apache.log4j.Logger; import org.apache.struts2.convention.**annotation.Action; import org.apache.struts2.convention.**annotation.Actions; import org.apache.struts2.convention.**annotation.Namespace; import org.apache.struts2.convention.**annotation.Result; import com.opensymphony.xwork2.**ActionSupport; @Namespace(/test) public class HelloWorldAction extends ActionSupport { public String getYourName() {return yourName; } public void setYourName(String value) {this.yourName = value;} @Actions({ @Action(value={yourName}, results={@Result(location = test.jsp)}), @Action(value=put, results={@Result(location = test.jsp)}) }) public String execute() { yourName = Hello + yourName + !; logger.debug(execute: + yourName); return SUCCESS; } private static final long serialVersionUID = 1L; private String yourName; private static Logger logger = Logger.getLogger(** HelloWorldAction.class); } [2] (jsp) --**--** --** %@ taglib prefix=s uri=/struts-tags % %@ taglib prefix=sj uri=/struts-jquery-tags% html head sj:head/ /head body div id=formResult pEcho : ${yourName}/p /div s:form id=form action=put s:textfield id=echo name=yourName/ /s:form sj:a id=ajaxformlink formIds=form targets=formResult indicator=indicator button=true buttonIcon=ui-icon-gear Submit form here /sj:a img id=indicator src=images/indicator.gif alt=Loading... style=display:none/ /body /html -- Mounir Benzid Systementwickler / EDV meetingmasters.de meetings meisterhaft managen · Unabhängige Vermittlung von Tagungshotels · Online-Hotelreservierungssystem zur Integration in die Veranstaltungs-Webseite · Webbasiertes Veranstaltungs- und Teilnehmermanagement · E-Procurement für den Tagungshoteleinkauf · Webbasierte Anfrage und Verhandlung von Firmenraten Max-Planck-Straße 22 D-54296 Trier fon +49 (0)651-145789-38 fax +49 (0)651-145789-20 www.meetingmasters.de m...@meetingmasters.de - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Security Vulnerability When Using SessionAware and Best Practice For Mitigating It
2012/2/28 bphill...@ku.edu bphill...@ku.edu: Lukasz - I agree with you, but until a new version of Struts 2 is released that includes a fix for this vulnerability, I'd like to tell Struts 2 developers what to do when implementing the SessionAware interface to mitigate the vulnerability. If you could look over what I wrote in the initial post and provide any feedback on that I'd certainly appreciate your comments. Your proposal is fair enough, and maybe adding also a note about changing excludeParams (as in WW-3631) to solve the problem completely, as it's better to make a change in one place and not to implement the same interface over and over (ParameterNameAware) Regards -- Łukasz Mobile +48 606 323 122 Office +27 11 0838747 http://www.lenart.org.pl/ Warszawa JUG conference - Confitura http://confitura.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts, spring integration while using struts annotations
2012/2/29 Puneet Babbar 2 pbabb...@sapient.com: Thanks for replying to my post, I have already checked that link but still no clue as to how to make spring plugin work with the convention plugin. Suppose I have an Action - @Action(/login-page) Did you try to use login-page ? Namespace / should be defined separately Regards -- Łukasz Mobile +48 606 323 122 Office +27 11 0838747 http://www.lenart.org.pl/ Warszawa JUG conference - Confitura http://confitura.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts, spring integration while using struts annotations
Hi, there is no need to define a spring bean for your struts actions. At least when you use a struts.xml. I have not tried what happens when you use annotations. As far as I now, all struts actions will be created as prototypes by spring. If you define them in the applicationsContext.xml, they will be created as singeltons, which can cause issues, if you don't expect this behavior. Regards, Pascal On Wednesday 29 February 2012 07:52:03 Puneet Babbar 2 wrote: Thanks for replying to my post, I have already checked that link but still no clue as to how to make spring plugin work with the convention plugin. Suppose I have an Action - @Action(/login-page) public class LoginPage extends ActionSupport { public LoginPage(){ } public String execute(){ return SUCCESS; } } I have added spring plugin to my application and have added the following bean definition in my applicationContext.xml bean id=login-page class=com.test.login.LoginPage / I debugged the application - Now when I load my application and send a request for the login-page action, I see that the action is being created 2 times 1)When applicationContext is read when the application comes up. 2)When the request is sent for this action, struts creates another instance and this instance is used to service the request. So basically, I am not able to get the action object I have created using spring to be used by struts to process the requests when using convention plugin The Struts spring integration works fine when I used the normal struts.xml approach(not using convention plugin) Now can you help me out? Regards Puneet -Original Message- From: Steven Yang [mailto:kenshin...@gmail.com] Sent: Wednesday, February 29, 2012 12:16 PM To: Struts Users Mailing List Subject: Re: Struts, spring integration while using struts annotations check this http://struts.apache.org/2.0.8/docs/spring-plugin.html you can use spring along with the annotation in the convention-plugin such as @Action, etc On Tue, Feb 28, 2012 at 6:01 PM, Puneet Babbar 2 pbabb...@sapient.comwrote: Hi, I am using struts annotations with my applications, I need to add spring's support to my application. I am not able to find any content on how to use the beans(the struts action classes) initialized using spring as my action when I am using struts annotations? Regards Puneet - 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: Struts, spring integration while using struts annotations
Hi, there is no need to define a spring bean for your struts actions. At least when you use a struts.xml. I have not tried what happens when you use annotations. As far as I now, all struts actions will be created as prototypes by spring. If you define them in the applicationsContext.xml, they will be created as singeltons, which can cause issues, if you don't expect this behavior. Regards, Pascal On Wednesday 29 February 2012 07:52:03 Puneet Babbar 2 wrote: Thanks for replying to my post, I have already checked that link but still no clue as to how to make spring plugin work with the convention plugin. Suppose I have an Action - @Action(/login-page) public class LoginPage extends ActionSupport { public LoginPage(){ } public String execute(){ return SUCCESS; } } I have added spring plugin to my application and have added the following bean definition in my applicationContext.xml bean id=login-page class=com.test.login.LoginPage / I debugged the application - Now when I load my application and send a request for the login-page action, I see that the action is being created 2 times 1)When applicationContext is read when the application comes up. 2)When the request is sent for this action, struts creates another instance and this instance is used to service the request. So basically, I am not able to get the action object I have created using spring to be used by struts to process the requests when using convention plugin The Struts spring integration works fine when I used the normal struts.xml approach(not using convention plugin) Now can you help me out? Regards Puneet -Original Message- From: Steven Yang [mailto:kenshin...@gmail.com] Sent: Wednesday, February 29, 2012 12:16 PM To: Struts Users Mailing List Subject: Re: Struts, spring integration while using struts annotations check this http://struts.apache.org/2.0.8/docs/spring-plugin.html you can use spring along with the annotation in the convention-plugin such as @Action, etc On Tue, Feb 28, 2012 at 6:01 PM, Puneet Babbar 2 pbabb...@sapient.comwrote: Hi, I am using struts annotations with my applications, I need to add spring's support to my application. I am not able to find any content on how to use the beans(the struts action classes) initialized using spring as my action when I am using struts annotations? Regards Puneet - 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: Struts, spring integration while using struts annotations
Tried after you suggested it, but doesn’t work :( -Puneet -Original Message- From: Łukasz Lenart [mailto:lukasz.len...@googlemail.com] Sent: Wednesday, February 29, 2012 2:12 PM To: Struts Users Mailing List Subject: Re: Struts, spring integration while using struts annotations 2012/2/29 Puneet Babbar 2 pbabb...@sapient.com: Thanks for replying to my post, I have already checked that link but still no clue as to how to make spring plugin work with the convention plugin. Suppose I have an Action - @Action(/login-page) Did you try to use login-page ? Namespace / should be defined separately Regards -- Łukasz Mobile +48 606 323 122 Office +27 11 0838747 http://www.lenart.org.pl/ Warszawa JUG conference - Confitura http://confitura.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Struts, spring integration while using struts annotations
The singleton bit can be managed by setting the appropriate scope while defining the actions as beans in applicationContext.xml. Regards Puneet -Original Message- From: Per Pascal Grube [mailto:pascal.gr...@rus.uni-stuttgart.de] Sent: Wednesday, February 29, 2012 2:15 PM To: Struts Users Mailing List Subject: Re: Struts, spring integration while using struts annotations Hi, there is no need to define a spring bean for your struts actions. At least when you use a struts.xml. I have not tried what happens when you use annotations. As far as I now, all struts actions will be created as prototypes by spring. If you define them in the applicationsContext.xml, they will be created as singeltons, which can cause issues, if you don't expect this behavior. Regards, Pascal On Wednesday 29 February 2012 07:52:03 Puneet Babbar 2 wrote: Thanks for replying to my post, I have already checked that link but still no clue as to how to make spring plugin work with the convention plugin. Suppose I have an Action - @Action(/login-page) public class LoginPage extends ActionSupport { public LoginPage(){ } public String execute(){ return SUCCESS; } } I have added spring plugin to my application and have added the following bean definition in my applicationContext.xml bean id=login-page class=com.test.login.LoginPage / I debugged the application - Now when I load my application and send a request for the login-page action, I see that the action is being created 2 times 1)When applicationContext is read when the application comes up. 2)When the request is sent for this action, struts creates another instance and this instance is used to service the request. So basically, I am not able to get the action object I have created using spring to be used by struts to process the requests when using convention plugin The Struts spring integration works fine when I used the normal struts.xml approach(not using convention plugin) Now can you help me out? Regards Puneet -Original Message- From: Steven Yang [mailto:kenshin...@gmail.com] Sent: Wednesday, February 29, 2012 12:16 PM To: Struts Users Mailing List Subject: Re: Struts, spring integration while using struts annotations check this http://struts.apache.org/2.0.8/docs/spring-plugin.html you can use spring along with the annotation in the convention-plugin such as @Action, etc On Tue, Feb 28, 2012 at 6:01 PM, Puneet Babbar 2 pbabb...@sapient.comwrote: Hi, I am using struts annotations with my applications, I need to add spring's support to my application. I am not able to find any content on how to use the beans(the struts action classes) initialized using spring as my action when I am using struts annotations? Regards Puneet - 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: Struts, spring integration while using struts annotations
2012/2/29 Puneet Babbar 2 pbabb...@sapient.com: Tried after you suggested it, but doesn’t work :( Did you try to debug SpringObjectFactory#buildBean methods ? Regards -- Łukasz http://www.lenart.org.pl/ mobile +48 606 323 122, office +27 11 0838747 Warszawa JUG conference - Confitura http://confitura.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts, spring integration while using struts annotations
Maybe it is a bug, that way I asked to check that. 2012/2/29 Puneet Babbar 2 pbabb...@sapient.com: Haven't tried that till now, was hoping to get some tips from the community users. I am able to use the default auto-wiring done by the struts2-spring plugin, but not able to explicitly create a bean from an action class and get that object used by the framework to service requests. Regards Puneet -Original Message- From: Łukasz Lenart [mailto:lukasz.len...@googlemail.com] Sent: Wednesday, February 29, 2012 4:24 PM To: Puneet Babbar 2 Cc: Struts Users Mailing List Subject: Re: Struts, spring integration while using struts annotations 2012/2/29 Puneet Babbar 2 pbabb...@sapient.com: Tried after you suggested it, but doesn’t work :( Did you try to debug SpringObjectFactory#buildBean methods ? Regards -- Łukasz http://www.lenart.org.pl/ mobile +48 606 323 122, office +27 11 0838747 Warszawa JUG conference - Confitura http://confitura.pl/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Struts2 w/freemarker and internationalization
I'm trying to internationalize a simple Struts2-based webapp that uses Freemarker as the view technology. The usage of freemarker templating pulling values from the Action object is working fine. But when I try to leverage Struts2's TextProvider capability via getText(), it doesn't work. My action extends ActionSupport which implements the TextProvider interface. My freemarker template file contains this: p${getText('welcome.message')}/p My properties file is: {MyActionName}.properties and located in same directory as the java source. It contains: welcome.message=The Welcome message goes here But I get the dreaded freemarker.core.InvalidReferenceException: Expression getText is undefined. To test that the resource bundle can be located, I inserted code in my Action's execute(): String res; try { res = getText(welcome.message, default welcome msg from execute() method); } catch (Throwable e) { res = null; } With the debugger, I see the res is being set to 'The Welcome message goes here' -- which tells me the ResourceBundle is working inside TextProvider. So it seems the issue is Freemarker not accessing the TextProvider interface. Other things I've tried: - ${text('welcome.message')} -- same result - having my action implement TemplateMethodModel per this link: http://weblog.masukomi.org/2009/03/12/localization-for-struts-freemarker-users/ but that didn't work either. Can anyone provide any hints for how to get this very basic thing working? thanks, Tom - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2 w/freemarker and internationalization
Try with: p@s.text name=welcome.message//p Cheers, Josep 2012/2/29 Tom Hjellming thjellm...@gmail.com I'm trying to internationalize a simple Struts2-based webapp that uses Freemarker as the view technology. The usage of freemarker templating pulling values from the Action object is working fine. But when I try to leverage Struts2's TextProvider capability via getText(), it doesn't work. My action extends ActionSupport which implements the TextProvider interface. My freemarker template file contains this: p${getText('welcome.message'**)}/p My properties file is: {MyActionName}.properties and located in same directory as the java source. It contains: welcome.message=The Welcome message goes here But I get the dreaded freemarker.core.**InvalidReferenceException: Expression getText is undefined. To test that the resource bundle can be located, I inserted code in my Action's execute(): String res; try { res = getText(welcome.message, default welcome msg from execute() method); } catch (Throwable e) { res = null; } With the debugger, I see the res is being set to 'The Welcome message goes here' -- which tells me the ResourceBundle is working inside TextProvider. So it seems the issue is Freemarker not accessing the TextProvider interface. Other things I've tried: - ${text('welcome.message')} -- same result - having my action implement TemplateMethodModel per this link: http://weblog.masukomi.org/**2009/03/12/localization-for-** struts-freemarker-users/http://weblog.masukomi.org/2009/03/12/localization-for-struts-freemarker-users/ but that didn't work either. Can anyone provide any hints for how to get this very basic thing working? thanks, Tom --**--**- To unsubscribe, e-mail: user-unsubscribe@struts.**apache.orguser-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Security Vulnerability When Using SessionAware and Best Practice For Mitigating It
Lukasz: Good idea on letting struts 2 developers know that instead of implementing the ParameterNameAware interface that they can change the excludeParams value as part of the package setup. So I'll add to my code example: package name=basicstruts2 extends=struts-default interceptors interceptor-stack name=appDefault interceptor-ref name=defaultStack true ERROR dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,parameters\...* /interceptor-ref /interceptor-stack /interceptors default-interceptor-ref name=appDefault / and include in the tutorial text both options. Thanks for the help. -- View this message in context: http://struts.1045723.n5.nabble.com/Security-Vulnerability-When-Using-SessionAware-and-Best-Practice-For-Mitigating-It-tp5502292p5525787.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: Struts2 w/freemarker and internationalization
Thanks Josep - that works. I thought the ${} notation was equivalent to the @s form - but I guess not. thanks, Tom On 2/29/12 12:16 PM, Josep García wrote: Try with: p@s.text name=welcome.message//p Cheers, Josep 2012/2/29 Tom Hjellmingthjellm...@gmail.com I'm trying to internationalize a simple Struts2-based webapp that uses Freemarker as the view technology. The usage of freemarker templating pulling values from the Action object is working fine. But when I try to leverage Struts2's TextProvider capability via getText(), it doesn't work. My action extends ActionSupport which implements the TextProvider interface. My freemarker template file contains this: p${getText('welcome.message'**)}/p My properties file is: {MyActionName}.properties and located in same directory as the java source. It contains: welcome.message=The Welcome message goes here But I get the dreaded freemarker.core.**InvalidReferenceException: Expression getText is undefined. To test that the resource bundle can be located, I inserted code in my Action's execute(): String res; try { res = getText(welcome.message, default welcome msg from execute() method); } catch (Throwable e) { res = null; } With the debugger, I see the res is being set to 'The Welcome message goes here' -- which tells me the ResourceBundle is working inside TextProvider. So it seems the issue is Freemarker not accessing the TextProvider interface. Other things I've tried: - ${text('welcome.message')} -- same result - having my action implement TemplateMethodModel per this link: http://weblog.masukomi.org/**2009/03/12/localization-for-** struts-freemarker-users/http://weblog.masukomi.org/2009/03/12/localization-for-struts-freemarker-users/ but that didn't work either. Can anyone provide any hints for how to get this very basic thing working? thanks, Tom --**--**- To unsubscribe, e-mail: user-unsubscribe@struts.**apache.orguser-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
Struts 2 Twitter Bootstrap Plugin
All: I hear tell of a Twitter Bootstrap plug-in for Struts 2. Does anyone know where it lives -- if it lives? jb
Re: Struts 2 Twitter Bootstrap Plugin
Here [1], enjoy :-) [1] http://code.google.com/p/struts2-bootstrap/ Regards -- Łukasz http://www.lenart.org.pl/ mobile +48 606 323 122, office +27 11 0838747 Warszawa JUG conference - Confitura http://confitura.pl/ 2012/3/1 Jeff Black jeffrey.bl...@yahoo.com: All: I hear tell of a Twitter Bootstrap plug-in for Struts 2. Does anyone know where it lives -- if it lives? jb - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org