Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
2.0.1
-
None
-
None
-
Windows XP
Jetty 6.0.1
Caucho Resin 3.0.22
Description
Hi, all.
I try to develop simple forms application with this code:
index.jsp
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My page</title>
</head>
<body>
<s:form action="sendSMS" method="post">
<s:textfield name="smsFrom">Message From:</s:textfield>
<s:textfield name="smsTo">Message To:</s:textfield>
<s:textarea name="smsMessageBody" cols="20" rows="10">Message:</s:textarea>
<s:submit type="submit" value="Submit" />
</s:form>
</body>
</html>
web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Struts 2 TestApp</display-name>
<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>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
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>
<package name="default">
<default-interceptor-ref name="defaultStack" />
<action name="sendSMS" class="com.alec_c4.testApp.SendSMS">
<result name="success" type="dispatcher">
/success.jsp
</result>
<result name="error" type="dispatcher">/fail.jsp</result>
<interceptor-ref name="servlet-config" />
</action>
</package>
</struts>
/**
*/
package com.alec_c4.testApp;
import java.util.Map;
import org.apache.struts2.interceptor.ParameterAware;
import com.opensymphony.xwork2.ActionSupport;
/**
- @author Alec C4
*
*/
public class SendSMS extends ActionSupport implements ParameterAware {
private static final long serialVersionUID = 2775840359087216729L;
String[] smsFrom;
String[] smsTo;
String[] smsMessageBody;
public Map parameters;
public Map getParameters()
{ return parameters; }public void setParameters(Map parameters)
{ this.parameters = parameters; }
public String execute () throws Exception
{ // Some Business Logic smsFrom = (String[]) parameters.get("smsFrom"); smsTo = (String[]) parameters.get("smsTo"); smsMessageBody = (String[]) parameters.get("smsMessageBody"); if (smsFrom == null || smsFrom[0] == null || smsFrom[0].length() == 0) return ERROR; else return SUCCESS; }}
and when i have compiled application i put this one in webapp root and start the server. As a result i see this exception:
2006-12-14 18:35:11.713::WARN: /testApp/index.jsp
java.lang.NullPointerException
at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:703)
at org.apache.struts2.components.UIBean.end(UIBean.java:450)
at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTa
gSupport.java:36)
at org.apache.jsp.index_jsp._jspx_meth_s_textfield_0(org.apache.jsp.inde
x_jsp:200)
at org.apache.jsp.index_jsp._jspx_meth_s_form_0(org.apache.jsp.index_jsp
:143)
at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:93)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:358)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:4
40)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:335)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:445
)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:3
56)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:2
26)
Could you tell me please - what the problem is ? This problem is actual for Jetty and Resin.