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 is not available Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "servlet action is not available" Watch "servlet action is not available" New topic
Author

servlet action is not available

tirapa reddy
Greenhorn

Joined: May 05, 2007
Posts: 19
hi
i am new to struts for my first application i got an error "servlet action not available" how resolve this.i sending xml file please suggest me to solve this

<web-app>
<display-name>Struts Blank Application</display-name>

<!-- Standard Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>


<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>


<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>

</web-app>


struts-config file::


<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config SYSTEM "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">

<struts-config>

<!-- ========== Form Bean Definitions ============================== -->

<form-beans>

<form-bean name="testForm" type="test.ssl.TestForm" />

</form-beans>

<!-- ========== Global Forward Definitions ============================== -->
<global-forwards>
</global-forwards>


<!-- ========== Action Mapping Definitions ============================== -->

<action-mappings>
<action path="/te" type="org.students.TEAction">
<forward name="disperror" path="/de.jsp" />
</action>
<action path="/test" type="org.students.TestAction" />

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


action class::


package org.students;
import javax.servlet.http.*;
import org.apache.struts.action.*;

public class TestAction extends Action
{
TestAction()
{
System.out.println("object created");
}
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletRequest response)throws Exception
{
System.out.println("execute method");

return mapping.findForward("disperror");
}
}

[ July 03, 2008: Message edited by: tirapa reddy ]
[ July 03, 2008: Message edited by: tirapa reddy ]
Siddharth Naik
Ranch Hand

Joined: Apr 09, 2006
Posts: 35
How are you calling action from your JSP page?

Also would you please edit your post and use UBB Code to post your code? That way it will be easier for us to read.


Thanks<br />Sid
tirapa reddy
Greenhorn

Joined: May 05, 2007
Posts: 19
i am new to struts application .action class job is to the view the jsp.

why it is showing error
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This message indicates that your Struts action servlet did not initialize properly. Look at the System Out log for the time period when the server first started up or when you deployed the application. You should then see one or more error messages with stack traces that will tell you the reason why it couldn't initialize. The most common reason for this is that there may be XML errors in your struts-config.xml file making it so it can't be parsed. If so, you should see a message indicating specifically what is wrong with the file.
[ July 03, 2008: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet action is not available