viewparams

Dynamicly included page form first submit fails

安稳与你 提交于 2019-12-08 05:44:55
问题 I got a strange behaviour on dynamicly included page My first page has a combo to choose from different pages to include : <h:panelGrid columns="2"> <h:outputLabel value="Choose your page to include" /> <h:selectOneMenu id="pageList" value="#{anyPageBean.page}"> <f:selectItems value="#{anyPageBean.pageList}" var="w" itemValue="#{w}" itemLabel="#{w}" /> </h:selectOneMenu> </h:panelGrid> The AnyPageBean just gives back one of the 2 following pages : pilotNoTemplate.xhtml or pipo.xhtml

Redirect if a f:viewParam is empty

旧时模样 提交于 2019-12-07 07:21:35
问题 Сan I do a redirect (or error) if a f:viewParam is empty? <f:metadata> <f:viewParam name="accountId" value="#{accountMB.id}"/> </f:metadata> When I add required="true" , nothing happens. What are the options? 回答1: When I add required="true" , nothing happens You need <h:message(s)> to show faces messages associated with a given (input) component. You probably already know how to do that for <h:inputText> . You can do exactly the same for <f:viewParam> . <f:metadata> <f:viewParam id="foo" ...

@NotNull Bean Validation ignored for viewParam

可紊 提交于 2019-12-06 16:22:21
Problem I'm trying to validate a mandatory GET request parameter. In the view I've added a corresponding viewParam tag. <f:metadata> <f:viewParam name="customerId" value="#{customerDetailBean.customerId}"/> </f:metadata> And my CDI bean looks like this @Model public class CustomerDetailBean { @NotNull private Integer customerId; public Integer getCustomerId() { return customerId; } public void setCustomerId(Integer customerId) { this.customerId = customerId; } } When I use the following request, validation works fine and the expected validation message is displayed. http://localhost:8080

Redirect if a f:viewParam is empty

北战南征 提交于 2019-12-05 12:29:10
Сan I do a redirect (or error) if a f:viewParam is empty? <f:metadata> <f:viewParam name="accountId" value="#{accountMB.id}"/> </f:metadata> When I add required="true" , nothing happens. What are the options? BalusC When I add required="true" , nothing happens You need <h:message(s)> to show faces messages associated with a given (input) component. You probably already know how to do that for <h:inputText> . You can do exactly the same for <f:viewParam> . <f:metadata> <f:viewParam id="foo" ... required="true" /> </f:metadata> ... <h:message for="foo" /> Сan I do a redirect (or error) if a f

includeViewParams=true converts null model value to empty string in query string

余生颓废 提交于 2019-12-01 15:20:37
问题 Given a <p:selectOneMenu> as follows. <f:metadata> <f:viewParam name="id" value="#{testManagedBean.id}" converter="javax.faces.Long"/> </f:metadata> <p:selectOneMenu value="#{localeBean.language}" onchange="changeLanguage();"> <f:selectItem itemValue="en" itemLabel="English" /> <f:selectItem itemValue="hi" itemLabel="Hindi" /> </p:selectOneMenu> <p:remoteCommand action="#{testManagedBean.submitAction}" name="changeLanguage" process="@this" update="@none"/> The corresponding managed bean :

Navigate to other view passing a parameter

笑着哭i 提交于 2019-11-30 19:03:45
问题 My current environment is JRE 1.7, JSF 2.2, Eclipse Luna. In a certain page ( entity_index.xhtml ) of my application I have the following (PrimeFaces) button: <p:commandButton value="Details" action="entity_details" ajax="false" onclick="this.form.target='_blank'"> <f:param name="id" value="#{entity.id}" /> </p:commandButton> The idea is to provide a button so the user can click it and some details on the current entity will be shown in another browser tab (page entity_details.xhtml ). This

JSF 2.0 view parameters to pass objects

廉价感情. 提交于 2019-11-30 16:31:16
I am trying to pass an object from one page to another page where each page is in a different view. On the first page I have an input text, where myBean is a ViewScoped Bean and name is an object. <h:inputText value="#{myBean.name}"/> The second page contains, <f:metadata> <f:viewParam name="userId" value="#{myBean.name}"/> </f:metadata> I get the error Conversion Error setting value mypackage.myBean@257100b' for 'null Converter'. Can we pass objects other than String values to view parameters? Yes, you can. You just have to supply a converter which converts between the string representation

JSF 2.0 view parameters to pass objects

拟墨画扇 提交于 2019-11-30 16:20:22
问题 I am trying to pass an object from one page to another page where each page is in a different view. On the first page I have an input text, where myBean is a ViewScoped Bean and name is an object. <h:inputText value="#{myBean.name}"/> The second page contains, <f:metadata> <f:viewParam name="userId" value="#{myBean.name}"/> </f:metadata> I get the error Conversion Error setting value mypackage.myBean@257100b' for 'null Converter'. Can we pass objects other than String values to view

JSF ViewParam Required +AJAX breaks page

我的未来我决定 提交于 2019-11-30 14:42:46
When I click the command button on the page below navigations fails. (Clicking on the button refreshes the page, removes the URL parameter and displays the required error message instead of navigating to the index page) However if I remove the required attribute OR I remove the f:ajax tag the navigation works fine. Using com.sun.faces JSF 2.1.13 and primefaces 3.4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com

The metadata component needs to be nested within a f:metadata tag. Suggestion: enclose the necessary components within <f:metadata>

柔情痞子 提交于 2019-11-30 05:58:02
问题 I went through different sources like: Error saying I need to use f:metadata even though I do http://docs.oracle.com/javaee/7/javaserverfaces/2.2/vdldocs/facelets/f/metadata.html and it seems to be issue has been fixed in jsf 2.2.1, where as When I tried to use, I am facing issue, below are my configurations: template.xhtml: <!DOCTYPE html> <html lang="#{languageBean.language}" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:h="http://xmlns.jcp.org/jsf/html"