Re: How to make interceptor to be invoked only for HTTP Request not for Response
As per my understanding, your applciation might have configured the common interceptor stack for action classes, that is why for every action request..it is accessing the interceptor and u see the log msgs. -Thanks Uma Kagitha. From: Sreekanth S. Nair sreekanth.n...@egovernments.org To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, July 9, 2013 11:28 AM Subject: Re: How to make interceptor to be invoked only for HTTP Request not for Response Yes you are right Dave, let me recheck the scenario when my interceptor calls twice. -- Thanks Regards Srikanth Software Developer eGovernments Foundations http://www.egovernments.org/ Mob : 9980078913 On Tue, Jul 9, 2013 at 8:46 PM, Dave Newton davelnew...@gmail.com wrote: What do you mean by called while response? Interceptors aren't called twice, they wrap action invocation. Dave On Jul 9, 2013 10:07 AM, Sreekanth S. Nair sreekanth.n...@egovernments.org wrote: I have a custom interceptor for trimming whitespaces in request data My intercept method is like below @Override public String intercept(final ActionInvocation invocation) throws Exception { // Get the action context from the invocation so we can access the // HttpServletRequest and HttpSession objects. final HttpServletRequest request = (HttpServletRequest) invocation.getInvocationContext().get(HTTP_REQUEST); Map parameters = invocation.getInvocationContext().getParameters(); parameters = this.getTrimmedParameters(request, parameters); invocation.getInvocationContext().setParameters(parameters); return invocation.invoke(); } but this interceptor is getting called while request as well as while coming back from my action (response). I dont want intercept method to be called while response. -- Thanks Regards Srikanth Software Developer eGovernments Foundations www.egovernments.org Mob : 9980078913 On Tue, Jul 9, 2013 at 8:29 PM, Dave Newton davelnew...@gmail.com wrote: It works precisely like a filter, there is code before and after action.invoke, and before rendering with PreResultListeners. I don't understand the specific issue(s) you think you're having. What problem are you having that you're trying to solve? Dave On Jul 9, 2013 9:54 AM, Sreekanth S. Nair sreekanth.n...@egovernments.org wrote: I doubt struts2 interceptor work like a filter, just like in ur pseudo code. In filter we can specify what to do with request and response by adding code before and after chain.doFilter(request, response). In Interceptor intercept method will always get executed before and after req resp. -- Thanks Regards Srikanth Software Developer eGovernments Foundations www.egovernments.org Mob : 9980078913 On Tue, Jul 9, 2013 at 6:37 PM, Felipe Lorenz felipe.lor...@idealogic.com.br wrote: I dont think it is possible. But I believe you can just ignore the response and do nothing with that. I am not sure if I understand your question. But an interceptor has only one call per request/response. So your code could like this: public class Interceptor { method { removeSpaceFromRequest(); String resp = invoke(); //here, you do nothing with the response. return resp; } } Felipe Lorenz Gerente de Projetos Idealogic Software Fone: (51) 3715 5523 - (51) 3715 5548 http://www.idealogic.com.br/ Em 09/07/2013, às 09:13, Sreekanth S. Nair escreveu: Yes, i have an Interceptor basically to Trimming of input values, i don't want to do this to be happened while request coming back with response. -- Thanks Regards Srikanth Software Developer eGovernments Foundations www.egovernments.org Mob : 9980078913 On Tue, Jul 9, 2013 at 5:41 PM, umeshawas...@gmail.com wrote: Any specific reason to do that? --Original Message-- From: Sreekanth S. Nair To: Struts Users Mailing List ReplyTo: Struts Users Mailing List Subject: How to make interceptor to be invoked only for HTTP Request not for Response Sent: Jul 9, 2013 5:33 PM How to make interceptor to be invoked only for HTTP Request not for Response Sent from BlackBerry® on Airtel
Re: Rendering Struts2 tags from the Action class content for the JSP template.
Please excuse me if I'm mistaken.. I'm not using any custom tags..The following is the tag library reference that I'm using for the form submission tags. %@ Best Regards, Umamaheswara Kagitha. From: Dave Newton davelnew...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Friday, February 10, 2012 11:50 PM Subject: Re: Rendering Struts2 tags from the Action class content for the JSP template. Custom tags need to go through the rendering process, which they won't do if they're written to the body in an action. Dave (pardon brevity and typos, on cell) On Feb 10, 2012 11:44 PM, umamaheswara rao uma_kagi...@yahoo.com wrote: Hi, I have defined struts tag in myApp_header.jsp. I have tested that functionality by placing the tags directly in AssignOffer.jsp and they are working fine. Since we have JSP as a template (header, body and footer) header.jsp contains all the tab libraries defined common for the application , similary footer.jsp contains links applicable to all the screens. so, Body is being built in Action class and setting pageContent and additional headers based on the modules. And while building body in the action class , creating form and its variables as just jsp tags as follows.. The following 1st line commented to show the original code with jsp tags and the second line replaced with struts2 tag .. //content1 +=form method=\post\ action=\AssignOffer.do\; content1 +=s:form id=\offer\ action=\offer.do\ method=\post\ cssClass=\formTag\; content1 +=input type=hidden name=ACTION_TYPE value=\+ action + \; content1 +=input type=hidden name=office value=\+ office + \; content1 +=input type=hidden name=recd value=\+ recd + \; content1 +=input type=hidden name=mode value=\+action+\; content1 +=s:token /; content1+=s:submit value=\Assign Offer\ theme=\orsAjax\ /; and finally calling setPageContent(content);OFFERS)); So, the body is being rendered as String but unable to render the struts2 tags and convert them. Please let me know if you could throw some light...I appreciate your help and time. Best Regards, Ukagitha. From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org; umamaheswara rao uma_kagi...@yahoo.com Sent: Friday, February 10, 2012 4:32 PM Subject: Re: Rendering Struts2 tags from the Action class content for the JSP template. It doesn't appear that you've defined the Struts taglib with the JSP directives, that's probably why they're not rendering. (*Chris*) On Fri, Feb 10, 2012 at 12:58 PM, umamaheswara rao uma_kagi...@yahoo.com wrote: Hello List subscribers, I'm working on struts2 application to incorporate the Double click submission issue by using Tokens. But I have one issue here..Currently Body content of a JSP is building in the Action class and putting back in JSP template. So, far we are not using any struts specific tags..But when I try to add struts2 tags they are not being rendered in JSP. Tags related to struts2 are newly added in place of the regular form tags in the Action class(commented ones are the old tags and working fine). //Code is not completely copied due to the other issues..please understand. Pl. advise/suggest me to render the struts2 tags from Action class properly.. I have the following code in JSP AssignOffer.jsp %String title=Assign Offer;%@ %= %= %@includefile=/jsps/include/myApp_web_header.jsp%request.getAttribute(pageHeader)%request.getAttribute(pageContent)%includefile=/jsps/include/myApp_web_footer.jsp%==Action: In the Action class, pageContent for the above JSP is building and Action class Code: importjava.util.Map;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importorg.apache.struts2.interceptor.ParameterAware;importorg.apache.struts2.interceptor.ServletRequestAware;importorg.apache.struts2.interceptor.ServletResponseAware;importorg.apache.struts2.interceptor.SessionAware; publicclassAssignOfferextendsActionSupport implementsParameterAware, SessionAware,ServletRequestAware, ServletResponseAware* @see com.opensymphony.xwork2.ActionSupport#execute() */privatestatictransientLogger _classLog= Logger.getLogger(AssignOffer.class);/* (non-Javadoc) } } } } privateString pageContent; privateString pageHeader; publicString getPageContent() { returnpageContent; publicvoidsetPageContent(String pageContent) { this.pageContent= pageContent; publicString getPageHeader() { returnpageHeader; publicvoidsetPageHeader(String pageHeader) { this.pageHeader= pageHeader; { String content = publicString execute() throwsException; OfferService srv = newOfferService(); HashMap offMap= null; //Business Logic...condtion.. offMap = (HashMap
Re: Rendering Struts2 tags from the Action class content for the JSP template.
Please excuse me if I'm mistaken.. I'm not using any custom tags..The following is the tag library reference that I'm using for the form submission tags. taglibprefix=suri=/struts-tagsgt; From: Dave Newton davelnew...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Friday, February 10, 2012 11:50 PM Subject: Re: Rendering Struts2 tags from the Action class content for the JSP template. Custom tags need to go through the rendering process, which they won't do if they're written to the body in an action. Dave (pardon brevity and typos, on cell) On Feb 10, 2012 11:44 PM, umamaheswara rao uma_kagi...@yahoo.com wrote: Hi, I have defined struts tag in myApp_header.jsp. I have tested that functionality by placing the tags directly in AssignOffer.jsp and they are working fine. Since we have JSP as a template (header, body and footer) header.jsp contains all the tab libraries defined common for the application , similary footer.jsp contains links applicable to all the screens. so, Body is being built in Action class and setting pageContent and additional headers based on the modules. And while building body in the action class , creating form and its variables as just jsp tags as follows.. The following 1st line commented to show the original code with jsp tags and the second line replaced with struts2 tag .. //content1 +=form method=\post\ action=\AssignOffer.do\; content1 +=s:form id=\offer\ action=\offer.do\ method=\post\ cssClass=\formTag\; content1 +=input type=hidden name=ACTION_TYPE value=\+ action + \; content1 +=input type=hidden name=office value=\+ office + \; content1 +=input type=hidden name=recd value=\+ recd + \; content1 +=input type=hidden name=mode value=\+action+\; content1 +=s:token /; content1+=s:submit value=\Assign Offer\ theme=\orsAjax\ /; and finally calling setPageContent(content);OFFERS)); So, the body is being rendered as String but unable to render the struts2 tags and convert them. Please let me know if you could throw some light...I appreciate your help and time. Best Regards, Ukagitha. From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org; umamaheswara rao uma_kagi...@yahoo.com Sent: Friday, February 10, 2012 4:32 PM Subject: Re: Rendering Struts2 tags from the Action class content for the JSP template. It doesn't appear that you've defined the Struts taglib with the JSP directives, that's probably why they're not rendering. (*Chris*) On Fri, Feb 10, 2012 at 12:58 PM, umamaheswara rao uma_kagi...@yahoo.com wrote: Hello List subscribers, I'm working on struts2 application to incorporate the Double click submission issue by using Tokens. But I have one issue here..Currently Body content of a JSP is building in the Action class and putting back in JSP template. So, far we are not using any struts specific tags..But when I try to add struts2 tags they are not being rendered in JSP. Tags related to struts2 are newly added in place of the regular form tags in the Action class(commented ones are the old tags and working fine). //Code is not completely copied due to the other issues..please understand. Pl. advise/suggest me to render the struts2 tags from Action class properly.. I have the following code in JSP AssignOffer.jsp %String title=Assign Offer;%@ %= %= %@includefile=/jsps/include/myApp_web_header.jsp%request.getAttribute(pageHeader)%request.getAttribute(pageContent)%includefile=/jsps/include/myApp_web_footer.jsp%==Action: In the Action class, pageContent for the above JSP is building and Action class Code: importjava.util.Map;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importorg.apache.struts2.interceptor.ParameterAware;importorg.apache.struts2.interceptor.ServletRequestAware;importorg.apache.struts2.interceptor.ServletResponseAware;importorg.apache.struts2.interceptor.SessionAware; publicclassAssignOfferextendsActionSupport implementsParameterAware, SessionAware,ServletRequestAware, ServletResponseAware* @see com.opensymphony.xwork2.ActionSupport#execute() */privatestatictransientLogger _classLog= Logger.getLogger(AssignOffer.class);/* (non-Javadoc) } } } } privateString pageContent; privateString pageHeader; publicString getPageContent() { returnpageContent; publicvoidsetPageContent(String pageContent) { this.pageContent= pageContent; publicString getPageHeader() { returnpageHeader; publicvoidsetPageHeader(String pageHeader) { this.pageHeader= pageHeader; { String content = publicString execute() throwsException; OfferService srv = newOfferService(); HashMap offMap= null; //Business Logic...condtion.. offMap = (HashMap
Re: Rendering Struts2 tags from the Action class content for the JSP template.
Hi, We have just renamed theme ajax and nothing else. Best Regards, Umamaheswara Kagitha From: Dave Newton davelnew...@gmail.com To: Struts Users Mailing List user@struts.apache.org; umamaheswara rao uma_kagi...@yahoo.com Sent: Monday, February 13, 2012 9:46 AM Subject: Re: Rendering Struts2 tags from the Action class content for the JSP template. What's this, then? content1+=s:submit value=\Assign Offer\ theme=\orsAjax\ /; Dave On Mon, Feb 13, 2012 at 9:42 AM, umamaheswara rao uma_kagi...@yahoo.comwrote: Please excuse me if I'm mistaken.. I'm not using any custom tags..The following is the tag library reference that I'm using for the form submission tags. %@ Best Regards, Umamaheswara Kagitha. From: Dave Newton davelnew...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Friday, February 10, 2012 11:50 PM Subject: Re: Rendering Struts2 tags from the Action class content for the JSP template. Custom tags need to go through the rendering process, which they won't do if they're written to the body in an action. Dave (pardon brevity and typos, on cell) On Feb 10, 2012 11:44 PM, umamaheswara rao uma_kagi...@yahoo.com wrote: Hi, I have defined struts tag in myApp_header.jsp. I have tested that functionality by placing the tags directly in AssignOffer.jsp and they are working fine. Since we have JSP as a template (header, body and footer) header.jsp contains all the tab libraries defined common for the application , similary footer.jsp contains links applicable to all the screens. so, Body is being built in Action class and setting pageContent and additional headers based on the modules. And while building body in the action class , creating form and its variables as just jsp tags as follows.. The following 1st line commented to show the original code with jsp tags and the second line replaced with struts2 tag .. //content1 +=form method=\post\ action=\AssignOffer.do\; content1 +=s:form id=\offer\ action=\offer.do\ method=\post\ cssClass=\formTag\; content1 +=input type=hidden name=ACTION_TYPE value=\+ action + \; content1 +=input type=hidden name=office value=\+ office + \; content1 +=input type=hidden name=recd value=\+ recd + \; content1 +=input type=hidden name=mode value=\+action+\; content1 +=s:token /; content1+=s:submit value=\Assign Offer\ theme=\orsAjax\ /; and finally calling setPageContent(content);OFFERS)); So, the body is being rendered as String but unable to render the struts2 tags and convert them. Please let me know if you could throw some light...I appreciate your help and time. Best Regards, Ukagitha. From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org; umamaheswara rao uma_kagi...@yahoo.com Sent: Friday, February 10, 2012 4:32 PM Subject: Re: Rendering Struts2 tags from the Action class content for the JSP template. It doesn't appear that you've defined the Struts taglib with the JSP directives, that's probably why they're not rendering. (*Chris*) On Fri, Feb 10, 2012 at 12:58 PM, umamaheswara rao uma_kagi...@yahoo.com wrote: Hello List subscribers, I'm working on struts2 application to incorporate the Double click submission issue by using Tokens. But I have one issue here..Currently Body content of a JSP is building in the Action class and putting back in JSP template. So, far we are not using any struts specific tags..But when I try to add struts2 tags they are not being rendered in JSP. Tags related to struts2 are newly added in place of the regular form tags in the Action class(commented ones are the old tags and working fine). //Code is not completely copied due to the other issues..please understand. Pl. advise/suggest me to render the struts2 tags from Action class properly.. I have the following code in JSP AssignOffer.jsp %String title=Assign Offer;%@ %= %= %@includefile=/jsps/include/myApp_web_header.jsp%request.getAttribute(pageHeader)%request.getAttribute(pageContent)%includefile=/jsps/include/myApp_web_footer.jsp%==Action: In the Action class, pageContent for the above JSP is building and Action class Code: importjava.util.Map;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importorg.apache.struts2.interceptor.ParameterAware;importorg.apache.struts2.interceptor.ServletRequestAware;importorg.apache.struts2.interceptor.ServletResponseAware;importorg.apache.struts2.interceptor.SessionAware; publicclassAssignOfferextendsActionSupport implementsParameterAware, SessionAware,ServletRequestAware, ServletResponseAware* @see com.opensymphony.xwork2.ActionSupport#execute
Re: Rendering Struts2 tags from the Action class content for the JSP template.
Thank you very much for your info. Does it work if i put the content in body.jsp (part of template) ? Best Regards, Umamaheswara. From: Dave Newton davelnew...@gmail.com To: Struts Users Mailing List user@struts.apache.org; umamaheswara rao uma_kagi...@yahoo.com Sent: Monday, February 13, 2012 9:52 AM Subject: Re: Rendering Struts2 tags from the Action class content for the JSP template. You're not understanding what I'm saying. If you render custom tags in the body, they're not going to be interpreted as custom tags. For custom tags to be rendered, they need to go through the JSP compilation process, like they would if they were in a JSP file. Dave On Mon, Feb 13, 2012 at 9:49 AM, umamaheswara rao uma_kagi...@yahoo.comwrote: Hi, We have just renamed theme ajax and nothing else. Best Regards, Umamaheswara Kagitha From: Dave Newton davelnew...@gmail.com To: Struts Users Mailing List user@struts.apache.org; umamaheswara rao uma_kagi...@yahoo.com Sent: Monday, February 13, 2012 9:46 AM Subject: Re: Rendering Struts2 tags from the Action class content for the JSP template. What's this, then? content1+=s:submit value=\Assign Offer\ theme=\orsAjax\ /; Dave On Mon, Feb 13, 2012 at 9:42 AM, umamaheswara rao uma_kagi...@yahoo.com wrote: Please excuse me if I'm mistaken.. I'm not using any custom tags..The following is the tag library reference that I'm using for the form submission tags. %@ Best Regards, Umamaheswara Kagitha. From: Dave Newton davelnew...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Friday, February 10, 2012 11:50 PM Subject: Re: Rendering Struts2 tags from the Action class content for the JSP template. Custom tags need to go through the rendering process, which they won't do if they're written to the body in an action. Dave (pardon brevity and typos, on cell) On Feb 10, 2012 11:44 PM, umamaheswara rao uma_kagi...@yahoo.com wrote: Hi, I have defined struts tag in myApp_header.jsp. I have tested that functionality by placing the tags directly in AssignOffer.jsp and they are working fine. Since we have JSP as a template (header, body and footer) header.jsp contains all the tab libraries defined common for the application , similary footer.jsp contains links applicable to all the screens. so, Body is being built in Action class and setting pageContent and additional headers based on the modules. And while building body in the action class , creating form and its variables as just jsp tags as follows.. The following 1st line commented to show the original code with jsp tags and the second line replaced with struts2 tag .. //content1 +=form method=\post\ action=\AssignOffer.do\; content1 +=s:form id=\offer\ action=\offer.do\ method=\post\ cssClass=\formTag\; content1 +=input type=hidden name=ACTION_TYPE value=\+ action + \; content1 +=input type=hidden name=office value=\+ office + \; content1 +=input type=hidden name=recd value=\+ recd + \; content1 +=input type=hidden name=mode value=\+action+\; content1 +=s:token /; content1+=s:submit value=\Assign Offer\ theme=\orsAjax\ /; and finally calling setPageContent(content);OFFERS)); So, the body is being rendered as String but unable to render the struts2 tags and convert them. Please let me know if you could throw some light...I appreciate your help and time. Best Regards, Ukagitha. From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org; umamaheswara rao uma_kagi...@yahoo.com Sent: Friday, February 10, 2012 4:32 PM Subject: Re: Rendering Struts2 tags from the Action class content for the JSP template. It doesn't appear that you've defined the Struts taglib with the JSP directives, that's probably why they're not rendering. (*Chris*) On Fri, Feb 10, 2012 at 12:58 PM, umamaheswara rao uma_kagi...@yahoo.com wrote: Hello List subscribers, I'm working on struts2 application to incorporate the Double click submission issue by using Tokens. But I have one issue here..Currently Body content of a JSP is building in the Action class and putting back in JSP template. So, far we are not using any struts specific tags..But when I try to add struts2 tags they are not being rendered in JSP. Tags related to struts2 are newly added in place of the regular form tags in the Action class(commented ones are the old tags and working fine). //Code is not completely copied due to the other issues..please understand. Pl. advise/suggest me to render the struts2 tags from Action class properly.. I have
Rendering Struts2 tags from the Action class content for the JSP template.
Hello List subscribers, I'm working on struts2 application to incorporate the Double click submission issue by using Tokens. But I have one issue here..Currently Body content of a JSP is building in the Action class and putting back in JSP template. So, far we are not using any struts specific tags..But when I try to add struts2 tags they are not being rendered in JSP. Tags related to struts2 are newly added in place of the regular form tags in the Action class(commented ones are the old tags and working fine). //Code is not completely copied due to the other issues..please understand. Pl. advise/suggest me to render the struts2 tags from Action class properly.. I have the following code in JSP AssignOffer.jsp %String title=Assign Offer;%@ %= %= %@includefile=/jsps/include/myApp_web_header.jsp%request.getAttribute(pageHeader)%request.getAttribute(pageContent)%includefile=/jsps/include/myApp_web_footer.jsp%==Action: In the Action class, pageContent for the above JSP is building and Action class Code: importjava.util.Map;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importorg.apache.struts2.interceptor.ParameterAware;importorg.apache.struts2.interceptor.ServletRequestAware;importorg.apache.struts2.interceptor.ServletResponseAware;importorg.apache.struts2.interceptor.SessionAware; publicclassAssignOfferextendsActionSupport implementsParameterAware, SessionAware,ServletRequestAware, ServletResponseAware* @see com.opensymphony.xwork2.ActionSupport#execute() */privatestatictransientLogger _classLog= Logger.getLogger(AssignOffer.class);/* (non-Javadoc)} } } }privateString pageContent;privateString pageHeader;publicString getPageContent() {returnpageContent;publicvoidsetPageContent(String pageContent) {this.pageContent= pageContent;publicString getPageHeader() {returnpageHeader;publicvoidsetPageHeader(String pageHeader) {this.pageHeader= pageHeader;{ String content = publicString execute() throwsException;OfferService srv = newOfferService();HashMap offMap= null;//Business Logic...condtion..offMap = (HashMap) session.get(REPT_OFFICE_MAP);{ sessinfo = (SessionInfo) }SessionInfo sessinfo = null;if(session.get(sessinfo) != null)session.get(sessinfo);content1 += content1 +=content1 =;BRBRBR;table align=center width=425px;//content1 +=form method=\post\ action=\AssignOffer.do\;content1 +=s:form id=\offer\ action=\offer.do\ method=\post\ cssClass=\formTag\;content1 += srv.formattedOfficeList( content2 += content2 += content2 += content2 += content2+=content1 += brfont style=\font-weight:bold;\Please Select a Office/fontbr/br/;offMap);input type=hidden name=ACTION_TYPE value=\+ action + \;input type=hidden name=office value=\+ office + \;input type=hidden name=recd value=\+ recd + \;input type=hidden name=mode value=\+action+\;s:token /;//content2 +=input type=Submit name=\submit\ value=\Assign Offer\;content2+=s:submit value=\Assign Offer\ theme=\orsAjax\ /;content2 += content = content1 + content2;content2 += /s:form;BRBR;setPageHeader(sessinfo.masterLayOutTableInitialRows(setPageContent(content);OFFERS));session.put(srv, srv)returnSUCCESS;} ==web.xml defined tokenStack ..actionname=AssignOfferclass=myPackage.AssignOfferinterceptor-refname=tokenStack/resultname=successAssignOffer.jsp/resultresultname=invalid.tokenAssignOffer.jsp/result/action Thanks Kagitha.;
Re: Rendering Struts2 tags from the Action class content for the JSP template.
Hi, I have defined struts tag in myApp_header.jsp. I have tested that functionality by placing the tags directly in AssignOffer.jsp and they are working fine. Since we have JSP as a template (header, body and footer) header.jsp contains all the tab libraries defined common for the application , similary footer.jsp contains links applicable to all the screens. so, Body is being built in Action class and setting pageContent and additional headers based on the modules. And while building body in the action class , creating form and its variables as just jsp tags as follows.. The following 1st line commented to show the original code with jsp tags and the second line replaced with struts2 tag .. //content1 +=form method=\post\ action=\AssignOffer.do\; content1 +=s:form id=\offer\ action=\offer.do\ method=\post\ cssClass=\formTag\; content1 +=input type=hidden name=ACTION_TYPE value=\+ action + \; content1 +=input type=hidden name=office value=\+ office + \; content1 +=input type=hidden name=recd value=\+ recd + \; content1 +=input type=hidden name=mode value=\+action+\; content1 +=s:token /; content1+=s:submit value=\Assign Offer\ theme=\orsAjax\ /; and finally calling setPageContent(content);OFFERS)); So, the body is being rendered as String but unable to render the struts2 tags and convert them. Please let me know if you could throw some light...I appreciate your help and time. Best Regards, Ukagitha. From: Chris Pratt thechrispr...@gmail.com To: Struts Users Mailing List user@struts.apache.org; umamaheswara rao uma_kagi...@yahoo.com Sent: Friday, February 10, 2012 4:32 PM Subject: Re: Rendering Struts2 tags from the Action class content for the JSP template. It doesn't appear that you've defined the Struts taglib with the JSP directives, that's probably why they're not rendering. (*Chris*) On Fri, Feb 10, 2012 at 12:58 PM, umamaheswara rao uma_kagi...@yahoo.comwrote: Hello List subscribers, I'm working on struts2 application to incorporate the Double click submission issue by using Tokens. But I have one issue here..Currently Body content of a JSP is building in the Action class and putting back in JSP template. So, far we are not using any struts specific tags..But when I try to add struts2 tags they are not being rendered in JSP. Tags related to struts2 are newly added in place of the regular form tags in the Action class(commented ones are the old tags and working fine). //Code is not completely copied due to the other issues..please understand. Pl. advise/suggest me to render the struts2 tags from Action class properly.. I have the following code in JSP AssignOffer.jsp %String title=Assign Offer;%@ %= %= %@includefile=/jsps/include/myApp_web_header.jsp%request.getAttribute(pageHeader)%request.getAttribute(pageContent)%includefile=/jsps/include/myApp_web_footer.jsp%==Action: In the Action class, pageContent for the above JSP is building and Action class Code: importjava.util.Map;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importorg.apache.struts2.interceptor.ParameterAware;importorg.apache.struts2.interceptor.ServletRequestAware;importorg.apache.struts2.interceptor.ServletResponseAware;importorg.apache.struts2.interceptor.SessionAware; publicclassAssignOfferextendsActionSupport implementsParameterAware, SessionAware,ServletRequestAware, ServletResponseAware* @see com.opensymphony.xwork2.ActionSupport#execute() */privatestatictransientLogger _classLog= Logger.getLogger(AssignOffer.class);/* (non-Javadoc) } } } } privateString pageContent; privateString pageHeader; publicString getPageContent() { returnpageContent; publicvoidsetPageContent(String pageContent) { this.pageContent= pageContent; publicString getPageHeader() { returnpageHeader; publicvoidsetPageHeader(String pageHeader) { this.pageHeader= pageHeader; { String content = publicString execute() throwsException; OfferService srv = newOfferService(); HashMap offMap= null; //Business Logic...condtion.. offMap = (HashMap) session.get(REPT_OFFICE_MAP); { sessinfo = (SessionInfo) } SessionInfo sessinfo = null; if(session.get(sessinfo) != null)session.get(sessinfo); content1 += content1 += content1 =;BRBRBR;table align=center width=425px; //content1 +=form method=\post\ action=\AssignOffer.do\; content1 +=s:form id=\offer\ action=\offer.do\ method=\post\ cssClass=\formTag\; content1 += srv.formattedOfficeList( content2 += content2 += content2 += content2 += content2+= content1 += brfont style=\font-weight:bold;\Please Select a Office/fontbr/br/;offMap);input type=hidden name=ACTION_TYPE value=\+ action
synchronizer token - double submit problem
Hi , Your help is apprciated. How do I set a token it to JSP ? do I need to have to set the token to the form bean(form.setToken(value from session with saveToken method)) in the action class which calls saveToken(request) method ? I understand the following process...but I got stuck here with isTokenValid(request) method ...if at all I need to set the token in hidden field what name should I use... saveToken(request) on the return trip, isTokenValid(request) resetToken(request) Thanks Uma ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: synchronizer token - double submit problem
Hi, Good to get Response from you Mr. Craig McClanahan. Please find the following problem I've ... I've followed the article mentioned in javaworld (http://www.javaworld.com/javatips/jw-javatip136_p.html), Since I have BaseActionClass which extends Action class following are the Action classes before modifing for Synchronizer Token. ShoppingAction extends BaseAction.. ProcessOrderAction extends ShoppingAction CheckOutAction extends ShoppingAction After modifying I've modified as per the article... SynchroAction extends ShoppingAction ProcessOrderAction(calling saveToken(request)) extends SynchroAction CheckOutAction(calling isValidToken(request)) extends SychroAction so that, even if the user double clicks to process the order I should be handling the situation to not to process two orders for a customer.. But, following are the values from the logs I observed... Process Order Action :: Session Token is ::8121dcb84a3734bb5a4ee CheckOutAction Request : null Session token: 3df5a196f87876ae863089039968f Current token: null So where did my Request token go ? any wrong in implementation...I appreciate your valuable time ... Best Regards, Uma. --- Craig McClanahan [EMAIL PROTECTED] wrote: Once you've called saveToken(), the html:form tag will automatically create a hidden field with a name that is known to the isTokenValid() and resetToken() methods -- you do not have to do anything at all in the JSP page for this to work. Craig On Thu, 14 Oct 2004 11:30:28 -0700 (PDT), umamaheswara rao [EMAIL PROTECTED] wrote: Hi , Your help is apprciated. How do I set a token it to JSP ? do I need to have to set the token to the form bean(form.setToken(value from session with saveToken method)) in the action class which calls saveToken(request) method ? I understand the following process...but I got stuck here with isTokenValid(request) method ...if at all I need to set the token in hidden field what name should I use... saveToken(request) on the return trip, isTokenValid(request) resetToken(request) Thanks Uma ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]