File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Servlet Action not found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Servlet Action not found" Watch "Servlet Action not found" New topic
Author

Servlet Action not found

manikandan jayakumar
Ranch Hand

Joined: Aug 20, 2011
Posts: 41



Is there any thing wrong in this xml file?

My HelloForm.java extends Action Form class and it is in "proj/WEB-INF/classes/com/test/"

My HelloWorldA.java is in "proj/WEB-INF/classes/com/"
Ravishanker kumar
Ranch Hand

Joined: Jul 20, 2006
Posts: 53
According to your struts-config file,
--your form action on jsp should be action="/helloWorld"
--your action class HelloWorld.java should be in com package and must extend org.apache.struts.action.Action class.
Please check above two points.
Orton K Randy
Ranch Hand

Joined: Aug 12, 2011
Posts: 41

The error stacktrace and JSP in question would be helpful. Also make sure you've done enough debugging before starting a thread for a problem. Like I said before, try understanding a working Struts application if you face issues with your app.


Coderanch, best ever forum on the net. Hands down.
manikandan jayakumar
Ranch Hand

Joined: Aug 20, 2011
Posts: 41

If I use the code

in my index page 'm getting the error
The requested resource (/helloWorld) is not available.
if i use helloWorld.do in place of /helloWorld
'm getting Servlet Action not found
Ravishanker kumar
Ranch Hand

Joined: Jul 20, 2006
Posts: 53
if you use struts tag, you can use simply, <html:form action="/helloWorld"...> struts tag does required conversion for you.
if you are use html tag you have to use <form action="/helloWorld.do"...>
Have you checked that your action class extending org.apache.struts.action.Action class. If this part is also ok, Please provide all files to find out the root cause.

~Ravi
manikandan jayakumar
Ranch Hand

Joined: Aug 20, 2011
Posts: 41

index.jsp:


struts-config.xml

web.xml


HelloWorldA.java(proj/WEB-INF/classes/com/)


HelloForm.java(proj/WEB-INF/classes/com/test)

helloWorld.jsp


manikandan jayakumar
Ranch Hand

Joined: Aug 20, 2011
Posts: 41

After i restarted my server there is no error but not getting the correct answer
it just displaying 0 0 0 0 0 0
instead of name,mark1,mark2....mark5.
WARNING : No FormBeanConfig found in module under name name
manikandan jayakumar
Ranch Hand

Joined: Aug 20, 2011
Posts: 41

Finally 'm in state not getting the result just zeros instead of values

INFO: initialize action of type: com.HElloWorldA
Ravishanker kumar
Ranch Hand

Joined: Jul 20, 2006
Posts: 53
You are also using array in action form incorrectly. please try on google for this
manikandan jayakumar
Ranch Hand

Joined: Aug 20, 2011
Posts: 41

Even after changed the array into 5 int variables,
not getting the required result.
All were zeros:
Warning: No BenFormConfig found in module under name name
INFO: Initialize action of type: com.HelloWorldA
Orton K Randy
Ranch Hand

Joined: Aug 12, 2011
Posts: 41

Is your form-bean declaration still commented in struts-config?

manikandan jayakumar
Ranch Hand

Joined: Aug 20, 2011
Posts: 41

Hi Randy,
Now 'm using

'm just getting zeros!!!
manikandan jayakumar
Ranch Hand

Joined: Aug 20, 2011
Posts: 41

Would it be the cause for my error
'm using helloForm as ActionForm it is in (../classes/com/test/)
used as a package

package test;

so that i can import the package in my Action class which is in (...classes/com/)

but i declared this as

package com;
Orton K Randy
Ranch Hand

Joined: Aug 12, 2011
Posts: 41

Watch out for the case of the method names especially the getters in your form. They're NOT in camelCase! And your ActionForm pacjage declaration should have been:

Also post the entire error stacktrace if you get an error again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Action not found
 
Similar Threads
Cannot find ActionMappings or ActionFormBeans collect
java.lang.NullPointerException in a simple servlet
servlet action is not available
Configuring First Struts Application
error while creating struts application