jsf-2

<c:if test> seems to always evaluate true in JSF2 Facelets

女生的网名这么多〃 提交于 2019-12-18 11:12:45
问题 I am using JSF2 on Facelets. I define an <ui:param> in a page: <ui:composition template="/WEB-INF/templates/ui.xhtml" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" > <ui:param name="title" value="OnAir WebDemo" /> ... </ui:composition> in the ui.xhtml template I have: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf

How to redirect from a ManagedBean for when the request sent is an Ajax request?

和自甴很熟 提交于 2019-12-18 11:07:51
问题 I am using PrimeFaces with JSF2. I am trying to authenticate user by sending login and password as an Ajax request. And in the action method of the backing bean, I am trying to validate user and redirect to a new view if the validation succeeds. Is this possible while using primefaces? Because I think with primefaces' p:commandButton , I can only either have ajax behavior or the navigation. 回答1: Yes, just send a redirect instead of a (default) forward as outcome. The <navigation-case> -less

Localization with bean validation in JSF

孤街浪徒 提交于 2019-12-18 10:56:21
问题 I made a MVC based website using JSF 2.0 and RichFaces 4. Every input text validation is been done using bean validation annotations. I am using Hibernate Validator as bean validation implementation. How can I display a localized message? If I use @NotNull(message="<h:outputText value=\"#{msg['Mymessage']}\" />") then it literally displays <h:outputText value="#{msg['Mymessage']}" /> as message. How is this caused and how can I solve it? 回答1: You should and can not put JSF tags in the message

@ManagedProperty(value = “#{param.id}”) in a non-request Scope Bean

被刻印的时光 ゝ 提交于 2019-12-18 10:14:23
问题 I need to pass a parameter (POST) to a @managedBean, I used managed properties like this: @ManagedProperty(value = "#{param.id}") private int id; And the scope of the Bean is ViewScope I end up with this error: Unable to create managed bean receipt. The following problems were found: - The scope of the object referenced by expression #{param.id}, request, is shorter than the referring managed beans scope of view What can I do? arjan take a look: My page: Facelet Title <form method="post"

Single Select Checkbox Using JSF

孤街浪徒 提交于 2019-12-18 09:45:22
问题 I am creating registration form in JSF and I have field as Active, Inactive where I need to use check boxes and these checkboxes should be SINGLE SELECT ONLY. (Note: I can use radio button and solve the problem, however due to some problem I have to use check boxes). Please suggest me how to get this done? Thanks in advance... 回答1: I think what you need is <h:selectBooleanCheckbox> . The value binded to this component can only be either true (Active) or false (Inactive). It will be something

How to use Ajax with JSF 2.0?

你离开我真会死。 提交于 2019-12-18 09:45:08
问题 I want to implement Ajax on my JSF web project. I googled and found that ICEFaces is supporting Ajax with JSF. Yet I dont know the usability of it. Any one has experience Ajax/JSF, please guide me where to move. [EDIT] If any one has experienced on similar, please share the usability as well. the good and bad.. 回答1: JSF 2.0 has built-in support for Ajax using the f:ajax tag. All three of ICEFaces, OpenFaces, and RichFaces also have Ajax-enabled components but with JSF 2.0 it is now possible

Show/Hide Panel when checkbox is selected

≡放荡痞女 提交于 2019-12-18 09:37:42
问题 I'd like to show a panel when a checkbox is selected or hide the same when the checkbox is not selected. Following code works fine when the value of the checkbox changed. However, initially (when building the web page) the panel is always shown. Since the checkbox is deselected the outputLabel ("hallo") should not be displayed. Only after selecting the checkbox, the text should be displayed. So, something goes wrong here... Here is the code: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h=

JSF - Problem with @ViewScope

久未见 提交于 2019-12-18 09:37:34
问题 I have a page that load (in a panelGroup) two different page, due to the login status (logged, not logged). This is the main switch : template.xhtml P.S. selector.page is "homepage" as default <h:panelGroup layout="block" styleClass="contenitore"> <h:panelGroup layout="block"> <h:panelGroup layout="block" styleClass="menu_table" id="login"> <ui:insert name="login_homepage" /> </h:panelGroup> <h:panelGroup layout="block" id="content"> <c:catch> <ui:include src="/#{selector.page}/#{selector

How to pass a List to javascript in JSF

拟墨画扇 提交于 2019-12-18 09:37:01
问题 I am struggling with a JSF project. In my service, I retrieve a List of custom object (here Sales), and I have to pass it to my jsf view, specifically into the javascript, to make graphs. My problem is, I don't understand how to send the data from the controller (my managed beans) to my view, and which tag to use in my view to retrieve it in my javascript. I think I can pass my data like this, but I'm not sure public String passData() { List<Sales> bestSelling = saleService

Submit form with primefaces widgets on enter

只谈情不闲聊 提交于 2019-12-18 09:31:29
问题 I need to have my primefaces p:commandLink submit a h:form when the user presses the enter key. I tried the solutions suggested here and in a couple of other places. I also tried the primefaces defaultCommand . No matter what I try, the browser seems to notice the button press, but the action is not performed. These are my form's widgets: <p:autoComplete id="acSimple" value="#{home.searchKeywords}" completeMethod="#{home.completeText}" style="" /> <p:commandLink id="srchbutton" action="#{home