Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 24th, 2007, 11:09 PM
Authorized User
 
Join Date: Oct 2007
Location: Lucknow, UP, India.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default HTTP status 404-Servlet action is not available

Hi There

I am using JBoss 4.0.2 GA, Netbeans 5.5.1 and Oracle 10g Express Edition as DBMS. I am using struts 1.2(bundled with Netbeans). I have Stucked around a problem as stated above.

Here are the Details:

Well Here are my sections of struts-config.xml

<form-beans>
        <form-bean name="logon" type="org.apache.struts.action.DynaActionForm">
          <form-property name="username" type="java.lang.String"/>
          <form-property name="password" type="java.lang.String"/>
        </form-bean>
    </form-beans>

<action-mappings>
        <action name="logon" path="/logon"
            type="com.SMS.view.logon" scope="request" >
              <forward name="success.admin" path="/pages/admin.jsp"/>
              <forward name="success.hod" path="/pages/hod.jsp"/>
              <forward name="success.hr" path="/pages/hr.jsp"/>
              <forward name="sucess.admission" path="/pages/admission/jsp"/>
              <forward name="Fails" path="/pages/welcome.jsp"/>
    </action>
    </action-mappings>


web.xml
<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>1</load-on-startup>
        </servlet>
    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>

Now My action servlet that extends action -- logon.java in package com.SMS.view
public class logon extends Action {

    public ActionForward execute(ActionMapping mapping, ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response) throws IOException,
                                                                      ServletException {

              String uid=(String)((DynaActionForm)form).get("username") ;
        String pass=(String)((DynaActionForm)form).get("password" );
        CheckUser chk=new CheckUser();
        LoginType lgs=chk.getValidUser(uid, pass);

           if(lgs.isIsValid()&& lgs.getType().equals("admin"))
                  return mapping.findForward("success.admin");
        else if (lgs.isIsValid()&& lgs.getType().equals("hod"))
            return mapping.findForward("success.hod");
        else if (lgs.isIsValid()&& lgs.getType().equals("hr"))
            return mapping.findForward("success.hr");
        else if (lgs.isIsValid()&& lgs.getType().equals("admission"))
            return mapping.findForward("success.admission");
        else
        {
             HttpSession ss=request.getSession();
             ss.setAttribute("loginErrorMsg","Please check username or Password");
             return mapping.findForward("Fails");
        }
    }
}

Finally my JSP page.
<html:form action="/logon.do">
            <table cellspacing="2" cellpadding="3" border="2" width="50%"
                   height="48">
                <tr>
                    <th width="26%">
                        Username
                    </th>
                    <td width="74%">
                        <html:text property="username"/>
                    </td>
                </tr>
                <tr>
                    <th width="26%">
                        Password
                    </th>
                    <td width="74%">
                        <html:password property="password"/>
                    </td>
                </tr>
                <tr>
                    <th width="26%">

                    </th>
                    <td width="74%">
                        <html:submit/>
                    </td>
                </tr>
                <tr>
                    <th width="26%" colspan="2">
         <%
            String loginerrormsg = null;
            loginerrormsg = (String) session.getAttribute("loginErrorMsg");
            if (loginerrormsg != null) {
        %>
        <H4>
            <%= loginerrormsg %>
        </H4><p>
        <%
            }
        %>
                    </th>
                </tr>
            </table>
        </html:form>

On running the project and logging in I am facing error of
HTTP status 404- Servlet action is not available

Please tell me how to figure this out?

Regards,
Ankur-programmer.net



Similar Threads
Thread Thread Starter Forum Replies Last Post
HTTP Status 404 rivcam JSP Basics 7 June 3rd, 2008 09:32 PM
Ch28 - HTTP Status 503 - Servlet action is current mona3000m BOOK: Beginning JavaServer Pages 0 December 3rd, 2006 04:19 AM
Status 404 for 404 page marun BOOK: Professional Apache Tomcat 0 August 30th, 2005 06:45 AM
HTTP Status 405 - HTTP method GET .... nsakic Servlets 1 January 25th, 2004 04:50 PM
HTTP status 404 brianjs JSP Basics 2 October 26th, 2003 03:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.