Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
| Search | Today's Posts | Mark Forums Read
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 March 16th, 2005, 10:06 PM
Registered User
 
Join Date: Mar 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help me! about "beginning JSP Web Development"

I have downloaded code of Beginning JSP WEB Development,
when I run example begjsp-tourism in tomcat 4.1,
tomcat 4.1 will output the fllowing errors:
 cann't find path /home

please help me resovle the problem

Thanks in advance

 
Old March 17th, 2005, 01:12 AM
Registered User
 
Join Date: Jan 2005
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rbonslat
Default

Hi,

It sounds like a problem with your struts-config.xml file or web.xml. Check to see if your action-mappings are correct. Request sent to index.jsp; index.jsp redirects to home.do; anything in .do mapped to struts action servlet; action servlet looks at struts-config.xml and sees home.do should be mapped to com.wrox.tourism.action.BeanNames. Paste your struts-config.xml and web.xml file so I can compare with mine.



 
Old March 17th, 2005, 05:08 AM
Registered User
 
Join Date: Mar 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I paste the content of web.xml&struts.xml at here

This is content of web.xml

<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>TourismResources</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>



  <servlet>
    <servlet-name>dbInit</servlet-name>
    <servlet-class>com.wrox.tourism.db.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/tourism_db</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>



  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Edit attraction</web-resource-name>
      <url-pattern>/editAttraction.do</url-pattern>
    </web-resource-collection>
    <web-resource-collection>
      <web-resource-name>Update attraction</web-resource-name>
      <url-pattern>/updateAttraction.do</url-pattern>
    </web-resource-collection>
    <web-resource-collection>
      <web-resource-name>Deregister attraction</web-resource-name>
      <url-pattern>/deregisterAttraction.do</url-pattern>
    </web-resource-collection>
    <web-resource-collection>
      <web-resource-name>List events</web-resource-name>
      <url-pattern>/listEvents.do</url-pattern>
    </web-resource-collection>
    <web-resource-collection>
      <web-resource-name>Add event</web-resource-name>
      <url-pattern>/editEvent.jsp</url-pattern>
    </web-resource-collection>
    <web-resource-collection>
      <web-resource-name>Edit event</web-resource-name>
      <url-pattern>/editEvent.do</url-pattern>
    </web-resource-collection>
    <web-resource-collection>
      <web-resource-name>Update event</web-resource-name>
      <url-pattern>/updateEvent.do</url-pattern>
    </web-resource-collection>
    <web-resource-collection>
      <web-resource-name>Delete event</web-resource-name>
      <url-pattern>/deleteEvent.do</url-pattern>
    </web-resource-collection>

    <auth-constraint>
      <role-name>attraction</role-name>
    </auth-constraint>
  </security-constraint>



  <login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
      <form-login-page>/login.jsp</form-login-page>
      <form-error-page>/login.jsp</form-error-page>
    </form-login-config>
  </login-config>

</web-app>

This is content of struts-config.xml

<struts-config>

  <form-beans>
    <form-bean name="attractionForm"
      type="com.wrox.tourism.entity.Attraction"/>
    <form-bean name="eventForm" type="com.wrox.tourism.entity.Event"/>
  </form-beans>

  <action-mappings>

    <action path="/home"
      type="com.wrox.tourism.actions.HomeAction"
      unknown="true">
      <forward name="success" path="/index.jsp"/>
    </action>

    <action path="/viewAttraction"
      type="com.wrox.tourism.actions.ViewAttractionActio n"
      input="/home.do">
      <forward name="success" path="/viewAttraction.jsp"/>
    </action>

    <action path="/registerAttraction"
      type="com.wrox.tourism.actions.RegisterAttractionA ction"
      input="/registerAttraction.jsp"
      name="attractionForm"
      scope="request">
      <forward name="success" path="/confirmRegistration.jsp"/>
    </action>

    <action path="/editAttraction"
      type="com.wrox.tourism.actions.EditAttractionActio n"
      input="/home.do">
      <forward name="success" path="/editAttraction.jsp"/>
    </action>

    <action path="/updateAttraction"
      type="com.wrox.tourism.actions.UpdateAttractionAct ion"
      input="/editAttraction.jsp"
      name="attractionForm"
      scope="request">
      <forward name="success" path="/confirmUpdate.jsp"/>
    </action>

    <action path="/listEvents"
      type="com.wrox.tourism.actions.ListEventsAction"
      input="/editAttraction.do">
      <forward name="success" path="/listEvents.jsp"/>
    </action>

    <action path="/editEvent"
      type="com.wrox.tourism.actions.EditEventAction"
      input="/listEvents.do">
      <forward name="success" path="/editEvent.jsp"/>
    </action>

    <action path="/updateEvent"
      type="com.wrox.tourism.actions.UpdateEventAction"
      input="/editEvent.jsp"
      name="eventForm"
      scope="request">
      <forward name="success" path="/listEvents.do"/>
    </action>

    <action path="/deleteEvent"
      type="com.wrox.tourism.actions.DeleteEventAction"
      input="/listEvents.do">
      <forward name="success" path="/listEvents.do"/>
    </action>

    <action path="/deregisterAttraction"
      type="com.wrox.tourism.actions.DeregisterAttractio nAction"
      input="/editAttraction.do">
      <forward name="success" path="/home.do" redirect="true"/>
    </action>

    <action path="/logoff"
      type="com.wrox.tourism.actions.LogoffAction"
      input="/editAttraction.do">
      <forward name="success" path="/home.do" redirect="true"/>
    </action>

  </action-mappings>

</struts-config>

Thanks

 
Old March 17th, 2005, 05:11 AM
Registered User
 
Join Date: Mar 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have replaced home.jsp with index.jsp,but the errors is going on

 
Old March 17th, 2005, 01:21 PM
Registered User
 
Join Date: Jan 2005
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rbonslat
Default

By default, anything with index.* is automatically read first if a person was to send a request URL with root directory only:

              http://localhost:8080/begjsp-tourism/

When your index.jsp is read, it directs anything with *.do to the action servlet with home.do as the request. Check your struts-config.xml and see if your action-mappings look like this:

              <action-mappings>

                <action path="/home"
                 type
                 unknown="true">
                 <forward name="success" path="/home.jsp"/>
                </action>

The "/home" action path is actually the home.do request as stated earlier (doesn't need .do at end). It then consorts your action class "com.wrox.tourism.actions.HomeAction" (gathers information from MySQL database). If the process was successful, it forwards the name "success" to the action servlet. If not, it should print an error with database connection. The successful name is than sent to home.jsp which has all the layout information. If this doesn't help I will send you my version of my xml files.



 
Old March 17th, 2005, 01:23 PM
Registered User
 
Join Date: Jan 2005
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rbonslat
Default

I'm sorry, this is the correct action mappings:

<action-mappings>

    <action path="/home"
      type="com.wrox.tourism.actions.HomeAction"
      unknown="true">
      <forward name="success" path="/home.jsp"/>
    </action>

 
Old March 20th, 2005, 09:13 PM
Registered User
 
Join Date: Mar 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have tryed. It cann't be ran.
could you send me your version of xml files.
please send the file to the fllowing email
ddgfei@yahoo.com.cn
thanks in advance

 
Old May 13th, 2006, 12:52 PM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Could you send me the same file(struts-config.xml & web.xml),I need too.
Email:wang_233933_1@hotmail.com

Thanks in advance





Similar Threads
Thread Thread Starter Forum Replies Last Post
Next levet after "Beginning JSP Web Development" nolas JSP Basics 0 September 29th, 2005 04:58 AM
CHP 17 "BEGINNING JSP WEB DEVELOPMENT" DR POMPEII JSP Basics 2 April 22nd, 2005 11:47 PM
Beginning JSP Web Development - Ch08 Cyclops All Other Wrox Books 0 January 31st, 2005 04:12 PM
Beginning JSP Web Development Book - Struts questi gstoyanoff JSP Basics 2 February 25th, 2004 02:21 PM
Who have the code of Beginning jsp web development Robertzang JSP Basics 2 September 5th, 2003 03:49 AM





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