【发布时间】:2016-07-16 08:38:04
【问题描述】:
我想在打开BeforeLogin 页面时使用JavaScript 函数将我的JSP 重定向到另一个页面。但我收到以下错误消息。
找不到 Struts 调度程序。这通常是由于使用没有关联过滤器的 Struts 标签引起的。 Struts 标签仅在请求通过其 servlet 过滤器时可用,该过滤器会初始化此标签所需的 Struts 调度程序。
我不知道该怎么办。
BeforeLogin.jsp:
function newpage(){
window.open("Login.jsp");
}
<body onLoad="goNewWin()">
<a href="BeforeLogin.jsp">click here to login</a>
</body>
Login.jsp:
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>
<s:text name="Login"/>
</title>
</head>
<body> ..... </body>
web.xml:
<filter>
<filter-name>DispatcherFilter</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>DispatcherFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
struts.xml:
<package name="struts2" namespace="/" extends="struts-default">
<action name="login" class="com.action.LogonAction">
<result name="input">Login.jsp</result>
</action>
【问题讨论】:
标签: java jsp configuration struts2 web.xml