----- Original Message ----- From: "hemant" <[EMAIL PROTECTED]> To: "struts" <[EMAIL PROTECTED]> Sent: Tuesday, July 30, 2002 10:13 AM Subject: Checkboxes and Intermittent BeanUtils.populate Error
Comrades, I check a checkbox and submit, I get the error. If I do not use the checkbox and hit submit, the page comes up successfully. Any issues with primitives in relation to the FormBean member population? The strange thing is that this problem does not occur all the time. The page prior to this JSP has a form with checkboxes and that works fine with checkboxes checked. That is creepy and worries me. I looked at the source code and here is a snippet from BeanUtils.setProperty(Object, String) //------------------------ else { // Value into scalar if (value instanceof String || (value == null && type.isPrimitive())) { newValue = ConvertUtils.convert((String) value, type); } else if (value instanceof String[]) { newValue = ConvertUtils.convert(((String[]) value)[0], type); } else { newValue = value; } } //------------------------ I wonder if this part is messing things up for primitive types. I checked the checkBox Value and it got the String as "on". Now the code that takes this "on" and sets the ValueObject boolean variable to true seems to be causing the problem. My getters for boolean are getFoo() and setFoo() where foo is a boolean. Should it be setFoo() and isFoo()?? Please Advise hemant javax.servlet.ServletException: BeanUtils.populate java.lang.Throwable(java.lang.String) java.lang.Exception(java.lang.String) javax.servlet.ServletException(java.lang.String, java.lang.Throwable) void org.apache.struts.util.RequestUtils.populate(java.lang.Object, java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest) void org.apache.struts.action.RequestProcessor.processPopulate(javax.servlet.http .HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.struts.action.ActionForm, org.apache.struts.action.ActionMapping) void org.apache.struts.action.RequestProcessor.process(javax.servlet.http.HttpSer vletRequest, javax.servlet.http.HttpServletResponse) void org.apache.struts.action.ActionServlet.process(javax.servlet.http.HttpServle tRequest, javax.servlet.http.HttpServletResponse) void org.apache.struts.action.ActionServlet.doPost(javax.servlet.http.HttpServlet Request, javax.servlet.http.HttpServletResponse) void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest , javax.servlet.http.HttpServletResponse) void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.catalina.core.ApplicationDispatcher.invoke(javax.servlet.ServletR equest, javax.servlet.ServletResponse) void org.apache.catalina.core.ApplicationDispatcher.doForward(javax.servlet.Servl etRequest, javax.servlet.ServletResponse) void org.apache.catalina.core.ApplicationDispatcher.forward(javax.servlet.Servlet Request, javax.servlet.ServletResponse) void org.apache.struts.action.RequestProcessor.doForward(java.lang.String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void org.apache.struts.action.RequestProcessor.processActionForward(javax.servlet .http.HttpServletRequest, javax -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>