File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet action is not available

 
tirapa reddy
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
tirapa reddy
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am new to struts application .action class job is to the view the jsp.

why it is showing error
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic