<body> This is my JSP page. aaaasdsadsggsd12222222ds31111<br> <a href="admin/show!login">登录</a> <s:property value="safsaf"/> </body> </html>struts.xml<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"><struts> <!-- 整合Spring --> <constant name="struts.objectFactory" value="spring" /> <constant name="struts.devMode" value="true" /> <package name="admin" namespace="/admin" extends="struts-default"> <action name="show" class="com.joyintech.actions.ShowAction"> <result name="go">/WEB-INF/pages/stock.jsp</result> </action> </package> </struts>web.xml <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </filter-class> <init-param> <param-name>actionPackages</param-name> <param-value>com.joyin.actions</param-value> </init-param> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> 这个列子在tomcat上运行问题。在webshpere上有报错。index.jsp上有到struts2的标签报错 抛出的异常: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]把那个标签删除则正常,但提交请求时,报错说找不到action。
麻烦你贴出你相关的代码
还有上下文背景你问的东西跟你写的代码有关
你知道代码
你可以问
可是我们不知道你的代码!!!你的那个标签是否在使用的页面进行引用了????
你修改struts.xml的之后是否重启服务器????
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
This is my JSP page. aaaasdsadsggsd12222222ds31111<br>
<a href="admin/show!login">登录</a>
<s:property value="safsaf"/>
</body>
</html>struts.xml<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd"><struts> <!-- 整合Spring --> <constant name="struts.objectFactory" value="spring" /> <constant name="struts.devMode" value="true" /> <package name="admin" namespace="/admin" extends="struts-default">
<action name="show" class="com.joyintech.actions.ShowAction">
<result name="go">/WEB-INF/pages/stock.jsp</result>
</action>
</package> </struts>web.xml <filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
<init-param>
<param-name>actionPackages</param-name>
<param-value>com.joyin.actions</param-value>
</init-param>
</filter> <filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
这个列子在tomcat上运行问题。在webshpere上有报错。index.jsp上有到struts2的标签报错
抛出的异常: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]把那个标签删除则正常,但提交请求时,报错说找不到action。
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext*.xml</param-value>
</context-param>
<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>
就是在jsp页面上用struts2标签时,还是用不了