struts, mapping.findForward() wont lauch jsp file
Hi,
I have configured my app as follow:
$CATALINA_HOME/conf/server.xml
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="/Core1" docBase="Core1" debug="5" reloadable="true" crossContext="true">
<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="iam" password="mypass" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/mydb?autoReconnect=true"/>
</Context>
</host>
This gonna tell the servlet container that the Core1 application has a connection pool ready to be used
Then in the WEB-INF/web.xml i have:
<listener>
<listener-class>com.core.listener.ResourceManagerListener</listener-class>
</listener>
<servlet>
<servlet-name>action</servlet-name>
<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>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
<error-page>
<exception-type>Exception</exception-type>
<location>/WEB-INF/error/error.jsp</location>
</error-page>
<resource-ref>
<description>DB connection</description>
<res-ref-name>jdbc/TestDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
This gonna tell the servlet container that the appication Core1 use struts framework which handle all requests ended with .do.
Finally, the struts-config.xml
<global-forwards>
<forward name="main" path="/index.jsp"/>
<forward name="login" path="/authentication/login.jsp"/>
<forward name="testS" path="testStruts.jsp"/>
</global-forwards>
<action-mappings>
<!-- <action path="/Welcome" forward="/welcomeStruts.jsp"/> -->
<action path="/testStruts" type="com.core.servlet.testStruts"/>
<action path="/authentication" type="com.core.servlet.Authentication" />
<action path="/protected/financial" type="com.core.servlet.Financial">
<forward name="/protected/financialDisplay" path="/financial/financialDisplay.jsp" />
<forward name="/protected/financialInput" path="/financial/financialInput.jsp" />
<forward name="/protected/financialManager" path="/financial/financialManager.jsp" />
<forward name="/protected/financialSearch" path="/financial/financialSearch.jsp" />
</action>
<action path="/protected/financialProcess" type="com.core.servlet.FinancialProcessor" />
</action-mappings>
Now, I have a testStruts class which extends Action class as follow:
publicclass testStrutsextends Action
{
public ActionForward perform(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, UserInputException, InternalException
{
return mapping.findForward("testS");
}
}
and the testStruts.jsp is just a normal jsp file in WEB-INF folder.
When I try to access testStruts.do (the controler) from my browser:
http://localhost:8084/Core1/testStruts.do
i though the testStruts.jsp will be displayed but there is nothing happen. I got a blank page.
Does anyone know why?

