Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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

Reply With Quote
  #2 (permalink)  
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.



Reply With Quote
  #3 (permalink)  
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

Reply With Quote
  #4 (permalink)  
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

Reply With Quote
  #5 (permalink)  
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.



Reply With Quote
  #6 (permalink)  
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>

Reply With Quote
  #7 (permalink)  
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

Reply With Quote
  #8 (permalink)  
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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:12 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.