This is my EmployeeList.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html:html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>List of Employee</title>
</head>
<body>
<table border="1" cellpadding="1" cellspacing="1" align="center">
<tr>
<th>Test header</th>
</tr>
<tr>
<logic:iterate id="result"name="EmployeeForm"property="empset">
<td><bean:write name="result"property="firstName"ignore="true"/></td>
<td><bean:write name="result"property="middleName"ignore="true"/></td>
<td><bean:write name="result"property="lastName"ignore="true"/></td>
<td><bean:write name="result"property="address"ignore="true"/></td>
<td><bean:write name="result"property="birth"ignore="true"/></td>
<td><bean:write name="result"property="phoneNo"ignore="true"/></td>
<td><bean:write name="result"property="position"ignore="true"/></td>
<td><bean:write name="result"property="salary"ignore="true"/></td>
</logic:iterate>
</tr>
<tr>
<td><a href="pages/MainForm.jsp"> <html:button value="Back to Main Menu" property="back"/> </a></td>
</tr>
</table>
</body>
</html:htm

This is my Form Class(EmployeeForm.java)

public class EmployeeForm extends ActionForm {

    private static final long serialVersionUID = 1L;
    public String firstName = "";
    public String middleName = "";
    public String lastName = "";
    public String address = "";
    public String birth = "";
    public String phoneNo = "";
    public String position = "";
    public String salary = "";

    Set<Employee> empset = new HashSet<Employee>();

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getMiddleName() {
        return middleName;
    }

    public void setMiddleName(String middleName) {
        this.middleName = middleName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getBirth() {
        return birth;
    }

    public void setBirth(String birth) {
        this.birth = birth;
    }

    public EmployeeForm() {
        super();
        // TODO Auto-generated constructor stub
    }

    public String getPhoneNo() {
        return phoneNo;
    }

    public void setPhoneNo(String phoneNo) {
        this.phoneNo = phoneNo;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public String getSalary() {
        return salary;
    }

    public void setSalary(String salary) {
        this.salary = salary;
    }
    public Set<Employee> getEmpset() {
        return empset;
    }

    public void setEmpset(Set<Employee> empset) {
        this.empset = empset;
    }

}

the first 4 bean write execute well (firstname,middlename,lastname,address)
from birth up to salary i got an error (No getter method for property birth of bean result)

How it possible that first four works fine and rest getting error?
If not getter found for any property, then the page will not be rendered.
It seems that everything is okay. Check the spellings of getter and props.
Also clear the cache and history of browser and the try.

How it possible that first four works fine and rest getting error?
If not getter found for any property, then the page will not be rendered.
It seems that everything is okay. Check the spellings of getter and props.
Also clear the cache and history of browser and the try.

I already did that but the error still appear...

I already did that but the error still appear...

now im thinking if my hashset has a problem with dealing this objects...

now im thinking if my hashset has a problem with dealing this objects...

this is my code in my Action Form Class(EmployeeAction.java)

public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        ArrayList<Employee> temp = new ArrayList<Employee>();

        HttpSession session = request.getSession();

        HashSet<Employee> set = (HashSet<Employee>)session.getAttribute("set");
        HashSet<EmployeeInformation> setSalPos = (HashSet<EmployeeInformation>)session.getAttribute("setSalPos");

        PrintWriter out = response.getWriter();

        if (request.getParameter("choice") != null){ //choice 1
            String input = request.getParameter("choice");
            if (input.equals("2")){
                    synchronized (session) {
                        EmployeeForm getform = (EmployeeForm) form;
                        //getform.setEmpset(set);
                        getform.setEmpSet(set);
                        // getform.setEmpList(temp);
                        return mapping.findForward(input);
                    }
            }           

        }else { //adding

                EmployeeForm employeeform = (EmployeeForm) form;

                 String firstName = employeeform.getFirstName();
                 String middleName = employeeform.getMiddleName();
                 String lastName = employeeform.getLastName();
                 String address = employeeform.getAddress();
                 String birth = employeeform.getDateOfBirth();
                 String position = employeeform.getPosition();
                 String phone = employeeform.getPhoneNumber();
                 String salary = employeeform.getSalary();

                     synchronized(session) {
                            if (set == null) {
                                set = new HashSet<Employee>();
                                session.setAttribute("set", set);
                            }
                            if (setSalPos == null) {
                                setSalPos= new HashSet<EmployeeInformation>();
                                session.setAttribute("setSalPos", setSalPos);
                            }

                    // Employee empinfo = new Employee(firstName,middleName,lastName,birth,address,phone);
                     Employee empinfo = new Employee(firstName,middleName,lastName,birth,address,phone,position,salary);
                     set.add(empinfo);

                     EmployeeInformation salpos = new EmployeeInformation(lastName,firstName,middleName,position,salary);
                     setSalPos.add(salpos); 

                     temp.addAll(set);

                        out.println("<html>");
                        out.println("<head>");
                        out.println("</head>");
                        out.println("<body>");
                        out.println("<h1>Employee Added to List</h1>");
                        out.println("<a href='pages/MainForm.jsp'> ====> Click here to back in Main Menu <==== </a>");
                        out.println("</body>");
                        out.println("</html>");
                      }
                }               

        return super.execute(mapping, form, request, response);
    }

}   

When pasting any code, please paste it inside the CODE tag, so that the code are readable. Just select the code and click the CODE written above.

What value is in the hashset? this value is being displayed in the UI?

When pasting any code, please paste it inside the CODE tag, so that the code are readable. Just select the code and click the CODE written above.

What value is in the hashset? this value is being displayed in the UI?

the value of the hashset are the inputs of a user in the employee.jsp
if i want to print the whole value of a set its running without an error..
but when im trying to seperate each im getting error no getter method for bean property...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.