为什么使用不到struts2标签?
<%@pagelanguage="java"import="java.util.*"pageEncoding="GBK"%><%@taglibprefix="s"uri=...
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
This is my JSP page. <br>
<s:if test="1==2">
aaaa
<s:else>bbb</s:else>
</s:if>
</body>
</html>
=======================================
HTTP Status 500 -
--------------------------------------------------------------------------------
org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 11
9: <body>
10: This is my JSP page. <br>
11: <s:if test="1==2">
。。。
root cause
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location] 展开
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
This is my JSP page. <br>
<s:if test="1==2">
aaaa
<s:else>bbb</s:else>
</s:if>
</body>
</html>
=======================================
HTTP Status 500 -
--------------------------------------------------------------------------------
org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 11
9: <body>
10: This is my JSP page. <br>
11: <s:if test="1==2">
。。。
root cause
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location] 展开
3个回答
展开全部
1.检查web.xml是否配置了
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
2.检查你是否导入了struts2相关的包
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
2.检查你是否导入了struts2相关的包
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询