使用 Facelets 时出现会话已过期错误
我是 JSF 和 Facelets 的初学者。我一直在尝试创建一个使用 Facelet 模板“master_layout.xhtml”的简单登录页面。每次我单击登录时,我都会收到由 Mojarra/Facelets 生成的会话已过期错误。请帮忙
这是我的 login.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="./master_layout.xhtml">
<ui:define name="content">
<h:form id="myform">
<h:panelGrid columns="2" right="100px">
<h:outputText value="Username " style="font-size: 20px; color: #C0C0C0"/>
<h:inputText id="unameTxtBox" style="position: relative; width:157px"/>
<h:outputText value="Password " style="font-size: 20px; color: #C0C0C0"/>
<h:inputSecret id="pwdTxtBox" style="position: relative; width: 157px; "/>
<h:commandButton id="loginButton" style="right:250px" value="LOG IN" action="#{loginManagedBean.validateLogin}"></h:commandButton>
</h:panelGrid>
</h:form>
</ui:define>
<ui:define name="footer">
Copyright 2011- xyzzz Inc.
</ui:define>
</ui:composition>
</html>
I am a beginner with JSF and facelets.I have been trying to create a simple login page that uses a facelet template 'master_layout.xhtml'. Everytime I click on Log In,I get the session has expired error with Generated by Mojarra/Facelets .Please help
Here is my login.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="./master_layout.xhtml">
<ui:define name="content">
<h:form id="myform">
<h:panelGrid columns="2" right="100px">
<h:outputText value="Username " style="font-size: 20px; color: #C0C0C0"/>
<h:inputText id="unameTxtBox" style="position: relative; width:157px"/>
<h:outputText value="Password " style="font-size: 20px; color: #C0C0C0"/>
<h:inputSecret id="pwdTxtBox" style="position: relative; width: 157px; "/>
<h:commandButton id="loginButton" style="right:250px" value="LOG IN" action="#{loginManagedBean.validateLogin}"></h:commandButton>
</h:panelGrid>
</h:form>
</ui:define>
<ui:define name="footer">
Copyright 2011- xyzzz Inc.
</ui:define>
</ui:composition>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看您所做的事情似乎是一个直接的表单提交,因此会话在表单提交时无效(可能在您的操作中,或者可能有一个过滤器使其无效?)或者会话超时设置为非常短的时间您的 web.xml 部署描述符。您是否在 web.xml 文件中配置了 session-timeout 元素?你把它设置为什么值?如果尚未设置,那么您使用的容器将使用其默认值。
Looking at what your doing seems to be a straight forward form submit so either the session is being invalidated on form submit (maybe in your action or maybe there is a filter that invalidates it?) or the session timeout is set to something very short in your web.xml deployment descriptor. Have you configured the session-timeout element in your web.xml file? What value did you set it to? If it hasn't been set then the container your are using will use its default value for this.