List,

I'm a Struts newbie with a lot of general hours in Tomcat. I want to advance my development with Struts 1.1 and Model 2.

In an applied Struts scenario I have performed the following:

Followed closely the suggestions for integrating Struts into an existing web application. I did do one thing that deviated, I moved all of the Struts TLDs into a subdirectory of WEB-INF (tlds/) per my usual development/deployment practice (I did correct the web.xml to reflect this move.)

However, I'm having a helluva time getting a very simple application to use Struts (I applying the Struts model to a development sandbox I use).

Step 1. Add servlet and servlet-mapping to web app web.xml

    <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>
        <load-on-startup>1</load-on-startup>
    </servlet>
    ...


<servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping>

...

Step 2. Create the form for input

strutsSearch.html:

...
<form action="/webAppDev/actions/search.do" method="get">
    ...
</form>
...

Step 3. Create the Action subclass

package webAppDev;

import javax.servlet.http.*;
import org.apache.struts.action.*;

public class SearchAction1 extends Action {
    public ActionForward execute( ActionMapping mapping, Action form,
                                  HttpServletRequest request,
                                  HttpServletResponse response )
    throws Exception {
        return( mapping.findForward( "success" ) );
    }
}

Step 4. Update struts-config.xml

    <action-mappings>
        <action path="/webAppDev/actions/search1"
                type="webAppDev.SearchAction1"
                name="noBean"
                scope="request"
                input="/webAppDev/strutsSearch.jsp">
            <forward name="success" path="/webAppDev/SearchEngines"/>
        </action>
    </action-mappings>

Step 5. Test

http://localhost:8080/webAppDev/strutsSearch.jsp

[click submit]

http://localhost:8080/webAppDev/action/search1.do loads but returns an empty page.

My success mapping "/webAppDev/SearchEngines" should read some request parameters and further redirect to a Search Engine, i.e. Google. It works otherwise without Struts.

What am I doing wrong? I must be too close. Everything seems to be configured correctly. A typo? A config?

Many thanks in advance for any suggestions,
Tim


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



Reply via email to