Hello,
I am new to Stripes and am trying to write a simple test application which uses
indexed properties. I believe that I am following the examples yet when I
submit my form with a value entered into the text field I get an exception from
Stripes as it tries to instantiate the list. Below is the exception error
message and my test code. From what I have been reading, Stripes should be
handling the list and it objects automatically for me. So I must be missing
something obvious and fundamental. Maybe I have been looking at this too long.
If someone could help me get on track I would be very grateful.
Thanks,
-Tom
Exception Message:
15:05:29,421 DEBUG DefaultActionBeanPropertyBinder:108 - Could not bind
property with name [testBeanList[0].name] to bean of type: TestActionBean
net.sourceforge.stripes.util.bean.EvaluationException: Encountered an exception
while trying to create a default instance for property '0' in expression
'testBeanList[0].name'.
at
net.sourceforge.stripes.util.bean.PropertyExpressionEvaluation.getDefaultValue(PropertyExpressionEvaluation.java:578)
at
net.sourceforge.stripes.util.bean.PropertyExpressionEvaluation.setValue(PropertyExpressionEvaluation.java:542)
at
net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder.bindNonNullValue(DefaultActionBeanPropertyBinder.java:506)
at
net.sourceforge.stripes.controller.DefaultActionBeanPropertyBinder.bind(DefaultActionBeanPropertyBinder.java:298)
at
net.sourceforge.stripes.controller.DispatcherHelper$3.intercept(DispatcherHelper.java:185)
at
net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:157)
at
net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:107)
at
net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:154)
at
net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:73)
at
net.sourceforge.stripes.controller.DispatcherHelper.doBindingAndValidation(DispatcherHelper.java:182)
at
net.sourceforge.stripes.controller.DispatcherServlet.doBindingAndValidation(DispatcherServlet.java:217)
at
net.sourceforge.stripes.controller.DispatcherServlet.doPost(DispatcherServlet.java:142)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:180)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalAccessException: Class
net.sourceforge.stripes.util.bean.PropertyExpressionEvaluation can not access a
member of class TestBean with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
at java.lang.Class.newInstance0(Class.java:349)
at java.lang.Class.newInstance(Class.java:308)
at
net.sourceforge.stripes.util.bean.PropertyExpressionEvaluation.getDefaultValue(PropertyExpressionEvaluation.java:574)
... 28 more
JSP Code:
<!-- test.jsp/photoidrequest.jsp 20080508/20080510 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="stripes" uri="http://stripes.sourceforge.net/stripes.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>Test</title>
</head>
<body style="width: 650px;">
<p
style: font-size: 16pt; font-style: bold; color: black;"
>
Test
</p>
<stripes:form
action="/Test.action"
focus=""
>
<table>
<tr>
<th>
Name
</th>
</tr>
<tr>
<td>
<stripes:text
name="testBeanList[0].name"
maxlength="20"
/>
</td>
</tr>
<tr>
<td>
<stripes:text
name="testBeanList[1].name"
maxlength="20"
/>
</td>
</tr>
</table>
<stripes:submit name="submitRequest" value="Submit"/>
</stripes:form>
<br />
</body>
</html>
Java Code:
// TestBean.java 20080508/20080509
public class TestBean
{
String name;
//-----------------------------------------------------------------------------------------------
TestBean()
{
};
//-----------------------------------------------------------------------------------------------
TestBean(
String name
)
{
this.name = name;
};
//-----------------------------------------------------------------------------------------------
public void setName(String name)
{
this.name = name;
}// setName()
public String getName()
{
return (this.name);
}// getName()
//-----------------------------------------------------------------------------------------------
}// class TestBean
// TestActionBean.java 20080508/20080510
import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.ForwardResolution;
import net.sourceforge.stripes.action.ActionBean;
import net.sourceforge.stripes.action.ActionBeanContext;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
public class TestActionBean
implements ActionBean
{
private ActionBeanContext context = null;
private List<TestBean> testBeanList = new ArrayList<TestBean>();
protected Logger log = Logger.getLogger(this.getClass());
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
public TestActionBean()
{
}// TestActionBean()
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
public ActionBeanContext getContext()
{
return context;
}// getContext()
public void setContext(ActionBeanContext context)
{
this.context = context;
}// setContext()
//----------------------------------------------------------------------------------------------
public void setTestBeanList(List<TestBean> testBeanList)
{
this.testBeanList = testBeanList;
}// setTestBeanList)
public List<TestBean> getTestBeanList()
{
return (this.testBeanList);
}// getTestBeanList()
//----------------------------------------------------------------------------------------------
// @HandlesEvent("submitRequest")
@DefaultHandler
public Resolution submitRequest()
{
log.debug("testing...");
return new ForwardResolution("/test.jsp");
}// addition()
}// CalculatorActionBean
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users