I get an error when the following line of code is executing: cinfoForm.setJurisdiction(map.get("jurisdiction_name").toString()); Actually the error comes from "map.get("jurisdiction_name").toString()" (I also tried (String)map.get("jurisdiction_name") ) when map.get(...) returns object = NULL. I need to cast the NULL object to String somehow before using setter... The error is: [Servlet Error]-[action]: java.lang.NullPointerException Thanks for the help
When I pre-populate the ActionForm with values from database, some of them are NULLs. Should I each time before using setter check for NULL and set value to emply string or there is some other way. Because I have 30 fields I have to check thirty times. Should I write the code to check that in ActionBean or in each setter and getter in the Form? Thanks in advance
Hi Paul, I try to follow the patern you suggested. After the 1st SaveAction's code is executed (I checked output at the end: forward = ActionForward[success]), then error happens: SystemOut O savecinfoAction forward=ActionForward[success] [7/21/03 13:46:19:912 EDT] 2d493ae2 WebGroup I SRVE0180I: [EclientProfileWeb] [/EclientProfileWeb] [Servlet.LOG]: action: Processing a POST for /gotoassign [7/21/03 13:46:19:912 EDT] 2d493ae2 WebGroup I SRVE0180I: [EclientProfileWeb] [/EclientProfileWeb] [Servlet.LOG]: action: Looking for ActionForm bean under attribute 'assignForm' [7/21/03 13:46:19:912 EDT] 2d493ae2 WebGroup I SRVE0180I: [EclientProfileWeb] [/EclientProfileWeb] [Servlet.LOG]: action: Creating new ActionForm instance of class 'eclientprofile.web.forms.AssignForm' [7/21/03 13:46:19:972 EDT] 2d493ae2 WebGroup I SRVE0181I: [EclientProfileWeb] [/EclientProfileWeb] [Servlet.LOG]: action: Error creating ActionForm instance of class 'eclientprofile.web.forms.AssignForm': java.lang.NullPointerException where 'gotoassign' is my 2nd View Action and 'AssignForm' is a formBean of 2nd page that I pass to this 2nd View Action, i.e: < action path="/edit" name="clientinfoForm" type="eclientprofile.web.actions.EditAction" scope="request"> < forward name="success" path="/clientinfoedit.jsp"> </forward> </action> < action name="clientinfoForm" path="/saveCinfo" scope="request" type="eclientprofile.web.actions.SaveCinfoAction"> < forward name="success" path="./gotoassign.do"> </forward> </action> < action path="/gotoassign" type="eclientprofile.web.actions.GotoassignAction"name="assignForm" scope="request"> < forward name="edit" path="/assignedit.jsp"> </forward> </action> Thanks a lot for your help
Thanks everybody, but it works well for simple flow. Really my flow is more complicated. I have three pages to edit data for the same table (I have 'continue' button on page1 and page2 and 'save' button on page3). So I have 3 forms and because of that cannot use one action. I have to be able to access two forms from one action. For example when I click 'continue' on page1, I have to save in session object data of form1 and to populate with data the form2. But since I cannot pass two forms to the same action, I do not how to make it working. Thanks in advance
Thanks Lalitha, I tried to do that way, but then I have another problem. I load data in ActionEdit using setters to EditForm and display them on edit.jsp for editing. But next step is to save edited data. I should do that in saveAction, but editForm is not passed to saveAction? Should I save editForm in session object so that to be able to access it from saveAction? Thanks again
Could you please answer the question: How to access the session (or request) in FormBean. I need to prepopulate form with values from database which were saved in session object Thanks in advance
Thanks, I think it will work, but I need to prevent users from having open more then one the same application on the same machine. Any ideas how to do that? Thanks
Hi, Could somebody help me with setting transaction attributes in WSAD 5.0? I cannot make them working. I have a method addAssgn() in the session bean, where I insert into three tables. To insert into first table I use create(...) method of BMP entity bean and I insert into two others tables in this Session bean using datasource look up. In Deployment descriptor on Bean tab I've set transaction type to 'container' and on Assembly descriptor tab I've set container transaction type to 'required' for that method. Looks like I missed something, because when inserting into second table failed, it doesn't rollback (I have data in the first table inserted) Thanks
Hi, Looks like I have Java/WSAD related problem. I need to insert into table with big number of columns (69). So I create sql string dynamically to have "insert tblname (columnsName, ...) values (?,?,?,?...)" and then use loop with prepStmt.Set... to set parameter values. It works only one time. When I try to call that business method to insert one more row, it gives the error "IndexOutOfBoundsException" and always on parameter #33, i.e it cannot set parameter #33. I've check the number of parameters is correct and equals to 69. Could somebody helps what the reason of the error is? Thanks in advance Output: [6/2/03 9:39:48:914 EDT] cd190b8 SystemOut O setSQLParameter starts par=33 null [6/2/03 9:39:48:914 EDT] cd190b8 SystemOut O if block className= java.lang.Stringindex= 33 [6/2/03 9:39:48:914 EDT] cd190b8 SystemOut O Exception in else block: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 [6/2/03 9:39:48:914 EDT] cd190b8 SystemErr R java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 [6/2/03 9:39:48:914 EDT] cd190b8 SystemErr R at java.util.ArrayList.RangeCheck(ArrayList.java(Compiled Code)) [6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at java.util.ArrayList.set(ArrayList.java:343) [6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.countParameter(WSJdbcPreparedStatement.java:355) [6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.setString(WSJdbcPreparedStatement.java:1206) [6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at eclientprofile.session.AssignServiceBean.setSQLParm(AssignServiceBean.java:372) [6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at eclientprofile.session.AssignServiceBean.insertRow(AssignServiceBean.java:671) [6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at eclientprofile.session.AssignServiceBean.addAssgn(AssignServiceBean.java:558) [6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at eclientprofile.session.EJSRemoteStatelessAssignService_9ace9c43.addAssgn(EJSRemoteStatelessAssignService_9ace9c43.java:142) [6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at java.lang.reflect.Method.invoke(Native Method) [6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at com.ibm.rmi.corba.ServantObjectImpl$3.run(ServantObjectImpl.java:223) [6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at java.security.AccessController.doPrivileged(Native Method) [6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at com.ibm.rmi.corba.ServantObjectImpl.invoke(ServantObjectImpl.java:221) [6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at $Proxy1.addAssgn(Unknown Source) [6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at eclientprofile.session._AssignService_Stub.addAssgn(_AssignService_Stub.java:328) [6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at java.lang.reflect.Method.invoke(Native Method) [6/2/03 9:39:48:924 EDT] cd190b8 SystemErr R at com.ibm.etools.utc.model.ReflectionMethodModel.invoke(ReflectionMethodModel.java:68) [6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at com.ibm.etools.utc.servlet.InvokeServlet.invoke(InvokeServlet.java:110) [6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at com.ibm.etools.utc.servlet.InvokeServlet.doPost(InvokeServlet.java:323) [6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) [6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) [6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110) [6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174) [6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313) [6/2/03 9:39:48:934 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116) [6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:258) [6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42) [6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40) [6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:872) [6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:491) [6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:173) [6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79) [6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:199) [6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71) [6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114) [6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:187) [6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:331) [6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56) [6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:432) [6/2/03 9:39:48:964 EDT] cd190b8 SystemErr R at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:343) [6/2/03 9:39:48:974 EDT] cd190b8 SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)