jsf-2

Display user info on postback from protected pages in JSF 2.0

做~自己de王妃 提交于 2019-12-11 07:39:46
问题 I have a JSF app with a div on the left that displays the user name of logged in User on the main page. I store the logged in users info in a sessionScoped managed bean. I have couple of protected pages on the main page for which I use container managed JDBC realm. If the user directly clicks on the links without logging in , container managed security kicks in and asks the user to Log in , which is fine. Now if the user hits the back button , the browser displays the main page . Now how do I

PrimeFaces data table In-Cell Editing : I can't get the edited object

*爱你&永不变心* 提交于 2019-12-11 07:38:09
问题 I'm experimenting with DataTable - Cell Editing as shown in PrimeFaces showcase. I've modified the Facelets code as consequence of this question: primefaces in-cell-editing not update data in database because the <p:ajax event="cellEdit"> didn't update the entire data table. <h:form id="form"> <p:outputPanel id="testContainer" deferred="true"> <p:growl id="messages" showDetail="true" /> <p:remoteCommand name="onCellEdit" action="#{articlesbean.onCellEdit()}" update=":form:messages" /> <p

How to retrieve a session scoped managed bean in a PhaseListener?

血红的双手。 提交于 2019-12-11 07:35:29
问题 I'm having troubles in setting an Authorization Listener (that implements PhaseListener) to manage authentication and autorization. More specifically, I set a session scoped bean called SessionBean: @ManagedBean @SessionScoped public class SessionBean{ private String loggedUser; public SessionBean(){ logger.info("Sono nel costruttore di SessionBean()"); } public String login(){ .... } ... } And in my sun-web.xml: <managed-bean> <managed-bean-name>SessionBean</managed-bean-name> <managed-bean

How to handle specific namespace declaration in JSF template

橙三吉。 提交于 2019-12-11 07:35:27
问题 I have a master template that are used by all the other pages. Imagine that I some of pages that are using PrimeFaces components, and some are using facelets. At the moment I have to declare all the namespaces in the master template like this: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"> This means that the pages without PrimeFaces

rich:calendar and “The class 'java.lang.String' does not have the property …” error

别等时光非礼了梦想. 提交于 2019-12-11 07:31:41
问题 I have the following situation: Interface public interface Ranged{ public Object getRangeStart(); public Object getRangeEnd(); public void setRangeStart(Object rangeStart); public void setRangeEnd(Object rangeEnd); public void setRange(boolean isRange); public boolean getRange();} implementing class: public class CreationDateRange implements Ranged, Serializable{ private static final long serialVersionUID = SerialVersionUID.getSerialVersionUID(); public DateRange() { super(); } private Date

JSF - Two Questions about actions on UIComponent

自闭症网瘾萝莉.ら 提交于 2019-12-11 07:28:58
问题 So, let me show us my troubles :) 1 - When i click on a commandbutton <h:commandButton value="Somethings"> <f:setPropertyActionListener target="#{bean.method}" value="some" /> <f:ajax render="rendering"/> </h:commandButton> I dont do any action to the commandButton . Just i fire the ajax call. If i add an action on the button (like action="bean.myAction ) it will be executedat the 5° phase of the JSF lifecycle (allright, only if i write event="action" in the f:ajax, but thats as default).

How to ignore validation in HDIV when integrating with primefaces datatable component

给你一囗甜甜゛ 提交于 2019-12-11 07:28:47
问题 I am using Primefaces Datatable component. This data table component creates a hidden field dynamically on the browser. <input type="hidden" id="formId:activitydescription_selection" name="formId:activitydescription_selection" autocomplete="off" value="" /> The Primefaces datatable code is as follows <p:dataTable id="activitydescription" var="type" value="#{activityBean.activityList}" rows="#{activityBean.rowNo}" rowKey="#{type.activitySchemeId}" selection="#{activityBean.activityDTO}"

JSF 2 , Primefaces 4.0. p:dataTable sorting using complex sortBy expression

点点圈 提交于 2019-12-11 07:22:34
问题 Suppose you have bean which holds cars table model, let's call this bean carManager. Let's assume that there exists another bean, which can take cars table model element and get proper translation based on selected language, let's call that bean carProcessor. So, now we can make a data table like this: <p:dataTable var="car" value="#{carManager.tableModel}"> <p:column headerText="Car name" sortBy="#{carProcessor.getCarTranslateByLanguageId(car.data, carManager.selectedLanguage.id).name}"> <h

Validating one form with multiple tabs, how to switch tabs without losing validation errors? Using Myfaces and Trinidad

丶灬走出姿态 提交于 2019-12-11 07:20:09
问题 I have 1 very long form that needs to be split into pieces, but it is submitted and validated as one. I have split it into tr:panelTabbed sections each of which displays a set of fields. The validation messages are displayed currectly in the first tab but if one of the other tabs is checked its' validation messages are not displayed. Tabbing back to the original, its' validation messages are also not displayed. Is there any way around this? It looks like the tab interface only generates 1 tab

What's the convenient way to destroy @SessionScoped?

倾然丶 夕夏残阳落幕 提交于 2019-12-11 07:16:01
问题 My problem is te data is not refresh in the datatable. I want to destroy the session scoped when I clicked to the item in the menu.I know that it's possible with Viewscoped but I want to learn other way. Thank in advanced. Controller: @ManagedBean @SessionScoped public class MyController implements Serializable { //getters and setters ........... } Menu: <td><h:outputLink styleClass="itemOutputLink" value="# {request.contextPath}/pages/page.faces">Page1</h:outputLink></td>` 回答1: There is no