FacesContext.getCurrentInstance() 返回NULL

来源:互联网 发布:中国知网论文数据库 编辑:程序博客网 时间:2024/06/10 14:53

FacesContext facesContext=FacesContext.getCurrentInstance();

 

这句代码报错,百思不得求解

 

 

解决方法:

<form name="form1" action='<c:url value="/sys_permission/psetprivilege.faces"/>' method="post">

<input type="hidden" id = "result" name="result" value="<%=tmp %>"  />

<input type="hidden" id = "delete" name="result" value="5,11,41,61,68,82,110,125,140,150,243,275,280,286,290,310,802,803,"  />

<input type="hidden" name="roleid" value="<%=roleid%>"  />

<input type="submit" name="Submit" value="保存权限" onclick="childShowSysInform();" />

</form>

 

解决思路:

 

FacesContext JSF框架中的类,直接Action提交到JSP页面,根本没有经过如下Servlet,后缀名修改为faces,问题成功解决。

    <servlet-mapping>

       <servlet-name>Faces Servlet</servlet-name>

       <url-pattern>*.faces</url-pattern>

    </servlet-mapping>

 

解决人: 李虎军

 

总结:

对框架使用的理解,对WEB.XML的理解,对过滤器的理解。对FacesContext的生命流程理解,逻辑判断能力,实在是让我好生敬佩。

 

 

 

 


 

原创粉丝点击