Hi All
I have gone thru few examples of
struts application but once i start making my own application it cannot find the action. the exact error is :-
The requested resource (/welcome.do) is not available.
Im pasting below the files struts-config.xml and web.xml and my
jsp files
any help is appreciated , i just cant figure out why it cant find the action requested it works fine in examples if i try to overide those examples .
below are the files -
struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
</form-beans>
<global-forwards >
</global-forwards>
<action-mappings>
<action path="/welcome"
type="myappcls.FrmBeanAction">
<forward name="success"
path="welcome.jsp"/>
</action>
</action-mappings>
</struts-config>
web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Avneet</display-name>
<description>
Struts implimentation
</description>
<
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>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<taglib>
<taglib-uri>/tags/taglib/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/taglib/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/taglib/struts-html</taglib-uri>
<taglib-location>/WEB-INF/taglib/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/taglib/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/taglib/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/taglib/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/taglib/struts-nested.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/taglib/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/taglib/struts-tiles.tld</taglib-location>
</taglib>
</web-app>
jsp files are below -
index.jsp
<%@ page language="java" %>
<%
System.out.println("inside index.jsp");
%>
<HTML>
<HEAD><TITLE>New Account Registration</TITLE></HEAD>
<BODY BGCOLOR="#FDF5E6">
<CENTER>
<H1>New Account Registration</H1>
<FORM ACTION="/welcome.do" METHOD="POST">
Email address: <INPUT TYPE="TEXT" NAME="email"><BR>
Password: <INPUT TYPE="PASSWORD" NAME="password"><BR>
<INPUT TYPE="SUBMIT" VALUE="Sign Me Up!">
</FORM>
</CENTER>
</BODY></HTML>
welcome.jsp ->
<%@page language="java" %>
<HTML>
<HEAD><TITLE>Success</TITLE></HEAD>
<BODY BGCOLOR="#FDF5E6">
<CENTER>
<H1>You have registered successfully.</H1>
(Version 1)
</CENTER>
</BODY></HTML>
Action class ->
package myappcls ;
import java.io.* ;
import javax.servlet.* ;
import javax.servlet.http.* ;
import org.apache.struts.action.* ;
public class FrmBeanAction extends Action{
public ActionForward execute(ActionMapping mapping , ActionForm action , HttpServletRequest request , HttpServletResponse response) throws Exception{
System.out.println("Inside control Servlet -> FrmBeanAction");
return mapping.findForward("success");
}
}
action bean ->
package myappcls ;
import org.apache.struts.action.*;
public class FrmBean extends ActionForm{
private
String name = "" ;
public void setName(String name){
this.name = name ;
}
public String getName(){
return this.name ;
}
}
now when i open index and do submit it cannot go to my action servlet and gives the message listed above .
need help
Thanks to all in advance