2016-09-29 41 views
-1

我得到下面的錯誤,當我嘗試在我的Struts2的應用錯誤與Struts2的應用

異常顯示java.lang.NullPointerException org.apache.struts2.impl.StrutsActionProxy的index.jsp的執行測試行動。 (錯誤消息) .impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39) com.opensymphony.xwork2.DefaultActionProxyFactory.createAct ionProxy(DefaultActionProxyFactory.java:58) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:500) org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher

下面是我的struts.xml和web.xml文件。你能告訴我,如果事情是錯與他們

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> 
    <constant name="struts.devMode" value="true" /> 
    <package name="tester" extends="struts-default"> 
     <action name="tester" class="com.siebel.WebService.Tester" method="execute"> 
     <result name="success">/success.jsp</result> 
     </action> 
    </package> 
    </struts> 

的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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 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>Framework Application</display-name> 
    <welcome-file-list> 
     <welcome-file>index.jsp</welcome-file> 
    </welcome-file-list> 
    <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> 
    </web-app> 

的index.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> 
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
    <%@ page import="java.sql.Connection"%> 
    <%@ page import="java.sql.DriverManager"%> 
    <%@ page import="java.sql.ResultSet"%> 
    <%@ page import="java.sql.Statement"%> 


    <%@ taglib prefix="s" uri="/struts-tags"%> 
<html> 
    <head> 

    </head> 
    <body> 
    <form action = "tester"> 
    <h1>Test Page</h1> 
    Enter the parameter value:<input id="formParameter" type="text"    title="attribute"/> 
    <button>Call WebService</button> 
    </form> 



    </body> 
    </html> 
+2

哪個S2版本? 'FilterDispatcher'從Struts 2.1.3開始被棄用。 –

+0

是S2版本。我應該用什麼來代替FilterDispatcher? –

+1

https://struts.apache.org/docs/webxml.html。 –

回答

0

做以下修改和嘗試:

<form action = "tester"> 
<h1>Test Page</h1> 
Enter the parameter value:<input id="formParameter" type="text"    title="attribute"/> 
<input type=submit value="Call WebService"/> 
</form>