jQuery in Action, 3rd edition
The moose likes Struts and the fly likes Using Struts 2 plugins for JSF and Tiles together in one app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Using Struts 2 plugins for JSF and Tiles together in one app" Watch "Using Struts 2 plugins for JSF and Tiles together in one app" New topic

Using Struts 2 plugins for JSF and Tiles together in one app

Martin Ebenezer

Joined: Oct 17, 2011
Posts: 2
I am trying to use Strut2 plugins for JSF and Tiles together and I am facing difficulties and getting them configured to work right within a single Struts 2 application.

My struts.xml contains package as below:

<package name="tiles" extends="tiles-default, jsf-default" namespace="/tiles">

<result-type name="jsf" class="org.apache.struts2.jsf.FacesResult" />

<interceptor-stack name="jsfFullStack">
<interceptor-ref name="params" />
<interceptor-ref name="basicStack"/>
<interceptor-ref name="jsfStack"/>

<default-interceptor-ref name="jsfFullStack"/>

<action name="Home" class="demo.action.HomeAction">
<result name="success" type="tiles">home.get.name</result>
<result name="redirect" type="tiles">say.hello.name</result>


and my web.xml has the below content:




The tiles.xml has content like below:
<definition name="home.get.name" template="/tiles/layout.jsp">
<put-attribute name="body" value="/tiles/home.jsp"/>
<put-attribute name="footer" value="/tiles/footer.jsp"/>

The JSP file home.jsp has JSF core and html tags but I keep getting the following exception message:
at javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java:1858)
at org.apache.jsp.tiles.home_jsp._jspx_meth_h_005fform_005f0(home_jsp.java:119)
at org.apache.jsp.tiles.home_jsp._jspService(home_jsp.java:89)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

The home.jsp contains the below code:
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<p>This example illustrates the Struts 2 /Tiles Plugin with JSF.</p>
<h:form id="enterNameFormId">
<h:outputText value="First Name:" />
<h:inputText id="firstName" size="30"
value="#{action.model.person.name.firstName}" required="true">
<f:validateLength minimum="2" maximum="30" />
<h:message for="firstName" />
<br />
<h:outputText value="Last Name:" />
<h:inputText id="lastName" size="30"
value="#{action.model.person.name.lastName}" required="true">
<f:validateLength minimum="2" maximum="30" />
<h:message for="lastName" />
<br />
<h:commandButton value="Say Hello" type="submit" action="#{action.sayHello}"/>


If any of you have configured both the plugins for JSF and Tiles in one Struts 2 app please provide me some info on the configuration that needs to be done?
Appreciate your help.
I agree. Here's the link: http://aspose.com/file-tools
subject: Using Struts 2 plugins for JSF and Tiles together in one app
It's not a secret anymore!