我实现了一个很简单的struts程序,但是屡屡出现问题,解决了一个又一个,都快神经了!各位大虾给帮忙看看!
这里是我的提示错误!
type Status reportmessage Servlet action is not availabledescription The requested resource (Servlet action is not available) is not available.
我的文件如下:
------------struts-config文件----------------
<?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>
<!-- ========== 数据源定义 =============================== -->
<data-sources />
<!-- ========== Form Bean定义 ================================== -->
<form-beans>
<form-bean name="loginForm" type="org.apache.my.form.LoginForm">
</form-bean>
</form-beans>
<!-- ========== 全局异常 ============================== -->
<global-exceptions />
<!-- ========== 全局Forward=============================== -->
<global-forwards />
<!-- ========== Action Mapping(操作映射) =============================== -->
<action-mappings>
<action path="/login" type="org.apache.my.action.LoginAction"
name="loginForm" scope="request" input="/login.jsp">
<forward name="success" path="/main.jsp" />
<forward name="failed" path="/error.jsp" />
</action>
</action-mappings>
<!-- ========== Controller Configuration ================================ -->
<controller />
<!-- ========== Message Resources Definitions ============================ -->
<message-resources parameter="org.apache.my.ApplicationResources"/> <!-- ========== Plug Ins Configuration ================================= -->
<plug-in className=""/>
</struts-config>============web.xml文件============
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4"> <display-name>LoginExample</display-name> <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>0</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>true</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> <taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib> <taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib> <taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib> <taglib>
<taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib> <taglib>
<taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib></web-app>
-----------login.jsp文件<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html>
<head>
<title> Struts 主页</title>
</head>
<body>
<h3>正确的登录用户名和密码是:hh</h3>
<P>
<html:form action="/login.do" focus="username">
<table>
<tr>
<td>用户名:</td>
<td><html:text property="username"/></td>
</tr>
<tr>
<td>密码:</td>
<td><html:password property="password" redisplay="false"/></td>
</tr>
<tr>
<td colspan=2 align=right>
<html:submit value="确定 "/>
</td>
</tr>
</table>
</html:form>
</P>
</body>
</html:html>
------------main.jsp---------
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html locale="true">
<head>
<title>成功了</title>
<html:base/>
</head>
<body>
<P>注册成功!</P>
<P><BR>
<BR>
<A href="login.jsp">再试一次</A>?
</P>
</body>
</html:html>
------------error.jsp-----------------
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html locale="true">
<head>
<title>出错了</title>
<html:base/>
</head>
<body>
<P>登陆失败!请检查用户名和密码是否正确!</P>
<P><BR>
<BR>
<A href="login.jsp">再试一次</A>?
</P>
</body>
</html:html>
这里是我的提示错误!
type Status reportmessage Servlet action is not availabledescription The requested resource (Servlet action is not available) is not available.
我的文件如下:
------------struts-config文件----------------
<?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>
<!-- ========== 数据源定义 =============================== -->
<data-sources />
<!-- ========== Form Bean定义 ================================== -->
<form-beans>
<form-bean name="loginForm" type="org.apache.my.form.LoginForm">
</form-bean>
</form-beans>
<!-- ========== 全局异常 ============================== -->
<global-exceptions />
<!-- ========== 全局Forward=============================== -->
<global-forwards />
<!-- ========== Action Mapping(操作映射) =============================== -->
<action-mappings>
<action path="/login" type="org.apache.my.action.LoginAction"
name="loginForm" scope="request" input="/login.jsp">
<forward name="success" path="/main.jsp" />
<forward name="failed" path="/error.jsp" />
</action>
</action-mappings>
<!-- ========== Controller Configuration ================================ -->
<controller />
<!-- ========== Message Resources Definitions ============================ -->
<message-resources parameter="org.apache.my.ApplicationResources"/> <!-- ========== Plug Ins Configuration ================================= -->
<plug-in className=""/>
</struts-config>============web.xml文件============
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4"> <display-name>LoginExample</display-name> <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>0</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>true</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> <taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib> <taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib> <taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib> <taglib>
<taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
</taglib> <taglib>
<taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib></web-app>
-----------login.jsp文件<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html>
<head>
<title> Struts 主页</title>
</head>
<body>
<h3>正确的登录用户名和密码是:hh</h3>
<P>
<html:form action="/login.do" focus="username">
<table>
<tr>
<td>用户名:</td>
<td><html:text property="username"/></td>
</tr>
<tr>
<td>密码:</td>
<td><html:password property="password" redisplay="false"/></td>
</tr>
<tr>
<td colspan=2 align=right>
<html:submit value="确定 "/>
</td>
</tr>
</table>
</html:form>
</P>
</body>
</html:html>
------------main.jsp---------
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html:html locale="true">
<head>
<title>成功了</title>
<html:base/>
</head>
<body>
<P>注册成功!</P>
<P><BR>
<BR>
<A href="login.jsp">再试一次</A>?
</P>
</body>
</html:html>
------------error.jsp-----------------
<%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html locale="true">
<head>
<title>出错了</title>
<html:base/>
</head>
<body>
<P>登陆失败!请检查用户名和密码是否正确!</P>
<P><BR>
<BR>
<A href="login.jsp">再试一次</A>?
</P>
</body>
</html:html>
解决方案 »
- Hibanate 调用存储过程,数据表被锁死
- 搜索
- 求教:一个录库程序的断点问题(解决后100分)
- 求知贴,请老鸟无私帮助(关于框架,RSS及其它)
- PreparedStatement对象方法的奇怪问题
- 如何使eclipse的有代码提示的功能啊?
- 谢谢~~希望得到指点。web服务器与应用服务器的问题
- Tomcat406,通过servlet获取数据库中的Blob,返回给客户端出错!!!
- 关于shtml文件里包含的问题(........加急)
- 征:Weblogic6.0 + mssql7.o + jive; JRun3.1 + mssql7.0 + jive; Tomcat4.0 + mssql7.0 + jive任一种设置方案。
- 推荐:大量jsp开发资料
- jsp 中 如何从数据库读图片数据,生成图片列表
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">应该是这里出现问题了吧,应该这样写
<?xml version="1.0" encoding="UTF-8"?>
<!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>