Regarding JSP,Struts

Hello , Pls reply Urgent ,

This is my code ,

struts-config.xml

-

<form-bean name="studentForm" type="com.ltc.forms.StudentForm"></form-bean>

<action path="/userAction" type="com.ltc.actions.StudentMaintananceAction" name="studentForm" scope="session" validate="true" input="/jsp/homePage.jsp" >

<forward name="success" path="resultSuccess"/>

<forward name="fail" path="resultFail"/>

<forward name="addPage" path="userAddPage"/>

<forward name="viewPage" path ="userViewPage"/>

</action>

StudentMaintananceAction

-

if(strBtnValue.equals("view"))

{

ArrayList viewList = sBean.viewStudentList();

sForm.setResults(viewList);

forward = mapping.findForward("viewPage");

}

--

StudentForm.java

->

public class StudentForm extends ActionForm {

private String firstName = null;

private ArrayList results = null;

public String getFirstName() {

System.out.println(" getFirstName --:"+firstName);

return firstName;

}

public void setFirstName(String firstName) {

this.firstName = firstName;

}

public ArrayList getResults() {

return results;

}

public void setResults(ArrayList results) {

this.results = results;

}

-

userView.jsp

->

userView.jsp

<logic:present name="studentForm" property="results">

<% System.out.println(" -- logic:present 1:"+request.getAttribute("studentForm")); %>

<hr size="1" noshade="true">

<bean:size id="size" name="studentForm" property="results"/>

<% System.out.println(" -- bean:size "); %>

<logic:equal name="size" value="0">

<% System.out.println(" -- bean:size 0"); %>

<center><font color="red"><b>No Students Found</b></font></center>

</logic:equal>

<logic:greaterThan name="size" value="0">

<% System.out.println(" -- bean:size >0"); %>

<TABLE BORDER="1" >

<tr><th>Student ID</th><th>First Name</th><th>Last Name</th><th>Qualification</th>

<th>Technology</th>

</tr>

<logic:iterate id="resultId" name="studentForm" property="results">

<%System.out.println(" -- JSP 1--"); %>

<tr>

<%System.out.println(" -- JSP 2--"); %>

<td><bean:write name="resultId" property="firstName"/></td>

<%System.out.println(" -- JSP 3--"); %>

<td><bean:write name="resultId" property="lastName" /></td>

<%System.out.println(" -- JSP 4--"); %>

<td><bean:write name="resultId" property="qualification" /></td>

<%System.out.println(" -- JSP 5--"); %>

<td><bean:write name="resultId" property="technology"/></td>

<%System.out.println(" -- JSP 6-"); %>

</tr>

</logic:iterate>

</TABLE>

</logic:greaterThan>

</logic:present>

-

This is the error I am facing ,

javax.servlet.ServletException: No getter method for property firstName of bean resultId.

--

Upto System.out.println(" -- JSP 2--"); Its coming ,

Pls send me solution urgently.

Regards,

Praveen

[3445 byte] By [chowdampraveena] at [2007-11-27 10:39:44]
# 1

hi,

public String getFirstname() {

System.out.println(" getFirstName --:"+firstName);

return firstName;

}

public void setFirstname(String firstName) {

this.firstName = firstName;

}

now it will work,

use upper case letter after getX & setX, remaining you to follow in small case

drvijayy2k2a at 2007-7-28 19:02:50 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

When u are iterating results list , there is an object taken out of the list.

Please give the code of that class.

You may be missing the getter/setter methods for the variables of the class , whose objects you are adding to the list.

R@njita at 2007-7-28 19:02:50 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

If you can't interpret a stack trace yet, you've got no business writing JSPs and using a framework like Struts

Back to school with you!

georgemca at 2007-7-28 19:02:50 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...