Comment utiliser différents POJO comme Address
et Certificate
objet de classe utilisant ModelDriven
Interface dans la même action pour effectuer un mappage de collection en utilisant Hibernate dans Struts2?Mutilple différents POJO utilisant Model Driven
ici est l'exemple de code:
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;
}
comment retourner des objets d'adresse et de certificats.
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;
}
}
N'utilisez pas modeldriven. –
Oui. J'ai réalisé que . Je ne devrais pas utiliser le modèle conduit. – Shaurya