facelets

JSF 2: how to pass an action including an argument to be invoked to a Facelets sub view (using ui:include and ui:param)?

徘徊边缘 提交于 2019-11-27 13:50:22
This is basically an extension to this answer . I am trying to get an argument into a method/action call (for a delete button in a list/data table). Client: <ui:include src="..."> <ui:param name="acceptButtonBean" value="#{repoHome}" /> <ui:param name="acceptButtonAction" value="removeIndividualDocument(#{doc.id})" /> </ui:include> Sub view: <h:commandButton value="Continue" action="#{acceptButtonBean[acceptButtonAction]}" /> ... </h:commandButton> However, JSF fails with an exception saying: ...yadda, yadda 02:46:02,431 ERROR [stderr] (http--127.0.0.1-8080-5) Caused by: javax.el

Spring MVC with multiple view resolvers

懵懂的女人 提交于 2019-11-27 13:49:06
I tried to use 2 view resolvers: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www

how to share a jsf error page between multiple wars

僤鯓⒐⒋嵵緔 提交于 2019-11-27 13:41:33
I'm trying to share an error page (error.xhtml) between multiple wars. They are all in a big ear application, and all use a common jar library, where I'd like to put this. The error page should use web.xml, or better web-fragment.xml, and would be declared as a standard java ee error page. Actual EAR structure: EAR EJB1 EJB2 WAR1 (using CommonWeb.jar) WAR2 (using CommonWeb.jar) WAR3 (using CommonWeb.jar) Just putting the error page under META-INF/resources won't work, as it's not a resource. I'd like to have as little as possible to configure in each war file. I'm using Glassfish 3.1, but

How to get selected row index in JSF datatable?

元气小坏坏 提交于 2019-11-27 13:28:11
问题 I have a databale on index.xhtml <h:dataTable style="border: solid 2px black;" value="#{IndexBean.bookList}" var="item" binding="#{IndexBean.datatableBooks}"> <h:column> <h:commandButton value="Edit" actionListener="#{IndexBean.editBook}"> <f:param name="index" value="#{IndexBean.datatableBooks.rowIndex}"/> </h:commandButton> </h:column> </h:dataTable> My bean: @ManagedBean(name="IndexBean") @ViewScoped public class IndexBean implements Serializable { private HtmlDataTable datatableBooks;

Redirecting on session timeout in JSF-Richfaces-facelet

こ雲淡風輕ζ 提交于 2019-11-27 13:22:31
I am using JSF with RichFacecs to create a web portal .I want to redirect the user to the login page on session time out. I was trying to throw a SecurityException in session expiry/logged out stage as follows <error-page> <exception-type>java.lang.SecurityException</exception-type> <location>/Login.jsf</location> </error-page> But this is not working for me. Which is the right way of handling this ? This should do it : <error-page> <exception-type>javax.faces.application.ViewExpiredException</exception-type> <location>/sessionExpired.jsf</location> </error-page> Oscar Castiblanco you should

JSF and automatic reload of xhtml files

☆樱花仙子☆ 提交于 2019-11-27 13:08:49
I had some problems with hot-reloading XHTML files using JRebel, Spring, JSF Mojarra 2.0.3 and WebLogic 10.3. JRebel reloads regular Java classes and js/css files under /WebContent successfully, but not JSF's .xhtml files. A full republish was necessary to get xhtml files updated on the server. By trial and error I finally got it to work by adding some facelets parameters to web.xml and creating a custom ResourceResolver as described in this blog post . However, I wonder WHY this works, and more specifically: Why is a custom ResourceResolver needed? Isn't JRebel supposed to handle this by

How to include JavaScript files by h:outputScript? [duplicate]

一笑奈何 提交于 2019-11-27 12:52:37
This question already has an answer here: How to reference CSS / JS / image resource in Facelets template? 4 answers I want to use jQuery Validate plugin with JSF for client side form validation. I am finding basic difficulty in importing the resources. In my JSF page I have <h:outputScript library="js" name="jquery-1.6.2.js"></h:outputScript> <h:outputScript library="js" name="jquery.validate.js"></h:outputScript> <h:outputScript library="js" name="jquery.maskedinput.js"></h:outputScript> <h:outputScript library="js" name="myapp.validate.js"></h:outputScript> When I click on the script tab in

JSF 2.0: How to skip JSR-303 bean validation?

此生再无相见时 提交于 2019-11-27 11:59:44
问题 How to skip JSR-303 Bean validation with JSF, when a button is clicked? A bit lengthy question to explain a few approaches... Consider a list in a form: <h:form id="form"> <h:commandButton value="Add row"> <f:ajax execute="foo" listener="#{bean.add()}" render="foo" /> </h:commandButton> <h:dataTable id="foo" var="foo" value="#{bean.foos}"> <h:column> Name: <h:inputText id="field" value="#{foo.name}" required="true" /> <h:messages for="field" /> </h:column> <h:column> <h:commandButton value=

How do I insert non breaking space character   in a JSF page?

▼魔方 西西 提交于 2019-11-27 10:04:36
问题 How do I insert a non breaking space character in JSF page like I can in HTML using   ? Is there such a tag in JSF? 回答1: this will work <h:outputText value=" " /> 回答2: Putting the HTML number directly did the trick for me:   回答3: If your using the RichFaces library you can also use the tag rich:spacer which will add an "invisible" image with a given length and height. Usually much easier and prettier than to add tons of nbsp;. Where you want your space to show you simply add: <rich:spacer

Facelets repeat Tag Index

核能气质少年 提交于 2019-11-27 09:59:44
问题 Does anyone know a way to get the index of the element in a ui:repeat facelets tag? <ui:repeat id="topTenGrd" var="dream" value="#{dreamModifyBean.topDreams}"> <h:outputText class="dream-title uppercase" value="#{dream.number}. #{dream.title}" /> </ui:repeat> 回答1: Specify a value for the "varStatus" attribute: <ui:repeat id="..." var="..." value="..." varStatus="myVarStatus"> You can then access the loop index via EL: #{myVarStatus.index} Additionally, the following properties are available