jsf

Can we access session scope variables directly in JSF xhtml files

倖福魔咒の 提交于 2020-02-20 08:26:10
问题 Hi I am working on a JSF project, I will like to access some session level variables onto my xhtml UI pages directly without using any managed bean. Just wanted to know if this is possible and if yes than how? Thanks 回答1: Yes its possible If the bean doesnot exits then put it in session first FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put(key,object); And to use the bean on xhtml page use <h:outputText value="#{sessionScope.key}" /> 来源: https://stackoverflow.com

Can MyFaces + CDI be used on WebLogic 12c?

二次信任 提交于 2020-02-20 06:51:07
问题 I've been trying to get this setup running for a couple of days now but still no luck. Here's the test application i've been using: @Named @RequestScoped public class Test { private String test = "test"; public String getTest() { return test; } public void setTest(String test) { this.test = test; } } And in the jsf page: <h:outputText value="#{test.test}"/> Running this sample without MyFaces works fine (renders "test" like it should), but when i deploy MyFaces in the WAR file and do the

Can MyFaces + CDI be used on WebLogic 12c?

那年仲夏 提交于 2020-02-20 06:50:44
问题 I've been trying to get this setup running for a couple of days now but still no luck. Here's the test application i've been using: @Named @RequestScoped public class Test { private String test = "test"; public String getTest() { return test; } public void setTest(String test) { this.test = test; } } And in the jsf page: <h:outputText value="#{test.test}"/> Running this sample without MyFaces works fine (renders "test" like it should), but when i deploy MyFaces in the WAR file and do the

unable to set true false value to a boolean variable [duplicate]

有些话、适合烂在心里 提交于 2020-02-16 13:19:12
问题 This question already has answers here : Understanding PrimeFaces process/update and JSF f:ajax execute/render attributes (4 answers) Closed 11 days ago . I'm unable to set true false value to a boolean variable I have the following code Form.xhtml <ui:composition xmlns="http://www.w3.org/1999/xhtml"> <h:form> <p:panel id="work" styleClass="panelNoBorder"> <p:fieldset toggleable="true" toggleSpeed="500" legend="Core"> <h:panelGrid columns="2" styleClass="panelNoBorder" rendered="#{javaMB

unable to set true false value to a boolean variable [duplicate]

我怕爱的太早我们不能终老 提交于 2020-02-16 13:18:02
问题 This question already has answers here : Understanding PrimeFaces process/update and JSF f:ajax execute/render attributes (4 answers) Closed 11 days ago . I'm unable to set true false value to a boolean variable I have the following code Form.xhtml <ui:composition xmlns="http://www.w3.org/1999/xhtml"> <h:form> <p:panel id="work" styleClass="panelNoBorder"> <p:fieldset toggleable="true" toggleSpeed="500" legend="Core"> <h:panelGrid columns="2" styleClass="panelNoBorder" rendered="#{javaMB

How JSTL tags evaluated in JSF 2.1 for the below

别来无恙 提交于 2020-02-16 06:29:18
问题 I have the below Test.xhtml where i can select mode as Sea/Air. I don't want to load the all the 4 pages(Page1.xhtml, Page2.xhtml, Page3.xhtml, Page4.xhtml) into the jsf view tree. In my scenario, mode once selected and saved that can not be changed to other mode. The saved mode will be shown as view mode. Since at any point of time i need only 2 files (Page1.xhtml, Page2.xhtml (or) Page3.xhtml, Page4.xhtml)... I am using the JSTL tag handler for dynamic including the pages. the below thing

primefaces data exporter XLS exporting only headers not rows

五迷三道 提交于 2020-02-16 04:21:26
问题 My problems is that when I click in the button to export data table, It exports only columns headers, my excel file is generated with none rows. <h:form> <p:dataTable id="cteTable" var="cte" emptyMessage="Nenhum Registro Localizado" reflow="true" value="#{extratorBean.ctes}" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {Exporters}" style="margin-top: 10px" paginator="true" rows="100" scrollable="true" scrollWidth="1024px">

jsf el表达式无法正确显示的问题

风格不统一 提交于 2020-02-14 06:26:01
问题与此人错误一样 我是按照JSF入门这本书上写的一个例子,功能是在第一个页面输入任意字符,点击提交,跳转到第二个欢迎页面,显示你输入的字符和“你好”字符串。可是当你访问第一个页面的时候,输入文本框中的内容默认是"#{user.name}",把它删除掉输入ABC,跳转到第二个页面却显示"#{user.name}你好"。 部分代码如下,请帮忙看一下,谢谢了。 UserBean.java package onlyfun.caterpillar; public class UserBean{ private String name; public void setName(String name){ this.name = name; } public String getName(){ return name; } } faces-config.xml局部代码: <?xml version="1.0"?> <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN" "http://java.sun.com/dtd/web-facesconfig_1_0.dtd"> <faces-config> <navigation-rule> <from-view-id>

JSF学习笔记(一)

此生再无相见时 提交于 2020-02-14 06:09:34
首先,JSF也是表示层的框架,同STRUTS一样,Apache Struts框架的作者 Craig McClanahan,协助领导了Sun公司的JSF项目。从应用开发者的角度看,两种框架是很相似的,但是JSF可能将会得到更多的支持。因为JSF是Java的标准。在未来的发展中,有可能所有的J2EE应用服务器都需要支持JSF(Java Server Faces)。 开发JSF几点比较要注意的地方: (1)web工程启动时首先要在web.xml中加载jsf的配置信息,代码如下: <?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns=" http://java.sun.com/xml/ns/j2ee " xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance " xsi:schemaLocation=" http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd " version="2.4"> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class> javax.faces.webapp

Compare two fields that use same class

*爱你&永不变心* 提交于 2020-02-12 05:13:55
问题 I have two input fields fromDate and toDate which are instances of Date class. The Date class uses custom Date validator which validates the month, day and year fields contained in the date field. The custom date validator is specific for each date i.e, fromDate and toDate. I need to compare the month, day or year fields of fromDate with toDate. If the fromDate is greater than toDate, a validation message has to displayed. Update: The fromDate and toDate are two custom date components as