iteration of users database in struts-example
Hello everyone, I am trying to modify the struts example to display a list of users at the end of the registration form when someone selects edit registration from the main menu. I have three users in database.xml and this is code i've added to registration.jsp: table logic:iterate id=user name=database tr td align=left test /td /tr /logic:iterate /table This works fine, at the end of the edit registration form, right after the table of subscriptions i get a table of three rows (because i have three users in the database) and each row displays the word test. However, when i try the following code i get an error: logic:iterate id=user name=database tr td align=left bean:write name=user property=username/ /td /tr /logic:iterate I presume i am doing something really wrong, since the current user ca display its username at the beginning of the form. Is there something additional i need to do to get this working besides the registration.jsp changes ? ExecuteThread: '14' for queue: 'default' 101017 [WebAppServletContext(2417567,struts-example,/struts-example)] Root cause of ServletException javax.servlet.jsp.JspException: No getter method for property username of bean user at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:517) at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179) at jsp_servlet._registration._jspService(_registration.java:1817) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :245) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :284) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.java:182) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja va:1758) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1595) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :245) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo ntext.java:2279) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java :1923) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) Thank you very much, Corneliu --- Espial Inc. espial.com
Re: iteration of users database in struts-example
My guess is that database is a hashmap of some sort, so what you need is bean:write name=user property=value.username/ see http://jakarta.apache.org/struts/struts-logic.html#iterate --m - Original Message - From: Corneliu Rachieru [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 21, 2001 2:46 PM Subject: iteration of users database in struts-example Hello everyone, I am trying to modify the struts example to display a list of users at the end of the registration form when someone selects edit registration from the main menu. I have three users in database.xml and this is code i've added to registration.jsp: table logic:iterate id=user name=database tr td align=left test /td /tr /logic:iterate /table This works fine, at the end of the edit registration form, right after the table of subscriptions i get a table of three rows (because i have three users in the database) and each row displays the word test. However, when i try the following code i get an error: logic:iterate id=user name=database tr td align=left bean:write name=user property=username/ /td /tr /logic:iterate I presume i am doing something really wrong, since the current user ca display its username at the beginning of the form. Is there something additional i need to do to get this working besides the registration.jsp changes ? ExecuteThread: '14' for queue: 'default' 101017 [WebAppServletContext(2417567,struts-example,/struts-example)] Root cause of ServletException javax.servlet.jsp.JspException: No getter method for property username of bean user at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:517) at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179) at jsp_servlet._registration._jspService(_registration.java:1817) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :245) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :284) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.java:182) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja va:1758) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1595) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :245) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo ntext.java:2279) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java :1923) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) Thank you very much, Corneliu --- Espial Inc. espial.com
RE: iteration of users database in struts-example
Thank you, that was exactly the problem... Regards, Corneliu -Original Message- From: Mike Thompson [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 21, 2001 4:01 PM To: [EMAIL PROTECTED] Subject: Re: iteration of users database in struts-example My guess is that database is a hashmap of some sort, so what you need is bean:write name=user property=value.username/ see http://jakarta.apache.org/struts/struts-logic.html#iterate --m - Original Message - From: Corneliu Rachieru [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 21, 2001 2:46 PM Subject: iteration of users database in struts-example Hello everyone, I am trying to modify the struts example to display a list of users at the end of the registration form when someone selects edit registration from the main menu. I have three users in database.xml and this is code i've added to registration.jsp: table logic:iterate id=user name=database tr td align=left test /td /tr /logic:iterate /table This works fine, at the end of the edit registration form, right after the table of subscriptions i get a table of three rows (because i have three users in the database) and each row displays the word test. However, when i try the following code i get an error: logic:iterate id=user name=database tr td align=left bean:write name=user property=username/ /td /tr /logic:iterate I presume i am doing something really wrong, since the current user ca display its username at the beginning of the form. Is there something additional i need to do to get this working besides the registration.jsp changes ? ExecuteThread: '14' for queue: 'default' 101017 [WebAppServletContext(2417567,struts-example,/struts-example)] Root cause of ServletException javax.servlet.jsp.JspException: No getter method for property username of bean user at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:517) at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:179) at jsp_servlet._registration._jspService(_registration.java:1817) at weblogic.servlet.jsp.JspBase.service(JspBase.java:27) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :245) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :284) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImp l.java:182) at org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja va:1758) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1595) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :245) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java :200) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo ntext.java:2279) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java :1923) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120) Thank you very much, Corneliu --- Espial Inc. espial.com