Struts2でHibernateを使用してコレクションマッピングを実行するために、インターフェイスを使用しAddress
てCertificate
クラスオブジェクトなどの異なるPOJOを使用する方法は?ModelDriven
Action
コードサンプルは次のとおりです。
package com.acv.in.action;
import java.util.HashSet;
import java.util.Set;
import com.acv.in.bean.Student;
import com.acv.in.dao.DAO;
import com.acv.in.dao.DAOImpl;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
public class UserActionImpl extends ActionSupport implements ModelDriven<Student>{
private static final long serialVersionUID = 1L;
Set<String> docList= new HashSet<String>();
DAO dao= new DAOImpl();
private Student student= new Student();
@Override
public Student getModel() {
// TODO Auto-generated method stub
return student;
}
返品方法Address
とCertificate
オブジェクトは?
public UserActionImpl()
{
}
public String add() {
System.out.println("inside add");
dao.insert(student);
return "success";
}
public String delete() {
// TODO Auto-generated method stub
return "success";
}
public String update() {
// TODO Auto-generated method stub
return "success";
}
public String getById() {
// TODO Auto-generated method stub
return "success";
}
public String getAll() {
// TODO Auto-generated method stub
return "success";
}
public Set<String> getDocList() {
return docList;
}
public void setDocList(Set<String> docList) {
this.docList = docList;
}
public Student getStudent() {
return student;
}
public void setStudent(Student student) {
this.student = student;
}
public DAO getDao() {
return dao;
}
public void setDao(DAO dao) {
this.dao = dao;
}
}