You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stephanie Oshe <ne...@gmail.com> on 2008/03/09 03:02:12 UTC

Help Debugging Struts Question

Hi,

I'm new to struts.  I'm trying to write my own simple application with only
1 jsp, only 1 form bean and only 1 action. I've set a breakpoint in netbeans
in the action's execute() method, but the application doesn't stop.  I can
stop in the BaseServlet so I think it's my struts configuration  & not
netbeans.

I think the jsp page is just reloaded which is good except that control
should go through the action first.

I would like to learn more about how struts works and I think the best thing
would be to get the source into netbeans so I can walk through the action
servlet to see where I've made a mistake.

Netbeans 6 has really nice built in support for struts but it's 1.2 and when
I look on the website, the oldest version I see is 1.3.

I downloaded the 1.3 and tried to import it into Netbeans but it won't
compile as is. I probably need to download more things or I have the wrong
version of the jdk.  Something.

So do you all have any advice for me?  Does anyone know where I could get a
source jar to use with netbeans?  Or is there some other technique to get
more insight into how to debug an incorrect configuration?

Thanks for reading.  I'll post my files too in the hope that someone will
see my mistake ...


web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <display-name>Links Manager</display-name>
    <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>
        <servlet-name>BaseServlet</servlet-name>
        <servlet-class>links.servlet.BaseServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>BaseServlet</servlet-name>
        <url-pattern>/hello</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>display.jsp</welcome-file>
        </welcome-file-list>
    <jsp-config>
        <taglib>
            <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
        </taglib>
        </jsp-config>
    </web-app>
struts-config.xml:
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.2//EN" "
http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
    <form-beans>
        <form-bean name="AddLinkActionForm" type="
links.struts.AddLinkActionForm" />
    </form-beans>
    <global-exceptions>
    </global-exceptions>
    <global-forwards>
        <forward name="add" path="/add.do" />
    </global-forwards>
    <action-mappings>
        <action input="/display.jsp" name="AddLinkActionForm" path="/add"
scope="session" type="links.struts.AddLinkAction" unknown="true">
        <forward name="display" path="/display.jsp" />
        </action>
    </action-mappings>
    <controller processorClass="
org.apache.struts.tiles.TilesRequestProcessor" />
    <message-resources parameter="com/myapp/struts/ApplicationResource"
/>
    <plug-in className="org.apache.struts.tiles.TilesPlugin">
        <set-property property="definitions-config" value="/WEB-INF/tiles-
defs.xml" />
        <set-property property="moduleAware" value="true" />
    </plug-in>
    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property property="pathnames" value="/WEB-INF/validator-
rules.xml,/WEB-INF/validation.xml" />
    </plug-in>
</struts-config>