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)
> 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.;

Reply via email to