当前位置: 代码迷 >> Java Web开发 >> HTTP Status 404 - Servlet action is not available错误提示!
  详细解决方案

HTTP Status 404 - Servlet action is not available错误提示!

热度:444   发布时间:2010-10-08 13:40:51.0
HTTP Status 404 - Servlet action is not available错误提示!
         今天遇到了这个错误提示的问题,下面将部分代码贴出来,请高手们指点,感激不尽!
1.struts-config.xml的配置文件。
<struts-config>
    <data-sources />
    <form-beans>
        <form-bean name="loginForm"
            type="com.sailing.struts.form.LoginForm" />

    </form-beans>

    <global-exceptions />
    <global-forwards />
    <action-mappings>
        <action
      attribute="loginForm"
      input="/login.jsp"
      name="loginForm"
      path="/login"
      scope="request"
      type="org.springframework.web.struts.DelegatingActionProxy">
      <forward name="error" path="/error.jsp" />
      <forward name="success" path="/index.jsp" />
    </action>

    </action-mappings>

    <message-resources
        parameter="com.sailing.struts.ApplicationResources" />
    <plug-in
        className="org.springframework.web.struts.ContextLoaderPlugIn">
        <set-property property="contextConfigLocation"
            value="/WEB-INF/classes/applicationContext.xml" />
    </plug-in>
</struts-config>


2.applicationContext.xm文件
    <bean id="dataSource"
        class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName"
            value="com.microsoft.sqlserver.jdbc.SQLServerDriver">
        </property>
        <property name="url"
            value="jdbc:sqlserver://127.0.0.1:1433;databaseName=School">
        </property>
        <property name="username" value="sa"></property>
        <property name="password" value="123456"></property>
    </bean>
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource">
            <ref bean="dataSource"></ref>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">
                    org.hibernate.dialect.SQLServerDialect
                </prop>
            </props>
        </property>
        <property name="mappingResources">
            <list>
                <value>com/sailing/entity/Student.hbm.xml</value>
            </list>
        </property>
    </bean>
    <bean id="template"
        class="org.springframework.orm.hibernate3.HibernateTemplate">
        <property name="sessionFactory" value="sessionFactory"></property>
    </bean>

    <bean id="studentDao" class="com.sailing.dao.StudentDao">
        <property name="template" value="template"></property>
    </bean>

    <bean id="studentService"
        class="com.sailing.service.StudentService">
        <property name="studentDao" value="studentDao"></property>
    </bean>

    <bean name="/login" class="com.sailing.struts.action.LoginAction">
        <property name="studentService" value="studentService"></property>
    </bean>
</beans>

3.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>3</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>3</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
  </welcome-file-list>
</web-app>

4.login.jsp页面代码
<html>
    <head>
        <title>JSP for LoginForm form</title>
    </head>
    <body>
        <html:form action="/login.do">
            userName : <html:text property="userName" />
            <html:errors property="userName" />
            <br />
            password : <html:text property="password" />
            <html:errors property="password" />
            <br />
            <html:submit />
            <html:cancel />
        </html:form>
    </body>
</html>





检查了配置文件应该没有错误,这里将全部贴出来了,网上找了很多类似的问题,但都没能解决问题,恳请各位指点指点。

搜索更多相关主题的帖子: Status  action  HTTP  Servlet  available  

----------------解决方案--------------------------------------------------------
没有人回答嘛?还是觉得代码太长,就没往下看,我查看了网上许多人都遇到类似的问题,求其解决方法啊,谢谢!
----------------解决方案--------------------------------------------------------
好了问题解决了,是包的问题,重新导包就解决问题了
----------------解决方案--------------------------------------------------------
弄好了就行
----------------解决方案--------------------------------------------------------
  相关解决方案