boolean flag=false;
String username=(String) request.getAttribute("user");
List list0=this.getPatchuserService().findallpatchuser();
Iterator it=list0.iterator();
while(it.hasNext()){
Patchuser pu=(Patchuser) it.next();
if(username.equals((String)pu.getUsename()) ¦ ¦username==(String)pu.getUsename())flag=true;
}
if(flag){
List list=this.getPubdocService().findallpubdocs();
request.getSession().setAttribute("pubdoclist", list);
return mapping.findForward("managePubdoc");
}else{
return mapping.findForward("error");
}
this.getPatchuserService().findallpatchuser();返回所有授权用户 这个方法经过测试好用 并且授权用户为Patchuser类型
可是怎么有错误 java.lang.NullPointerException
com.yourcompany.struts.action.ManagepubAction.execute(ManagepubAction.java:47)
这个第47行就是
if(username.equals((String)pu.getUsename()) ¦ ¦username==(String)pu.getUsename())
这行 大家帮我看看怎么回事
String username=(String) request.getAttribute("user");
List list0=this.getPatchuserService().findallpatchuser();
Iterator it=list0.iterator();
while(it.hasNext()){
Patchuser pu=(Patchuser) it.next();
if(username.equals((String)pu.getUsename()) ¦ ¦username==(String)pu.getUsename())flag=true;
}
if(flag){
List list=this.getPubdocService().findallpubdocs();
request.getSession().setAttribute("pubdoclist", list);
return mapping.findForward("managePubdoc");
}else{
return mapping.findForward("error");
}
this.getPatchuserService().findallpatchuser();返回所有授权用户 这个方法经过测试好用 并且授权用户为Patchuser类型
可是怎么有错误 java.lang.NullPointerException
com.yourcompany.struts.action.ManagepubAction.execute(ManagepubAction.java:47)
这个第47行就是
if(username.equals((String)pu.getUsename()) ¦ ¦username==(String)pu.getUsename())
这行 大家帮我看看怎么回事
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货