jsf-2

Add Resource Bundles Programmatically

橙三吉。 提交于 2020-01-02 19:27:49
问题 I have a faces-config.xml file with some resource bundles declared, like this: <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" version="2.0"> <application> <locale-config> <default-locale>en</default-locale> <supported-locale>de</supported-locale> <supported-locale>es</supported-locale> <supported-locale>pt</supported

Make JSF 2.0 execute methods as they are assigned to params, not store reference to method?

夙愿已清 提交于 2020-01-02 18:36:50
问题 Before I begin, my apologies if the wording of this question's title is confusing. I hope my explanation here will make it much clearer. In a JSF template of my application, I want to include another template and pass a parameter to it that holds the results of an application method. In this parent template, I have: <ui:repeat var="loopObject" value="#{ApplicationBean.objectList}"> <ui:include src="anotherTemplate.xhtml"> <ui:param name="firstParam" value="#{ApplicationBean

Redirect after logout fails with java.lang.IllegalStateException: Cannot create a session after the response has been committed

回眸只為那壹抹淺笑 提交于 2020-01-02 14:47:15
问题 I have a JSF2 application. I have a login bean which is session scoped and a logout bean which is view scoped. When I login I use redirect and it works fine. However the logout fails with redirect. If I logout without redirect it works. @ManagedBean @ViewScoped public class MbLogout extends BaseJsf { private static final long serialVersionUID = 2992671241358926373L; public String logout() throws DfException { getFacesContext().getExternalContext().invalidateSession(); //return "login?faces

FaceletContext is Null

假装没事ソ 提交于 2020-01-02 13:31:46
问题 I have a JSF 2.0 project that I am unable to obtain a FaceletContext from. Here is the setup from my web.xml: <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <context-param> <param-name>javax.faces.PROJECT_STAGE</param-name> <param-value>Development</param-value> </context-param> <context-param> <param-name>facelets.DEVELOPMENT</param-name> <param-value>true</param-value> <

Empty input value does not triggger @NotNull but it triggers @NotBlank

▼魔方 西西 提交于 2020-01-02 10:31:18
问题 i have this entity: import javax.validation.constraints.NotNull; import org.hibernate.validator.constraints.NotBlank; @Entity @XmlRootElement @Table public class Supplier extends AbstractEntity { @Column @NotNull private String name; @Column @NotBlank private String representative; ... } and this jsf form: <h:form> <p:commandButton value="save" action="#{supplierController.create}" ajax="false"/> <h:panelGrid columns="3" cellpadding="4"> <h:outputLabel value="#{bundle['Name']}" for="name"/>

How can a custom-validator know which commandButton was clicked

此生再无相见时 提交于 2020-01-02 10:26:08
问题 my form has several "submit" buttons, and the validation of some of the fields depends on which was pressed. How can I find that out in my custom validator? 回答1: The button's client ID get also generated as name of the <input type="submit"> . The name=value of the pressed <input type="submit"> get also sent as request parameters. So you could just check for that in the request parameter map. E.g. <h:form id="formId"> ... <h:commandButton id="button1" ... /> <h:commandButton id="button2" ... /

JSF facelet app not working in jboss AS 7

断了今生、忘了曾经 提交于 2020-01-02 09:27:54
问题 I am trying to set up environment for Java/JSF app in my windows 7 machine. I am using eclipse juno with Jboss AS 7 downloaded from the eclipse market. Also I am using JDK 1.7. I created a very simple app containing just a h:outputLabel tag. Everything looks fine until deployed and run, but the tag doesn't render. What I mean to say is that I am getting a blank page. The jars I included for JSF are : jsf-api-2.1, jsf-impl-2.1.0-b03.jar,jsf-facelets-1.1.14.jar. And the usual commons and jstl

How to get id of current component in EL

空扰寡人 提交于 2020-01-02 08:16:10
问题 I'm working with JSF and PrimeFaces, but I need to get the value of the id of a component. Because I'm building dinamycally panels with diferent id, to show a the panel I need to compare if is the current panel, then show it. For example if I've the next panel <p:outputPanel id="#{bean.getID}" autoUpdate="true" renderer=#{@this.id == bean.currentPanel} > </p:outputPanel> And Bean public class Bean(){ private int numberPanels =0; private int currentPanel = 0; public int getID(){ //...a process

JSF 2.0 request.getParameter return a string with wrong encoding

戏子无情 提交于 2020-01-02 07:58:49
问题 I'm writing an application in JSF 2.0 which supports many languages, among them ones with special characters. I use String value = request.getParameter("name") and POST method, the page encoding is set to UTF-8 and the app is deployed on apache tomcat 6 which has the connector set correctly to utf-8 in a server.xml file: <Connector URIEncoding="utf-8" connectionTimeout="20000" port="8088" protocol="HTTP/1.1" redirectPort="8443"/> Yes I get strange results like ä for example in place of

how to pass the parameter during file upload in primefaces [duplicate]

一笑奈何 提交于 2020-01-02 07:41:03
问题 This question already has an answer here : Pass value of another input component when uploading file via p:fileUpload mode=advanced (1 answer) Closed 3 years ago . I am using jsf2.0 with primfaces and using p:fileupload for uploading the photo..Here i need to pass the parameter in backing bean. In that there is no option for passing parameter through p:fileupload.. i was used the binding option also,but it returns the null value on backing bean... here is my fileupload.xhtml <h:form enctype=