jsf-2

h:commandButton multiple actions: download file and render ajax table

余生长醉 提交于 2019-12-29 01:21:11
问题 I currently have 2 command buttons and one listbox. Based on listbox selection, the result generated can be shown in a download-able file or rendered as an HTML table. The getFile() code is based on BalusC's PDF Handling tutorial, while getTable() sets resultTable . <h:form> <fieldset> <h:selectManyListbox id="listbox" value="#{form.items}"> <f:selectItems value="#{form.allItems}"> </h:selectManyListbox> </fieldset> <h:commandButton value="Get File" action="#{form.getFile}"> <h:commandButton

h:commandButton multiple actions: download file and render ajax table

坚强是说给别人听的谎言 提交于 2019-12-29 01:21:00
问题 I currently have 2 command buttons and one listbox. Based on listbox selection, the result generated can be shown in a download-able file or rendered as an HTML table. The getFile() code is based on BalusC's PDF Handling tutorial, while getTable() sets resultTable . <h:form> <fieldset> <h:selectManyListbox id="listbox" value="#{form.items}"> <f:selectItems value="#{form.allItems}"> </h:selectManyListbox> </fieldset> <h:commandButton value="Get File" action="#{form.getFile}"> <h:commandButton

How to pass additional parameters in ajax request on change value in h:selectOneMenu?

╄→尐↘猪︶ㄣ 提交于 2019-12-29 00:36:51
问题 I need to pass some parameters (id in my example) to f:ajax listener method, but i don't know how. Anybody help ? <h:form> <!-- need to pass id value --> <input type="hidden" name="id" id="id" value="#{id}"/> <h:selectOneMenu value="#{visibility}"> <f:selectItems value="#{visibilities}" var="e" itemValue="#{e}" itemLabel="#{e.name}" /> <f:ajax event="valueChange" render="@form" execute="@form" listener="#{bean.updateVisibility}" /> </h:selectOneMenu> </h:form> Bean: class Bean { Integer id;

How to pass additional parameters in ajax request on change value in h:selectOneMenu?

送分小仙女□ 提交于 2019-12-29 00:36:28
问题 I need to pass some parameters (id in my example) to f:ajax listener method, but i don't know how. Anybody help ? <h:form> <!-- need to pass id value --> <input type="hidden" name="id" id="id" value="#{id}"/> <h:selectOneMenu value="#{visibility}"> <f:selectItems value="#{visibilities}" var="e" itemValue="#{e}" itemLabel="#{e.name}" /> <f:ajax event="valueChange" render="@form" execute="@form" listener="#{bean.updateVisibility}" /> </h:selectOneMenu> </h:form> Bean: class Bean { Integer id;

FullAjaxExceptionHandler does not show session expired error page on ajax button

我的梦境 提交于 2019-12-28 18:45:29
问题 I have implemented Omnifaces FullAjaxExceptionHandler but the problem is It is not working with ajax requests. After session expires when I click to non-ajax button, It works well. It redirects user to custom error page. But if the button uses ajax, It doesn't do anything. Page just stucks. Edit: I have changed ActionListener to Action and still same. Edit2: It gives no error. Neither Apache Tomcat output nor Apache Tomcat Log. here is my spring security; <http auto-config='true' use

FullAjaxExceptionHandler does not show session expired error page on ajax button

こ雲淡風輕ζ 提交于 2019-12-28 18:45:29
问题 I have implemented Omnifaces FullAjaxExceptionHandler but the problem is It is not working with ajax requests. After session expires when I click to non-ajax button, It works well. It redirects user to custom error page. But if the button uses ajax, It doesn't do anything. Page just stucks. Edit: I have changed ActionListener to Action and still same. Edit2: It gives no error. Neither Apache Tomcat output nor Apache Tomcat Log. here is my spring security; <http auto-config='true' use

Filter do not initialize EntityManager

烈酒焚心 提交于 2019-12-28 18:44:07
问题 I trying to use the Open Session in View pattern, but everytime I try to catch the EntityManager in my ManagedBean the entityManager come NULL here is how I'm doing: package filters; // imports.. public class JPAFilter implements Filter { private EntityManagerFactory factory; @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { EntityManager entityManager = this.factory.createEntityManager(); request

h:selectOneMenu onchange=“submit()” immediate=“true” does not skip validation of other inputs

只愿长相守 提交于 2019-12-28 16:02:17
问题 I can't set my h:selectOneMenu to submit immediately without validating other inputs. Here is the code: <h:selectOneMenu value="#{a.avalue}" onchange="submit()" immediate="true"> <f:selectItems value="#{b.bvalue}" var="k" itemLabel="#{k.asdad}" itemValue="#{k.asdad}"/> </h:selectOneMenu> <h:inputText id="sada" value="#{c.cvalue}" required="true" requiredMessage="*asdadadadasd" validatorMessage="*asdsadadadadad"> <f:validateLength maximum="80"/> </h:inputText> When I change the menu value, the

How get GET parameters with JSF2? [duplicate]

旧街凉风 提交于 2019-12-28 15:21:45
问题 This question already has answers here : How do I process GET query string URL parameters in backing bean on page load? (3 answers) Closed 4 years ago . I have this url for example: http://example.com?parameter=content When the user click in this link, then I should be able to get the parameter value which is 'content'. I was reading BalusC tutorial but is JSF 1.2 and I'm learning with JSF 2. How could I do that? 回答1: Two ways (both examples assume that the parameter name is parameter as in

NumberFormatException for input String [duplicate]

落花浮王杯 提交于 2019-12-28 15:12:39
问题 This question already has answers here : Showing Hibernate/JPA results in JSF datatable causes: java.lang.NumberFormatException: For input string: “[propertyname]” (2 answers) Closed 4 years ago . I have the following method in a JSF backing bean: public List<Rent> getTopMemebers(){ return rentDAO.findByMonthAndYear(MonthReport, YearReport); } I am displaying this in a datatable: <p:dataTable value="#{rentController.topMemebers}" var="item"> <p:column> <h:outputText value="#{item.rentid}"/> <