Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problems with action mapping

 
meka toka
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to Struts, i am facing the following a problem with the action mappings.
Here are my code snippets
In web.xml
------------
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
In login.jsp
-------------
<html:form action="/Login"
name="LoginForm"
type="com.xxx.yyy.LoginForm" >

In struts-config.xml
---------------------
FORM-BEANS
------------
<form-beans>
<form-bean name="LoginForm" type="com.xxx.yyy.LoginForm"/>
</form-beans>
GLOBAL FORWARDING
------------------
<global-forwards>
<forward name="Login" path="/login.jsp"/>
</global-forwards>
ACTION MAPINGS
----------------
<action-mappings>
<action path="/Login" type="com.xxx.yyy.LoginAction" scope="request" input="/login.jsp" name="LoginForm">
<forward name="Success" path="/welcome.jsp"/>
<forward name="Failure" path="/login.jsp"/>
</action>

With the above code, when the login.jsp is submitted the values have to be filled in LoginForm which is an ActionForm for the ActionClass LoginAction .
The associated action path is supposed to be /Login but when the jsp is submitted i get an error page saying
The requested resource (/MyApp/Login.do) is not available.
Can somebody point me where am i wrong ?
I am using Tomcat 4.1.24, Struts 1.1
TIA
Meka Toka
 
Junilu Lacar
Bartender
Posts: 7557
52
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you define the servlet in web.xml as well?
See the <servlet> definition in the example at http://www.reumann.net/do/struts/lesson1/step7
 
meka toka
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i have defined the ActionServlet in the web.xml, the reason why i didnt provide the code snippet earlier is because i was trying to show all the code related to the action mapping in both the deployment descriptors.
This looks like a problem that many beginners face, i searched but found no solution.
Any more suggestions ?
TIA
Meka Toka
[ July 24, 2003: Message edited by: meka toka ]
 
Junilu Lacar
Bartender
Posts: 7557
52
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I vaguely remember this happening to me a while back. I'll have to get back to you later though...In the meantime, try searching this site and the web for that error message; use a search phrase like "Tomcat Struts resource not available"
 
meka toka
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also can somebody clarify this
When a struts application is deployed on Tomcat server, should there be any pop ups of the Action Mapping, Success and Failure files.
If the pop up doesnt come up in stack trace when starting Tomcat, does it mean that the form-beans(ActionForms) are not properly configured in deployment descriptors ?
Does extending the ActionMapping and writing your own ActionMapping cause any of these pop ups ?
I am asking this because, when i start Tomcat no popups comeup, where as when i place storefront sample application, there are pop ups of the Form beans, and some other stuff.
Thank You
Meka Toka
 
Sazzad Rafique
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I guess the problem is in the jsp page from where you click on the link to invoke the action. I got the same error when I was using <a href=""></a> instead of <html:link></html:link>. My mistake was I was using an extra "/". So if you check the address in the task bar when you put your mouse on the link of that action you might get a clue.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic