I want to initialize Student
's id
in delete
action
StudentAction.java:
public class StudentAction extends ActionSupport implements ModelDriven {
private List studentList;
Student student;
StudentDAO sdo = new StudentDAO();
public String delete() {
System.out.println("delete action");
System.out.println(student.getId()); //not setting value of id
sdo.delete(student.getId());
return SUCCESS;
}
@Override
public Object getModel() {
return student;
}
//getter and setter
}
Student.java:
public class Student implements java.io.Serializable {
private Long id;
private String name;
private String address;
//getter and setter
}
In JSP:
<s:iterator value="studentList" var="ss">
<s:property value="id"/>
<s:property value="name"/>
<s:property value="address"/>
<a href="delete?id= <s:property value="id"/>">delete</a><br>
</s:iterator><br>
While passing value from JSP to delete
action I want to initialize Student
's id
by using this code. How to do this?