File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes problem in retriving the data from ArrayList using Struts bean:write tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem in retriving the data from ArrayList using Struts bean:write tag" Watch "problem in retriving the data from ArrayList using Struts bean:write tag" New topic
Author

problem in retriving the data from ArrayList using Struts bean:write tag

sarang bharambe
Ranch Hand

Joined: Apr 01, 2005
Posts: 40
hey friends
I am trying to develop a small Employee database application and i am facing a strange problem:
I have a java bean called EmpEntity having getter and setter methods for the fields.
but after getting the resultset in the Arraylist collection I am not able to retrive the data using <bean:write> tag in the JSP .The error is as follows:

javax.servlet.ServletException: No getter method for property pEmpEmployeeId of bean EmpEntity
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.ListEmp_jsp._jspService(ListEmp_jsp.java:192)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:670)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:637)
org.apache.jsp.index_jsp._jspService(index_jsp.java:45)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

Despite having the getter method for pEmpEmployeeId it is giving the error.
what could be cause?and what is the solution?
regards


SCJP 1.4 (86%)<br />SCWCD 1.4 (86%)<br />----------<br />If You dont succeed at first time,call it Version 1.0 !!!
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
without seeing your complete <bean:write> statement, it's a guess that you may not have the correct case. e.g it should be <bean:write name="beanName" property="pEmpEmployeeId"/> and the getter method MUST be getPEmpEmployeeId(). lowercase 'p' for the property, uppercase 'P' for the getter method.


-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
sarang bharambe
Ranch Hand

Joined: Apr 01, 2005
Posts: 40
hey alan
thanks for the reply. As u said i made a mistake in using the cases for
<bean:write> message .but after changing the same it is still giving the same error ie.

javax.servlet.jsp.JspException: No getter method for property pEmpEmployeeId of bean EmpEntity
org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:1031)
org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:227)
org.apache.jsp.ListEmp_jsp._jspx_meth_bean_write_0(ListEmp_jsp.java:299)
org.apache.jsp.ListEmp_jsp._jspService(ListEmp_jsp.java:140)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:670)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:637)
org.apache.jsp.index_jsp._jspService(index_jsp.java:45)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

here is the actual code snippet:
<logic:iterate id="EmpEntity" name="employees">
<bean:write name="EmpEntity" property="pEmpEmployeeId" />

so what can be done now?can u help once again?hoping to get a help.
regards
Ankur Jaiswal
Greenhorn

Joined: Aug 25, 2003
Posts: 15
Looks fine. Could you check your struts-config.xml file for the action form bean that you are using. Check for the name of the action form.
Also, you could take a look at the field "pEmpEmployeeId" make sure that the case is correct. Note that your getter method would something like

private String pEmpEmployeeId;

public String getPEmpEmployeeId()
{
return pEmpEmployeeId;
}
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: problem in retriving the data from ArrayList using Struts bean:write tag