jsf-2

Accessing one managed bean from another

℡╲_俬逩灬. 提交于 2019-12-23 02:31:46
问题 I have a simple authorization page which intends the user to type login and password. Based on the results of user input, I define the next page to display. I have a table in db that contains id, user's login and password, and user's role, so the next page will be defined based on information that will be retrieved from the role field of the record which corresponds to inputed login and pass. But also I have a table in db which contains all of the user's info(about 10 fields) of one type of

exclude component from process when form is submited (works in h:panelGrid but not in p:panelGrid)

ⅰ亾dé卋堺 提交于 2019-12-23 02:18:33
问题 Q: What syntax should i use to exclude a component when submitting a form using primefaces? Using the process attribute i know how to include components. <h:inputText id="included"/> <p:commandButton value="button" process="included" actionListener="#{myBean.doStuff}/> I've been trying to play around with syntax similiar to what is used in the answer here: How to exclude child component in ajax update of a parent component? but cant get it to work <h:inputText id="notIncluded" styleClass=

can i use FixViewState.js from omnifaces with richfaces' a4j:ajax (RF4+JSF2.2/mojarra)

北城以北 提交于 2019-12-23 02:01:35
问题 I use the great omnifaces 1.7 workaround FixViewState in order to fix the following issue: viewstate and ViewScope gets lost on ajax render="@form" . The workaround seems to work fine with f:ajax but not with a4j:ajax (richfaces). Is the fix supposed to work with richfaces out-of-the-box? (richfaces version is 4.3.5) maybe related issue logged by a4j:log: error[15:09:31.667]: [status=200] During update: javax.faces.ViewState not found Thanks! 回答1: Tl;dnr: Richfaces-4.x is broken with JSF-2.2

selectManyMenu converter vs selectOneMenu converter

筅森魡賤 提交于 2019-12-23 01:52:16
问题 I have a converter for Album entity listed in selectOneMenu, what modifications are needed to use it with selectManyMenu if there is? A working example of converter to use with selectManyMenu is greatly appreciated. Converter for SelectOneMenu package converter; import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; import javax.faces.convert.ConverterException; import javax.faces

primefaces p:autocomplete selected value repeating in next row with datatable

泪湿孤枕 提交于 2019-12-23 01:29:13
问题 I have primefaces datatable which has 4 to 5 input components. One of the input is p:autocomplete. There is a option to add new row through UI, i have added first row later i am trying to add 2nd row whatever value selected in the first row it remains same in the 2nd row. Along with that if i choose different value in the 2nd through autocomplete that value is reflecting for both the rows. But i would like to retain the value which is selected for first row then i need to retain the 2nd row

selectOneMenu with complex objects, is a converter necessary? [duplicate]

家住魔仙堡 提交于 2019-12-23 01:12:37
问题 This question already has answers here : Conversion Error setting value for 'null Converter' - Why do I need a Converter in JSF? (2 answers) Closed 4 years ago . Is a Converter necessary for a <h:selectOneMenu> or <p:selectOneMenu> with arbitrary user-created classes as its values? I mean, is the following code supposed to work without a converter? <p:selectOneMenu value="#{bean.language}"> <f:selectItems value="#{bean.allLanguages}" /> </p:selectOneMenu> and @Named(value = "bean")

JSF: How to replace “\\” in a string

人走茶凉 提交于 2019-12-23 00:45:07
问题 Suppose I have the string text\\ , I need to replace \\ with / . I tried the following expression: /* str = "text\\" */ <h:outputText value="#{fn:replace(str, '\\', '/')}" /> But I always run into the following exception: Caused by: java.util.regex.PatternSyntaxException: Unexpected internal error near index 1 \ ^ at java.util.regex.Pattern.error(Pattern.java:1924) at java.util.regex.Pattern.compile(Pattern.java:1671) at java.util.regex.Pattern.<init>(Pattern.java:1337) at java.util.regex

ManagedProperty not working

时光毁灭记忆、已成空白 提交于 2019-12-22 18:44:12
问题 I have problem with JSF 2 property binding and honestly I hit a wall here.. What I want to accomplish is this: a request-scoped bean (loginBean) process login action and stores username in the session-scoped bean (userBean). I want to inject userBean into loginBean via @ManagedProperty, but when loginBean.doLoginAction is called, userBean is set to null. Here is the code: UserBean class import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; @ManagedBean @SessionScoped

How to save 2 dependent selectOneMenu values

青春壹個敷衍的年華 提交于 2019-12-22 18:05:25
问题 I'm running in a little issue here regarding jsf related dropdown selection. I have 2 dropdown selection: the first one is independent, the second one shows result depending from This is the code: <h:panelGroup id="addressPanel"> <h:outputLabel styleClass="label" value="Provincia: " /> <h:selectOneMenu onchange="updateCombos()" value="#{indirizzoCtrl.codiceProvincia}" > <f:selectItem itemValue="" itemLabel=""></f:selectItem> <f:selectItems value="#{indirizzoCtrl.allProvincia}" var="c"

How redirect the url from h:commandLink

倖福魔咒の 提交于 2019-12-22 18:02:15
问题 Do I remember right or the parameter immediate set to true should change the url of the browser? If it is correct, why doesn't this link works properly? <h:form> <h:commandLink immediate="true" action="/url_page.xhtml" value="Label link"/> </h:form> After some research I found a question where the author added the string "?faces-redirect=true" to the url... Is it work like I would? Should I set something else? Thank you for your help. P.S.: I tried also h:link but, perhaps, it doesn't execute