managed-bean

SelectOneMenu updates other SelectOneMenu

折月煮酒 提交于 2019-11-28 10:21:58
I want to update the second SelectOneMenu when I select any item of the first SelectOnMenu. As it is now, I get the values for the SelectOneMenus from a ManagedBean. I guess I've to use AJAX (jquery) to send parameters to the ManagedBean. <h:form> <div class="center"> <h:panelGrid id="editTable" columns="2" styleClass="center"> ... <h:outputText value="#{msg.timetable_list_category}" /> <h:selectOneMenu class="category"> <f:selectItems value="#{categoryBackingBean.categorys}" var="c" itemLabel="#{c.category_Name}" itemValue="#{c.id}" /> </h:selectOneMenu> <h:outputText value="#{msg.timetable

javax.el.PropertyNotFoundException: The class 'xxx' does not have a readable property 'yyy'

三世轮回 提交于 2019-11-28 08:15:09
问题 I've the below session scoped CDI managed bean: @Named @SessionScoped public class RegisterController implements Serializable { private static final long serialVersionUID = 1L; @Inject private MitgliedAbc mitgliedAbc; public MitgliedAbc getMitgliedABC() { return mitgliedAbc; } public void setMitgliedAbc (MitgliedAbc mitgliedAbc) { this.mitgliedAbc = mitgliedAbc; } } And the following input in a JSF form: <h:inputText value="#{registerController.mitgliedAbc.mgEmail}" /> When deploying to

How to use Spring services in JSF-managed beans?

。_饼干妹妹 提交于 2019-11-28 06:08:58
问题 JSF is very popular technology in Java world, however, cooperation with Spring is still painfull and requires 'nasty' hacks. I have currently the problem with one of this 'hacks'. Spring services are injected using the SpringBeanFacesELResolver . It is configured in faces-config.xml : <application> <el-resolver> org.springframework.web.jsf.el.SpringBeanFacesELResolver </el-resolver> </application> The injection of Spring services is very ugly, but it is working: @ManagedProperty(value="#

JSF messages persistance

风格不统一 提交于 2019-11-28 06:02:16
问题 I have a viewScoped bean which has some business logic validation. I display the resultant errors from this validation to the page using FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(severity, result, null)); The problem is: user submits invalid form form redisplayed, messages not displayed to user due to using PRG I solved this using the following line of code: FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(true); Now the problem is

Data from @RequestScoped bean is shared in different browsers

非 Y 不嫁゛ 提交于 2019-11-28 05:20:06
问题 I have a @RequestScoped bean with a List property. import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; import org.springframework.stereotype.Controller; @Controller @ManagedBean @RequestScoped public class MyBean implements Serializable { private List list; // getters and setters } This property is linked to a datatable: <ice:dataTable value="#{myBean.list}" ..other stuff.. /> The List is dynamically filled with no problem, and the datatable is displayed with no

Pass input text value to bean method without binding input value to bean property

末鹿安然 提交于 2019-11-28 04:40:27
Can I pass a input text field value to a bean method without binding the value to a bean property? <h:inputText value="#{myBean.myProperty}" /> <h:commandButton value="Test" action="#{myBean.execute()} /> Can I do this without doing temporary save in #{myBean.myProperty} ? BalusC Bind the component as UIInput to the view and use UIInput#getValue() to pass its value as method argument. <h:inputText binding="#{input1}" /> <h:commandButton value="Test" action="#{myBean.execute(input1.value)}" /> with public void execute(String value) { // ... } Note that the value is this way already converted

Listening to when the user session is ended in a JSF managed bean

China☆狼群 提交于 2019-11-28 01:21:20
Is it possible to do something like this: When a user session starts I read a certain integral attribute from the database. As the user performs certain activities in this session, I update that variable(stored in session) & when the session ends, then I finally store that value to the DB. My question is how do I identify using the JSF framework if the user session has ended & I should then store the value back to DB? Apart from the HttpSessionListener , you can use a session scoped managed bean for this. You use @PostConstruct (or just the bean's constructor) and @PreDestroy annotations to

Using JSF EL in a plain HTML attribute

十年热恋 提交于 2019-11-28 01:16:48
问题 Can we use JSF EL inside a HTML tag? For example, inside a plain HTML <td> element, can we use EL #{bean.color} for the bgcolor attribute? <td bgcolor="#{bean.color}"> 回答1: The answer depends on the JSF version and the view technology used. The technical term you're looking for is "using EL in template text" (i.e. not inside any tag/component). As per your question history you're using JSF 1.2 on Websphere. I assume that you're still using old JSP, the predecesor of Facelets. Whether JSF EL #

Why are expired @ViewScoped beans not destroyed until the session expires

回眸只為那壹抹淺笑 提交于 2019-11-28 01:08:27
I'm using Mojarra 2.2.4 on GlassFish 4 with Java 7. As I understand from BalusC's answer to How and when is a @ViewScoped bean destroyed in JSF? , @ViewScoped beans should be destroyed in three cases: Post-back with non-null outcome Session expiration Maximum number of logical views in session exceeded My beans are being destroyed in the first two cases, but not when the maximum number of logical views is exceeded. I have verified that the beans do expire when the maximum is exceeded (I get a ViewExpiredException), but they are still not destroyed until the session itself expires. For memory

Java singleton class vs JSF application scoped managed bean - differences?

痴心易碎 提交于 2019-11-28 01:03:48
Is there a difference using a singleton class and an application scoped managed bean to hold application data? I need to lookup certain JNDI ressources such as remote bean interfaces and therefore I wrote myself a singleton to cache my references and only allow single references. (ServiceLocator) I opened my website in two different browsers and that singleton got only initialized once. So I assume its application scope? Any other benefits of a application scope managed bean then being able to access its properties in jsf? BalusC Singletons are not unit testable nor abstractable nor extendable