jsf-2

Input text validation based on drop-down list selection

自闭症网瘾萝莉.ら 提交于 2019-12-24 00:50:01
问题 How can I validate an input text box based on a selection from the drop-down list? 回答1: You could pass the selected value of the dropdown as an attribute of the input component so that the validator can grab it. E.g. <h:selectOneMenu binding="#{menu}" value="#{bean.item}"> <f:selectItems value="#{bean.items}" /> </h:selectOneMenu> <h:inputText value="#{bean.input}"> <f:attribute name="item" value="#{menu.value}" /> <f:validator validatorId="inputValidator" /> </h:inputText> with

English error messages in JSF 2.0.3 (not validation)?

北慕城南 提交于 2019-12-24 00:46:28
问题 I had configured JSF 1.2 successfully to display English error messages that come from the server. Now I was making the transition to JSF 2.0, but the error messages seem to be back to German. Localized error messages are a real pain if you want to google up anything (I have no idea who decided localized error messages to be a good thing BTW!). Here's the faces-config.xml : <?xml version="1.0" encoding="UTF-8"?> <faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi=

<o:form styleClass> not rendered when using MyFaces instead of Mojarra

余生颓废 提交于 2019-12-24 00:42:43
问题 I've been developing a website with JSF2.0 TomEE 1.7.3. In the last question I've asked : What are the recommended JSF dependencies with TomEE1.7.x? I got advices and decided to migrate from GlassFish(Mojarra) Faces to myFaces, because myFaces is the standard JSF implementation of TomEE. Then I realized that "OmniFaces v1.8.3 Form" is not rendering css class attribute with "style" nor "styleClass", if I use the default myFaces of TomEE. It worked fine with Mojarra, but now I get my HTML

How to pass image from Applet to JSF backing bean

╄→гoц情女王★ 提交于 2019-12-24 00:35:22
问题 I am working with a web application in which there is a Java Applet that captures an image from a wacom device into a RenderedImage object. The applet itself is embedded into a JSF 2.0 page. I need to pass the created RenderedImage from Applet to a JSF backing bean so that it would be a part of a User object. My backing bean is view scoped. I'm really lost with this. I've been searching for a good example on how this goal can be achieved. Should I use JSObject , or should I send an image to a

How to make one field from two required at least with JSF/Primefaces

自古美人都是妖i 提交于 2019-12-24 00:27:21
问题 I'm using primefaces with jsf and i want to make one of two fields required at least. that means that the error message will be displayed if this two fields are empties togheter: this is a sample of my code: <h:outputLabel for="srcNumber" value="Originator MSISDN (EXAMPLE 32495959595)" /> <p:inputText id="srcNumber" value="#{cdrMmscRecBean.srcNumber}" label="srcNumber" /> <h:outputLabel for="destNumber" value="Destination MSISDN (EXAMPLE 32495959595)" /> <p:inputText id="destNumber" value="#

Bean Validation Through JPA Relationships

萝らか妹 提交于 2019-12-24 00:12:24
问题 I would like to use Bean Validation to annotate constraints in my entities , now the question is, will the relationships on the entities be validated as well?. For example suppose I have the following entities: @Entity @Table(name = "css_empresa") public class Empresa extends EntidadContactable implements Serializable, Convert { private static final long serialVersionUID = 1L; @Id @SequenceGenerator(name = "EMPRESA_ID_GENERATOR", sequenceName = ConstantesSecuencias.SEQ_EMPRESA)

JSF multiple views limit

杀马特。学长 韩版系。学妹 提交于 2019-12-24 00:07:23
问题 I've created a web application that opens up pages inside an iFrame on the main page. Each iFrame is viewable via a tab on the page and uses JSF2.2 with Mojarra view state beans to populate the page. This works fine when I open up something under 10 tabs; but when I try to open up more, the beans that held the first pages are destroyed and get recreated when I make any calls to the bean thus losing any prior changes the user may have made. I'm using Apache Tomcat 7 with Catalina, and this

jsf security-contraint to protect link when the user is not signed in?

非 Y 不嫁゛ 提交于 2019-12-24 00:07:08
问题 I have a JSF2 (GlassFish 3.0) application which security constraints defined (example below). My problem is, I have a "sign up" link that should not be accessible when the user is logged in. That is, if they try to hit "/signup.jsf" they should be able to access is if they are logged; so if the have any roles, they should not be able to see the page. Is there a way to do an "inverse" security constraint like that? Any suggestions are welcome, thanks! Rob Example constraint from my app, in

primefaces dialog not working

久未见 提交于 2019-12-23 23:00:08
问题 I am trying to replicate primefaces ajax dialog form as in Primefaces showcase My JSF code snippet is as below <h:body> <p:commandButton id="showDialogButton" type="button" value="Show" onclick="PF('dlg').show()" /> <p:dialog header="Enter FirstName" widgetVar="dlg" appendToBody="true" resizable="false"> <h:form id="form"> <h:panelGrid columns="2" style="margin-bottom:10px"> <h:outputLabel for="firstName" value="firstName:" /> <p:inputText id="firstName" value="#{backingBean.firstName}" /> <

JSF View- returning null on actions do not update the view

怎甘沉沦 提交于 2019-12-23 22:17:06
问题 i have read the post that have same problem as mine JSF ViewScope - returning null on actions do not update the view but it haven't worked for me cause i already use the h:commandLink in another page and its works perfectly but in this page it doesn't . this is the request Bean public class AddSectionBean { public String delete(String id) { try { HttpSession session = SessionUtil.getSession(); UserVO userVOCreater = (UserVO) session.getAttribute("userVO"); SectionsDao.getInstance()