You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nhut Thai Le <ln...@yahoo.com> on 2007/07/05 18:17:54 UTC
action class does not perfom
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 tells 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>
The above tell the servlet container that the appication Core1 uses 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:
public class testStruts extends Action
{
public ActionForward perform(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException,
IOException,
UserInputException,
InternalException
{
System.out.println("print of this method is invoked");
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.
The testStruts class doesnt seem to be invoked anyway because nothing is print out in the console.
Does anyone know why?
-------------------------
Where there's will, there's a way
---------------------------------
Get your own web address.
Have a HUGE year through Yahoo! Small Business.
Re: action class does not perfom
Posted by Nhut Thai Le <ln...@yahoo.com>.
Niall Pemberton <ni...@gmail.com> wrote: On 7/5/07, Nhut Thai Le wrote:
> Hi,
> I have configured my app as follow:
>
> $CATALINA_HOME/conf/server.xml
> > unpackWARs="true" autoDeploy="true"
> xmlValidation="false"
> xmlNamespaceAware="false">
> > docBase="Core1"
> debug="5"
> reloadable="true"
> crossContext="true">
> > 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"/>
>
>
>
> This tells the servlet container that the Core1 application has a connection pool ready to be used
> Then in the WEB-INF/web.xml i have:
>
>
>
> com.core.listener.ResourceManagerListener
>
>
>
> action
>
> org.apache.struts.action.ActionServlet
>
>
>
config
>
> /WEB-INF/struts-config.xml
>
>
>
>
debug
>
2
>
>
>
detail
>
2
>
> 2
>
>
> action
> *.do
>
>
>
> 30
>
>
>
>
> index.jsp
>
>
>
> Exception
> /WEB-INF/error/error.jsp
>
>
> DB connection
> jdbc/TestDB
> javax.sql.DataSource
> Container
>
>
> The above tell the servlet container that the appication Core1 uses struts framework which handle all requests ended with .do.
> Finally, the struts-config.xml:
>
>
>
>
>
>
>
> >
> -->
> > type="com.core.servlet.testStruts"/>
> > type="com.core.servlet.Authentication"/>
> > type="com.core.servlet.Financial">
> > path="/financial/financialDisplay.jsp"/>
> > path="/financial/financialInput.jsp"/>
> > path="/financial/financialManager.jsp"/>
> > path="/financial/financialSearch.jsp"/>
>
> > type="com.core.servlet.FinancialProcessor"/>
>
>
> Now, I have a testStruts class which extends Action class as follow:
>
> public class testStruts extends Action
> {
> public ActionForward perform(
> ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response)
> throws ServletException,
> IOException,
> UserInputException,
> InternalException
> {
> System.out.println("print of this method is invoked");
> return mapping.findForward("testS");
> }
> }
>
> and the testStruts.jsp is just a normal jsp file in WEB-INF folder.
If its in the WEB-INF folder then it should be:
Niall
> 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.
> The testStruts class doesnt seem to be invoked anyway because nothing is print out in the console.
> Does anyone know why?
Sorry, my bad. The testStruts.jsp is not in WEB-INF, it's in Web Pages folder, one level up from WEB-INF. Thus i dont think i need to change the path to /WEB-INF/testStruts.jsp. Any other idea?
Thai
---------------------------------
Be a better Heartthrob. Get better relationship answers from someone who knows.
Yahoo! Answers - Check it out.
Re: action class does not perfom
Posted by Niall Pemberton <ni...@gmail.com>.
On 7/5/07, Nhut Thai Le <ln...@yahoo.com> wrote:
> 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 tells 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>
>
> The above tell the servlet container that the appication Core1 uses 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:
>
> public class testStruts extends Action
> {
> public ActionForward perform(
> ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response)
> throws ServletException,
> IOException,
> UserInputException,
> InternalException
> {
> System.out.println("print of this method is invoked");
> return mapping.findForward("testS");
> }
> }
>
> and the testStruts.jsp is just a normal jsp file in WEB-INF folder.
If its in the WEB-INF folder then it should be:
<forward name="testS" path="/WEB-INF/testStruts.jsp"/>
Niall
> 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.
> The testStruts class doesnt seem to be invoked anyway because nothing is print out in the console.
> Does anyone know why?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org