Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 13th, 2004, 02:29 PM
Registered User
 
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with Action Mappings in Chps. 19-20

Hello,
I'm using the sample web application in Chps. 19-20 as a guide for creating my own application. I'm having a problem getting the Action Mappings to work correctly.

I'm getting a 404 - Servlet action is not available error when I try to load my app. I've configured the pages and web.xml/struts-config.xml as demonstrated in the book.

Can anyone point me in the right direction? Below are some details from my config files...

The default page (index.jsp) has two lines. I know I'm getting to this point b/c when I change the tags I get different error messages:
<%@ taglib uri="/logic" prefix="logic" %>
<logic:redirect href="home.do"/>

My web.xml is:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
            <param-name>application</param-name>
            <param-value>PartDBResources</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>

<servlet>
    <servlet-name>dbInit</servlet-name>
        <servlet-class>util.DBInitServlet</servlet-class>
        <init-param>
            <param-name>driverClass</param-name>
            <param-value>org.gjt.mm.mysql.Driver</param-value>
        </init-param>
        <init-param>
            <param-name>jdbcURL</param-name>
            <param-value>jdbc:mysql://localhost:3306/partnerships</param-value>
        </init-param>
        <init-param>
            <param-name>minCount</param-name>
            <param-value>1</param-value>
        </init-param>
        <init-param>
            <param-name>maxCount</param-name>
            <param-value>10</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>
<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

        <taglib>
    <taglib-uri>/bean</taglib-uri>
    <taglib-location>/web-inf/struts-bean.tld</taglib-location>
</taglib>

<taglib>
    <taglib-uri>/html</taglib-uri>
    <taglib-location>/web-inf/struts-html.tld</taglib-location>
</taglib>

<taglib>
    <taglib-uri>/logic</taglib-uri>
    <taglib-location>/web-inf/struts-logic.tld</taglib-location>
</taglib>

<taglib>
    <taglib-uri>/template</taglib-uri>
    <taglib-location>/web-inf/struts-template.tld</taglib-location>
</taglib>
</web-app>

My struts-config.xml file is:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE struts-config
    PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
    "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
    <form-bean name="entityForm" type="base.Entity"/>
</form-beans>

    <action-mappings>
        <action path="/home"
            type="Actions.HomeAction"
            unknown="true">
            <forward name="Success" path="/home.jsp"/>
            </action>

    </action-mappings>
</struts-config>

Any help would be greatly appreciated.
Thanks,
Mike






Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 20 Problem with PictureInfo joergUmbricht BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 0 September 30th, 2007 02:57 AM
Number(20,2) Rounding off Problem saravananedu Oracle 1 October 8th, 2005 11:10 PM
Chapter 19 Address List problem srgibson99 BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 June 15th, 2005 05:21 PM
Where are the database downloads for 19 and 20 bobriant62 Java Databases 0 April 7th, 2004 05:52 PM
Problem with exercise in chapter 19 backslash BOOK: Beginning Visual C++ 6 4 September 5th, 2003 11:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.