dharga
dharga

Reputation: 2217

Struts Config with Tiles

My struts-config.xml has a few forward actions that point to tiles definitions. Everything seems to be going alright until the forward gets resolved to the tiles definition name instead of the jsp the definition points to.

From struts-config.xml

<action-mappings>
    <action name="userTokenForm" path="/createtoken" type="com.bcbst.providertokenweb.actions.CreatetokenAction" 
            scope="request" parameter="action" input="registration.provider.createtoken" validate="true">

       <forward name="createtokens" path="registration.provider.createtoken"></forward>
       <forward name="success" path="registration.provider.success" redirect="false"></forward>
    </action>
</action-mappings>

From tiles-defs.xml

<definition name="registration.provider.main" page="/theme/bcbst/template.jsp">
  <put name="body" value="/default.jsp"/>
</definition>

<definition name="registration.provider.createtoken" page="/theme/bcbst/template.jsp">
  <put name="body" value="/createtoken.jsp"/>
</definition>

<definition name="registration.provider.success" page="/theme/bcbst/template.jsp">
  <put name="body" value="/success.jsp"/>
</definition>

When the createtokens forward gets called, a 404 is thrown saying /registration.provider.createtoken doesn’t exist.

Upvotes: 1

Views: 3570

Answers (2)

Th0rndike
Th0rndike

Reputation: 3436

try to change the page attribute to path

Upvotes: 0

tusar
tusar

Reputation: 3424

Check the following things:

1) Are you returning the ActionForward like this :

return mapping.findForward("createtokens"); 

2) Did you add tiles plugin and controller processor in your struts-config.xml ?

<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>

<plug-in className="org.apache.struts.tiles.TilesPlugin" >
    <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
    <set-property property="moduleAware" value="true" />
</plug-in>

3) Do you have these JSP files at correct place (inside project context) ?

/createtoken.jsp

/theme/bcbst/template.jsp

Upvotes: 1

Related Questions