Struts2小白,报404了求教
本人刚开始学Struts2框架,看着书上敲了第一个工程,但404了,弄了半天没解决,求大神指教!感激不尽!这是我的login.jsp和web.xml的代码:
以下为web.xml:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<s:form action="login" method="post" namespace="/">
<s:textfield name="username" label="用户名" cssStyle="width:160px;height:26px;"/>
<s:password name="password" label="密码" cssStyle="width:160px;height:26px;"/>
<s:submit value="登 陆"/>
</s:form>
</body>
</html>
以下为web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>ch1</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>struts.i18n.encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
</web-app>
...全文
相关推荐
struts2 跳转至404 页面的解决方案
针对"Struts2 跳转至404 页面的解决方案"这个主题,我们将深入探讨可能的原因和解决方法。
struts2完全捕获404错误的方法
Struts2是一个非常流行的Java Web框架,用于构建和维护可扩展且易于管理的企业级应用程序。在Struts2中,处理HTTP错误状态码,如404 Not Found,是开发过程中的常见需求。
Java struts2捕获404错误的方法汇总
在Java Struts2框架中,捕获404错误是为了提供更好的用户体验,避免用户看到标准的HTTP 404 Not Found错误页面。
struts2.1.6 jar&出现404错误的原因,自己刚整理一些的东西
首先,Struts2.1.6版本中的404错误通常与Action配置有关。
有关struts2的乱码配置以及jsp页面的forward404问题的解决(png图)
初学struts2,个人初次遇到的一些有关struts2的乱码配置以及jsp页面的forward404问题的解决(配置 png图片)


Web 开发
