Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Struts 2 jsp error java.lang.NullPointerException property tag

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()?
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic