Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

Problem with Tiles an ActionForms

Sebastian Marten

2006-12-28

Replies:

Hello List,

I have a problem with Struts Tiles.

First I wrote all sub-page's for a very little Web shop.

Then i started with tiles and created a simple test layout.
Nothing special, but it works.
I have several normal pages, like the page "katliste.jsp"
I click the link to the related action:

<html:link action="katliste">Unser Angebot</html:link>
And then the page is displayed in the Layout.

So far, so good.
Then I have 2 pages with a Struts Action Form and Action Form bean.
I Created the definition for this page in the tiles-xml and configured
the action forwards in the struts-config.
But then i create a link the /createuser.do:
<html:link action="createuser">Hier können sie sich Anmelden</html:link>

I see only the corresponding .jsp page an not the hole layout.

There is the Problem?

I hope you can help me!

Best regards,
Sebastian Marten


########################
createuser.jsp

<html:form action="createuser">
  <table border="1">

    <tr>
       <td><bean:message key="user.nick" /></td>
       <td><html:text property="nick" /></td>

    </tr>
    <tr>
       <td><bean:message key="user.name" /></td>
       <td><html:text property="name" /></td>
    </tr>
   <.....>
 <html:submit />
</html:form>
######################



Layout
<body>

    <table border="2" width="100%">
       <tr>
          <td colspan="2">
            <tiles:insert attribute="header" />
          </td>

       </tr>
       <tr height="500">
            <td width="200"><tiles:insert attribute="navigation"
/> </td>

            <td> <tiles:insert attribute="body" /></td>
       </tr>
       <tr>
          <td colspan="2">
            <tiles:insert attribute="footer" />
          </td>
       </tr>

    </table>

  </body>
 
###########################

 Base Definition in tiles-defs.xml
 
    <!-- Base Tiles Definition -->
  <definition name="base.definition" path="/tiles/seitenschema.jsp">
    <put name="header" value="/tiles/header.jsp" />
    <put name="navigation" value="/tiles/nav.jsp" />
    <put name="footer" value="/tiles/footer.jsp" />
  </definition>
 
    <!-- Tiles Definition of Kategorieliste -->
  <definition name="page.katliste" extends="base.definition">
    <put name="title" value="Artikelliste" />
    <put name="body" value="/jsp/katliste.jsp" />
  </definition>
 
 Problem???
 
    <!-- Tiles Definition of Create User -->
  <definition name="page.createuser" extends="base.definition">
    <put name="title" value="User erstellen" />
    <put name="body" value="/createuser.jsp" />
  </definition>
 
 
#####################
 
 
struts-config.xml

<action path="/katliste" type="com.myapp.struts.Kategorieliste" >
    <forward name="success" path="page.katliste"/>
</action>

<action input="/createuser.jsp" name="CreateUserActionForm"
path="/createuser" scope="request" type="com.myapp.struts.CreateUser" >
  <forward name="success" path="page.welcome"/>
  <forward name="failed" path="page.createuser"/>
</action>
   


Attachment: signature.asc
©2008 junlu.com - Jax Systems, LLC, U.S.A.