facebook

Struts tiles problem

  1. MyEclipse Archived
  2.  > 
  3. Documentation
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #274023 Reply

    rgentela
    Member

    Hi,
    I am having problem with the struts tiles. I have configured all the files like Struts-config, web.xml, created tiles-def and template.jsp but still my application does not load the tiles.

    I am using MyEclipse, Tomcat 6.0
    please help

    struts-config.xml

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <!DOCTYPE struts-config PUBLIC “-//Apache Software Foundation//DTD Struts Configuration 1.1//EN” “http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd”&gt;

    <struts-config>
    <data-sources />
    <form-beans >
    <form-bean name=”loginForm” type=”com.arccorp.pram.form.LoginForm” />
    <form-bean name=”projectMainForm” type=”com.arccorp.pram.form.ProjectMainForm” />
    </form-beans>
    <global-exceptions />
    <global-forwards ></global-forwards>

    <action-mappings >
    <action
    attribute=”loginForm”
    input=”/jsp/login.jsp”
    name=”loginForm”
    path=”/login”
    scope=”request”
    type=”com.arccorp.pram.action.LoginAction”>
    <forward name=”success” path=”/projectMain.do” />
    <forward name=”failure” path=”/jsp/login.jsp” />
    </action>
    <action
    attribute=”projectMainForm”
    name=”projectMainForm”
    path=”/projectMain”
    scope=”request”
    type=”com.arccorp.pram.action.ProjectMainAction”>
    <forward name=”success” path=”/jsp/project_main.jsp” />
    </action>

    </action-mappings>
    <message-resources parameter=”com.arccorp.pram.ApplicationResources” />

    <plug-in className=”org.apache.struts.tiles.TilesPlugin”>
    <set-property property=”definitions-config” value=”/WEB-INF/tiles-def.xml” />
    </plug-in>
    </struts-config>

    —————————————————————————————————

    web.xml

    <?xml version=”1.0″ encoding=”UTF-8″?>

    <web-app version=”2.4″ xmlns=”http://java.sun.com/xml/ns/j2ee&#8221; xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221;
    xsi:schemaLocation=”http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd”&gt;
    <servlet><servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.tiles.ActionComponentServlet</servlet-class>
    <!–
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    –>
    <init-param>
    <param-name>config</param-name>
    <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
    <param-name>debug</param-name>
    <param-value>3</param-value>
    </init-param>
    <init-param>
    <param-name>detail</param-name>
    <param-value>3</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    <jsp-config>
    <taglib>
    <taglib-uri>/WEB-INF/struts-tiles</taglib-uri>
    <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
    </taglib>
    </jsp-config>
    </web-app>

    —————————————————————————————
    tiles-def.xml

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <xml-body>

    <tiles-definitions>

    <definition name=”siteLayoutDef” path=”/jsp/template.jsp”>
    <put name=”title” type=”string”>PRAM Project</put>
    <put name=”header” type=”string”>THIS IS THE HEADER”</put>
    <put name=”footer” type=”string”>THIS IS THE FOOTER”</put>
    <put name=”content” type=”string”>Content goes here</put>
    </definition>

    </tiles-definitions>

    </xml-body>

    ————————————————————————-

    template.jsp

    <%@ page language=”java” %>
    <%@ taglib uri=”/WEB-INF/struts-tiles.tld” prefix=”tiles” %>
    <html>

    <head>
    <title><tiles:getAsString name=”title” ignore=”true”/></title>
    </head>

    <body>
    <table border=”1″ cellpadding=”0″ cellspacing=”0″ width=”100%” bordercolor=”#000000″ bgcolor=”#E7FDFE”>
    <tr>
    <td width=”100%” colspan=”2″ valign=”top”><tiles:insert attribute=”header”/></td>
    </tr>
    <tr>
    <td width=”23%”><tiles:insert attribute=”menu”/></td>
    <td width=”77%” valign=”top” valign=”top”><tiles:insert attribute=”body”/></td>
    </tr>
    <tr>
    <td width=”100%” colspan=”2″ valign=”top”><tiles:insert attribute=”bottom”/></td>
    </tr>
    </table>
    </body>

    </html>
    —————————————————————-

    #274050 Reply

    Loyal Water
    Member

    Can you paste your installation details here for me. The posting guidelines thread can be found at the top of the forum.

    #274053 Reply

    Loyal Water
    Member

    Your issue is most likely due to the fact that you added Struts 1.2 capabilities, then when you went to create the struts page, you used the Struts 1.1 templates that have their URIs in the form: http://jakarta.apache.org/struts/&#8230; instead of http://struts.apache.org/&#8230;

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Struts tiles problem

You must be logged in to post in the forum log in