I spent a ridiculous number of hours trying to get my index.jsp forwarding
to a Tile, and have finally succeeded. I had looked through the struts-user
archives for others with my problem, but never found the answer to my issue,
so I'm posting the results of my efforts in the hopes they'll help someone
else.

Config:
    Jboss 3.2.3
    Struts 1.1 w/ Tiles

When I deployed struts-blank.war and entered
http://localhost:8080/struts-blank, I would get redirected to the "real"
welcome page from the index.jsp, as expected.

In my own app, I set up the index.jsp file exactly as in the
struts-blank.war, i.e.

    <%@ taglib uri="/tags/struts-logic" prefix="logic" %>
    <logic:redirect forward="welcome"/>

and in my struts-config.xml file, I added a global forward like the blank
example:

    <forward  name="welcome"  path="/Welcome.do  />

As well as an action which forwards to the desired tile definition:

    <action  path="/Welcome"  type="org.apache.struts.actions.ForwardAction"
parameter=".myapp.welcome"  />


When I enter http://localhost:8080/myapp, I used to get a
org.apache.jasper.JasperException
at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
54)
<snipped>

whose root cause was listed as...

java.lang.NullPointerException
        at 
org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:521)
        at 
org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:436)
        at 
org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:396)
        at 
org.apache.struts.taglib.logic.RedirectTag.doEndTag(RedirectTag.java:294)
        at 
org.apache.jsp.index_jsp._jspx_meth_logic_redirect_0(index_jsp.java:75)
        at org.apache.jsp.index_jsp._jspService(index_jsp.java:52)
        at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
<snipped>

Until I added the line <load-on-startup>2</load-on-startup> in my web.xml
file. After doing so, I received errors indicating that my Tiles definitions
were not being found (i.e. Something on the order of "the path does not
begin with a '/')

To fix this second issue, In struts-config.xml, I defined Tiles as a plugin,
i.e.

<plug-in className="org.apache.struts.tiles.TilesPlugin" >
 <set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml"/>
 <set-property property="definitions-debug" value="1" />
 <set-property property="definitions-parser-details" value="0" />
 <set-property property="definitions-parser-validate" value="true" />
</plug-in>

Instead of a controller, as was done in the blank application, i.e.

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

Now everything works as expected. Maybe I'll finally be able to spend some
time on my application logic instead of on Struts quirks...

HTH,

Patterson



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to