1. create a Java bean class for grid view
example:
public class Student{
private String studentid,studentname,classname;
public Student(String studentid,studentname,classname){
this.studentid=studentid;
this.studentname=studentname;
this.classname=classname;
}
getter methods added
}
2. create action support class
create bean object(Student)
select data from database
store data to resultset
add thesse data to bean
example:
public class ActionSupportClass extends ActionSupport
{
private List<student> student=new ArrayList<>();
//getter methods of student
public String studentdetails()
{
//write connection string mysql
//write execute query
// assign result to ResultSet
while(res.next()){
student.add(new Student(res.getString(1),res.getString(2),res.getString(3)));
}
}
}
3. In jsp page
<table>
<tr><th>Student name</th><th>Class</th></tr>
<s:iterator value="requisitionreport" status="status" xmlns:s="#unknown">
<s:property value="studentname"><s:property value="classname">
</table>
4. create jquery and add method viewdetails(action,studentid)
example
function viewdetails(action,studentid){
// add ajax post action and return result as json
}