viewparams

JSF ViewParam Required +AJAX breaks page

巧了我就是萌 提交于 2019-11-29 21:12:12
问题 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

How to use view-params with JSP?

筅森魡賤 提交于 2019-11-29 18:05:34
I would like to use view parameters to get bookmarkable URLs with JSF 2, but I use JSPs and all the help and examples I can find, uses facelets. Here is want I have done so far: search.jsp (calling page): <t:commandLink action="..."> <f:param name="param1" value="foo"/> <h:outputText value="..."/> </t:commandLink> faces-config.xml: <navigation-rule> <navigation-case> <from-outcome>go_edit</from-outcome> <to-view-id>/views/edit.jsp</to-view-id> <redirect> <view-param> <name>param1</name> <value>#{edit.param1}</value> </view-param> </redirect> </navigation-case> </navigation-rule> Edit.java

Automatically include view parameters in URL

不羁岁月 提交于 2019-11-29 02:19:00
I have simple jsf page with view params and load method which is processing those params: <f:metadata> <f:viewParam name="param1" value="#{bean.param1}"/> <f:viewParam name="param2" value="#{bean.param2}"/> <f:viewParam name="param3" value="#{bean.param3}"/> <f:event type="preRenderView" listener="#{bean.load()}"/> </f:metadata> I also set some initial values in @PostConstruct . How to redirect user to new location that include those parameters (which are not null). For example user enter in browser: domain.com/page.jsf and is redirected to: domain.com/page.jsf?param1=valueA because param1 was

JSF bean: call @PostConstruct function after ViewParam is set

匆匆过客 提交于 2019-11-29 01:56:41
I have a product.xhtml and a ProductBean. I use /product/{id} to access the products so I have a viewParam in product.xhtml with value=ProductBean.id. The problem is that inside the bean I use an init function with a PostConstruct annotation in order to fill the details of the product. To do this I need the id to call an external function. I guess though that init is called before viewParam sets the id of the bean and therefore inside init I cannot call the external function because id is not set yet. What am I doing wrong and how do I fix this? UPDATE I found what was wrong. I think the

View-scoped bean recreated on POST when URL parameters not used

为君一笑 提交于 2019-11-28 13:48:18
I have a view-scoped JSF-managed bean that's backing an xhtml view where I read one parameter from the URL using f:viewParam . The view presents a form to the user. However, when the user submits the form by pressing the p:commandButton it seems that the view-scoped bean is recreated (I added a @PostConstruct annotation to verify this) and so doesn't remember the instance variable read from the f:viewParam ( invId in the code below). I originally navigate to the view with a GET that includes a URL parameter but the POST message that's send when the user presses the p:commandButton doesn't

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

白昼怎懂夜的黑 提交于 2019-11-28 11:22:11
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" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:c="http://xmlns.jcp.org/jsp/jstl/core" xmlns:fn=

How to retain f:viewParam values after postback with validation failed [duplicate]

纵饮孤独 提交于 2019-11-28 04:37:12
问题 This question already has an answer here: Retaining GET request query string parameters on JSF form submit 2 answers I have xhtml page with simple form. This page is using for several data tables. To specify data table (and so on), I use GET request parameters. xhtml page receive it through <f:metadata> <f:viewParam id="page" name="page" value="#{itemsBean.page}"/> </f:metadata> and pass again by the navigation rules like <navigation-case> <description> Global rule for going to the items page

JSF bean: call @PostConstruct function after ViewParam is set

烂漫一生 提交于 2019-11-27 21:45:43
问题 I have a product.xhtml and a ProductBean. I use /product/{id} to access the products so I have a viewParam in product.xhtml with value=ProductBean.id. The problem is that inside the bean I use an init function with a PostConstruct annotation in order to fill the details of the product. To do this I need the id to call an external function. I guess though that init is called before viewParam sets the id of the bean and therefore inside init I cannot call the external function because id is not

Automatically include view parameters in URL

青春壹個敷衍的年華 提交于 2019-11-27 16:49:24
问题 I have simple jsf page with view params and load method which is processing those params: <f:metadata> <f:viewParam name="param1" value="#{bean.param1}"/> <f:viewParam name="param2" value="#{bean.param2}"/> <f:viewParam name="param3" value="#{bean.param3}"/> <f:event type="preRenderView" listener="#{bean.load()}"/> </f:metadata> I also set some initial values in @PostConstruct . How to redirect user to new location that include those parameters (which are not null). For example user enter in

f:viewParam doesn't pass required parameter when new xmlns.jcp.org namespace is used

萝らか妹 提交于 2019-11-27 15:47:58
I am trying to use Glassfish 4.0 with Java EE 7 XML namespaces to test the sample below. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:f="http://xmlns.jcp.org/jsf/core"> <h:head> <title>Title</title> </h:head> <h:body> <h:form> <ul> <ui:repeat value="#{appLoad.movieList}" var="movie"> <li> <h:link value="#{movie.title}" outcome="movie" includeViewParams="true"> <f:param name="id" value="#{movie.id}"/> </h:link> </li> </ui:repeat> </ul> </h:form> </h:body> </html> It links to the following page movie.xhtml :