ac.getSession().put("Owner", owner);你都注释了 怎么显示
除了表色标注的都可以显示??那就是查询的问题 或者数据库表中本身没有数据

解决方案 »

  1.   

    查询没有问题,那个是在service里面写的
    public class OwnerServiceImp implements OwnerService { private EntityDao entityDao;
    //业主登陆
    public String owner_Login(Owner owner) {
    // TODO Auto-generated method stub
    System.out.println("进入登录.....");
    String view="Tourists";
    String hql="from Owner where ownerName='"+owner.getOwnerName()+"' and ownerTel='"+owner.getOwnerTel()+"'";
    //强制类型转换
    List<Owner> list= find(hql);
    if(list.size()>0)
    {
    view="Owner";
    owner=list.get(0);
    System.out.println(owner.getOwnerGender()+owner.getOwnerIdcard()+owner.getOwnerRoom()+owner.getOwnerWork());
    ActionContext ac=ActionContext.getContext();//保存session,相当于request.getSession().setAttribute("listMessage",listMessage);
    System.out.println(owner);
    ac.getSession().put("Owner", owner);
    }
    else{
    view = "error";
    ActionContext ac=ActionContext.getContext();
    ac.getSession().put("errorinfo","业主不存在!");
    } return view;
    }

    //把查找的结果进行强制类型转换
    public List<Owner> find(String hql) {
    // TODO Auto-generated method stub
    List<Owner> list = new ArrayList<Owner>();
    for(Object o:entityDao.find(hql)){
    list.add((Owner)o);
    }
    return list;
    }



    public EntityDao getEntityDao() {
    return entityDao;
    }
    public void setEntityDao(EntityDao entityDao) {
    this.entityDao = entityDao;
    } public List<Owner> findo(String hql) {
    // TODO Auto-generated method stub
    List<Owner> list= new ArrayList<Owner>();;
    for(Object o:entityDao.find(hql))
    {
    list.add((Owner)o);
    }
    return list;
    }
    }