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 ="";"<BR><BR><BR>";"<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 += "<br><font
style=\"font-weight:bold;\">Please Select a
Office</font><br/><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>";"<BR><BR>"; setPageHeader(sessinfo.masterLayOutTableInitialRows( setPageContent(content);"OFFERS")); session.put("srv",
srv) returnSUCCESS;}
==web.xml
defined tokenStack
..<actionname="AssignOffer"class="myPackage.AssignOffer"><interceptor-refname="tokenStack"/><resultname="success">AssignOffer.jsp</result><resultname="invalid.token">AssignOffer.jsp</result></action>
Thanks
Kagitha.;