aspose file tools*
The moose likes Struts and the fly likes Struts 2 jsp error java.lang.NullPointerException property tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 jsp error java.lang.NullPointerException property tag" Watch "Struts 2 jsp error java.lang.NullPointerException property tag" New topic
Author

Struts 2 jsp error java.lang.NullPointerException property tag

Ann Stahl
Greenhorn

Joined: Dec 04, 2012
Posts: 1
I am trying to configure Struts 2.2.3 to run in parallel to struts 1.2. Action returns result success. Jsp has 500 Internal Server Error OracleJSP: JSP Error: Request URI:/aaa/xxx/bic/tutorial/HelloWorld.jsp

Exception:

java.lang.NullPointerException

Added jars for migration:
xwork-core-2.2.3.jar
struts2-core-2.2.3.jar
ognl-3.0.1.jar
javassist-3.11.0.GA.jar
freemarker-2.3.16.jar
commons-logging-1.1.1.jar
commons-lang3-3.1.jar
commons-io-2.0.1.jar
commons-fileupload-1.2.2.jar

web.xml:
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>

<filter>
<filter-name>jsp_response</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>

struts.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts SYSTEM "struts-2.1.7.dtd">
<struts><!-- Configuration for the default package. -->
<constant name="struts.devMode" value="true" />

<package name="helloworld" extends="struts-default" namespace="/">

<action name="HelloWorld" class="com.xxx.web.wms.tutorial.HelloWorld">
<result name="success">/xxx/bic/tutorial/HelloWorld.jsp</result>
<result name="sayHello">/xxx/bic/tutorial/HelloWorld.jsp</result>
</action>

</package>
</struts>

Action:
package com.xxx.web.wms.tutorial;

import com.opensymphony.xwork2.ActionSupport;

public class HelloWorld extends ActionSupport {

private String message;

public String execute() {
this.setMessage("You Are Finally Here!");
System.out.println("Inside HelloWorld Action");
return SUCCESS;
}

public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}

}

HelloWorld.jsp:
<%@ taglib prefix="s" uri="/struts-tags" %>

<html>
<head>
<title>Hello World!</title>
</head>

<body>
<h2><s:property value="message" /></h2>
</body>

</html>

url: http://localhost:8888/xxx/HelloWorld.action

system console displays message "Inside HelloWorld Action"

Can anyone please help me figure out why <s:property value="message" /> can't get a value from HelloWorld.getMessage()?
 
 
subject: Struts 2 jsp error java.lang.NullPointerException property tag