JSF页面呈现错误:面向上下文 [英] JSF page rendering error:Faces Context

查看:88
本文介绍了JSF页面呈现错误:面向上下文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我的JSF页面被渲染时,我收到以下消息。该页面正确呈现,但在控制台中,下面的消息重复多次...

  INFO:错误:无法获取面对会话变量的上下文:localeBean 

11:54:27,090 INFO [STDOUT] 2009年11月24日11 :54:27 AM com.web.util.faces.UtilFacesFuncs log
INFO:你很可能已经从NON-Faces(即Servlet)上下文中请求了一个Faces对象。



在我的JSF中,我按照以下方式使用localebean:

 < f:view locale =# {localeBean.userLocaleLoggedIn}> 

在faces-config文件中,我将其定义如下:

 < managed-bean> 
< description> Locale Bean< / description>
< managed-bean-name> localeBean< / managed-bean-name>
< managed-bean-class> com.mg.faces.LocaleBean< / managed-bean-class>
< managed-bean-scope> session< / managed-bean-scope>
< / managed-bean>

在我的类LocaleBean中有一个方法getUserLocaleLoggedIn(),它是在JSF时执行的代码页面执行:

 < f:view locale =#{localeBean.userLocaleLoggedIn}> 

在调试我的jsp时,我可以看到正在调用的方法,并且每次都很好,我调试我的jsp all直到它创建页脚的方式,就在它向浏览器呈现时,这些错误反复抛出大约20多次。它只发生在tihs jsp上,因为它是我添加的一个新的。我尝试与现有的jso进行比较,我看不出有什么不同,有谁知道我不想要的东西?



非常感谢任何帮助。



谢谢。



<问候

解决方案

对不起我上面添加的评论没有正确理解,这是我在web.xml中的内容:
另外我使用的网址是 http://localhost.com/context/register/mypage.htm
我在这个文件夹下有这些jsp寄存器。我可以从寄存器文件夹
中调用其他jsp,并且不会出现此错误....只是发生了我添加的这个特定的jsp。

 < servlet的映射> 
< servlet-name> Faces Servlet< / servlet-name>
< url-pattern> / faces / *< / url-pattern>
< / servlet-mapping>
< servlet-mapping>
< servlet-name> Faces Servlet< / servlet-name>
< url-pattern> * .face< / url-pattern>
< / servlet-mapping>
< servlet-mapping>
< servlet-name> Faces Servlet< / servlet-name>
< url-pattern> *。jsf< / url-pattern>
< / servlet-mapping>
< servlet-mapping>
< servlet-name> Faces Servlet< / servlet-name>
< url-pattern> * .htm< / url-pattern>
< / servlet-mapping>

我正在尝试添加完整的映射,但代码标签在这里工作的方式,它还没有到来因为hte mappings有标签......我试过提供了blockquotes,但是这个编辑器仍然无法正确显示我的映射,道歉!



任何想法我应该如何打电话给我的网址。谢谢。


I am getting the below messages when my JSF page gets rendered. The page is rendered correctly however in the Console the message below repeats itself numerous times...

INFO: ERROR: Unable to get Faces Context for session variable: localeBean

11:54:27,090 INFO [STDOUT] Nov 24, 2009 11:54:27 AM com.web.util.faces.UtilFacesFuncs log INFO: Most likely, you've requested a Faces object from a NON-Faces (i.e. Servlet) context.

In my JSF I am usign localebean as follows:

<f:view locale="#{localeBean.userLocaleLoggedIn}">

In the faces-config file I have it defined as below:

<managed-bean>
    <description>Locale Bean</description>
    <managed-bean-name>localeBean</managed-bean-name>
    <managed-bean-class>com.mg.faces.LocaleBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
</managed-bean>

In my class LocaleBean there is a method getUserLocaleLoggedIn() which is the code that gets executed when the JSF page executes:

  <f:view locale="#{localeBean.userLocaleLoggedIn}">

On debugging my jsp I can see that method being called and everyhting is fine, I debug my jsp all the way thru till it creates the footer, just when it is rendering to the browser these errors are thrown about 20 + times repeatedly. It only happens on tihs jsp as it is a new one I have added. I tried comparing with existing jso I cannot see anything different, Does anyone know what I shud be looking out for?

Any help much appreciated.

Thanks.

Regards

解决方案

Sorry my comment I added above did not come across correctly, here is what I have in my web.xml: Also my url I use is http://localhost.com/context/register/mypage.htm I have these jsp under the folder register. I can call other jsp from the register folder and this error does not appear.... just happens for this particular jsp that I have added.

<servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>*.faces</url-pattern>
</servlet-mapping>
<servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>*.htm</url-pattern>
</servlet-mapping>

I am trying to add my full mappings but the way the code tags work here, it is not coming across since hte mappings have tags... I tried blockquotes provided, but still this editor is not able to display my mappings correctly, apologies!

Any idea how I should be calling my url. Thanks.

这篇关于JSF页面呈现错误:面向上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆