<!-- struts2的框架的核心过滤器的配置 -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
```<%@ 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=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1>保存商品的页面</h1>
<s:form action="" method="post" namespace="/" theme="simple" >
<table border="1" width="400">
<tr>
<td>商品名称</td>
<td><s:textfield name="pname"/></td>
</tr>
<tr>
<td>商品价格</td>
<td><s:textfield name="price"/></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="添加"/></td>
</tr>
</table>
</s:form>
```HTTP Status 500 – Internal Server Error
Type Exception Report
Message An exception occurred processing JSP page /addProduct.jsp at line 12
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /addProduct.jsp at line 12
9:
10:
Servlet.service() for servlet [jsp] in context with path [/ssh] threw exception [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]] with root cause
商品名称 |
你这是Struts的jar包没有?
struts的过滤器的配置和标签的使用没有必然联系,过滤器配置没有问题,静态导入也没有问题,
<%@ taglib prefix="s" uri="/struts-tags"%>这个是复制的吗?你可以手动使用快捷键输入看有没有提示,如果没有那就是你jar包没有导进去。