page « Bean « JSF Q&A





1. How to set bean property value in jsf page?    stackoverflow.com

I have Facelet component and I have backing bean for it. When I include my component to some page I pass bean from page to my component:

<ui:include src="./WEB-INF/templates/myTemplate.xhtml">
    ...

2. JSF multiple backing beans on one page    stackoverflow.com

I have done some reading and playing and I still have some questions I was hoping someone might answer: So, can I use two or more backing beans in a single JSF ...

3. Using Session Bean provided data on JSF welcome page    stackoverflow.com

I use JSF managed beans calling EJB methods that are provide data from database. I want to use some data already on the welcome page of the application. What is the ...

4. How do I access a non-managed-bean class in JSF page?    stackoverflow.com

I am using facelets. I have one class:

public class foo{
    public static String foofookoo() {
        return "tookoofoopoo";
    }
}
How ...

5. page redirection problem via Bean in Js1.1    stackoverflow.com

I have a requested scoped managed bean, called AuthenticationBean. I am developing a smal application with a login module, user activation and deactivation. When I click on the activate or deactivate ...

6. @Intertceptors does not work for web bean for JSF page    stackoverflow.com

@Named
@ConversationScoped
@Interceptors(MyInterceptor.class)
public class BeanWeb implements Serializable {
    public String methodThrowException throws Exception() {
        throws new Exception();
    }
}

public class MyInterceptor ...

7. JSF, How to set a property in a different page/backing bean and then navigate to that page?    stackoverflow.com

I am using JSF 2.0 and attempting to pass values between different pages in my App. The setup is as follows: I have a page called userSelect that has a backing bean userSelectBacking. ...

8. In JSF1.2 is it possible to redirect to a bean before a page is rendered?    stackoverflow.com

I know that in Seam, we could write an xml file (if my jsf page is named index.jsf -> index.page.xml) that we could add there action execute="#{loginAction.checkIfBlaBla}" so that JUST BEFORE the ...

9. Between a jsf page and a managed bean, why the getter method is called twice    stackoverflow.com

I have a jsf page with a form has an outputtext in it. The value of outputtext component is called from a backing bean (or managed bean). I know when I ...





10. How do I load an image from a DB inside a JSF page using managed beans?    stackoverflow.com

I have a database with some images. Could anyone explain me how I could load an image in a JSF page? I already have a managed bean that converts an Image object ...

11. Managed Bean Per Page (JSF)    stackoverflow.com

Is it possible to have a managed bean created only on some pages i.e. bean != null on page1.faces and bean == null on other pages?

12. How to forward to another page in a managef bean constructor?    stackoverflow.com

How can I forward to another page inside the constructor of a backing bean? I don't want to use redirect.

13. Set bean property from JSF page    stackoverflow.com

I need to do very simple thing - pass current URL from JSF (2.0) page to the managed bean. This is needed to get URL of the login form which will ...

14. Setting the value for jsf InputSecret during page load from the managed bean    stackoverflow.com

I am creating a database setting jsf page which shows the value from the properties file during the page load. The users then updates the page and press submit and ...

15. how to choose JSF Bean Scope transfer data on one page with dialog?    stackoverflow.com

i have one trouble with beanscope in one page i know if i want redisplay in one page i can use viewscope but now i want get value form datatable pass from ...

16. How to call a method in the bean when a JSF page is requested?    stackoverflow.com

How to call a method in the bean when a JSF page is requested? Example I have a JSF page "MyPage.jsf" and its backend bean "MyBean" and it has a method "myMethod()". Is ...





17. Multiple pages in JSF not calling backing bean mutators    stackoverflow.com

I'm currently developing an additional page to an already existing website. Actually that part isn't really that important - the page performs it's own separate functions. Anyway, originally, this "page" consisted of ...

18. JSF CDI Bean initialization on every page access    stackoverflow.com

I'm currently learning about JSF 2.0 and i dont know how to initialize something in my CDI bean everytime a jsf page is accessed ? For example, let's say in my case, ...

19. JSF 1: execute bean method and set parameters for next page    stackoverflow.com

I'm new to JSF. What i want is to click on something and when i do i want to run a bean method AND send the request with GET so i can ...

20. Accessing bean methods from JSF 1.2 pages - hook life cycle? hack getters?    stackoverflow.com

I want to do something similar to this (in jsf 1.2):

<html> 
...
#{myObject.foreignKey(parentObject.primaryKey)}

<h:inputText value="#{myObject.myProperty}"/>
</html>
Or in other words: from the web page I want to set a value in an object when arriving ...

21. Reuse of multiple CDI @Named bean instances of the same class in a JSF page    stackoverflow.com

I'd like to use multiple instances of the same CDI Named bean in a JSF2 page. (Imagine I have a backing bean to access a contentmanager category, but I want to ...

22. JSF LInk to View Page    stackoverflow.com

I have a page with a data table. I want some of the items in the tables to be linked to a corresponding view page. For example, right now I have ...

23. JSR303 ConstraintValidator, how to show the message without an error page    stackoverflow.com

Im working with JSF 2.0 and Glassfish v3. I was testing the functionality of JSR303 bean validation, so I created a validator which implements ConstraintValidator and then annotate that ...

24. Injecting @Named managed bean into another reusing JSF page?    stackoverflow.com

I'm trying to reuse a jsf page by including using facelets into another jsf page, since this page will be used by a lot of other pages. But the problem is ...

25. JSF Page inputtext doesn't set property in bean    stackoverflow.com

My JSF login page doesn't set the property in my bean. This is the part of my Login.xhtml:

<h:form>
<h:outputLabel value="#{controllerBean.foutmelding}" id="foutmelding"></h:outputLabel><br />
<table width="50px" align="center">
    <tr>
     ...

26. How to execute a bean method before page is rendered?    stackoverflow.com

What is the best approach to execute a method in a bean before the JSF page using that bean is rendered? Update: I am trying to execute a method which would populate ...

27. Using JSF RequestScoped Bean for Confirmation Page    stackoverflow.com

I have a JSF page that loads a User and allows me to assign Roles to that particular User. The Backing Bean, AssignRolesBean is @RequestScoped, and I would like for ...

28. How to render JSF tags on html page from String field in a bean    stackoverflow.com

How can I render JSF tags like HTML tags? For example I have some html code in a string field:

<pre>String code = "example <br/> example";</pre>
If I use
<pre><h:outputText value="#{bean.code}" escape="false"/></pre>
I will get
<pre>example
example</pre>
Now I ...

29. Use same backing bean object with same value in two Different JSF page    stackoverflow.com

I have one jsf page and popup other jsf page from it. Now i get all value reset from backing bean in popup page. please help..

30. Form submit does not trigger action method on managedBean on a JSF 1.2 page with request paramaters    stackoverflow.com

I have a quite complicated request scoped JSF 1.2 managed bean with various methods and properties. Some of the properties are mapped to URL request parameters so that it can populate ...

31. Error handling page with backing bean problem with JSF/Facelets    stackoverflow.com

Following this solution I made an error page like this: In faces-config.xml

<error-page>
    <error-code>500</error-code>
    <location>/errore500.xhtml</location>
</error-page>

....

<managed-bean>
    <managed-bean-name>errore</managed-bean-name>
    <managed-bean-class>it.jlp.prometheus.modello.Errore</managed-bean-class>
   ...

32. How can I set a bean property when the page is loading in jsf?    stackoverflow.com

In my project, I am using myfaces 1.2, rich faces 3.3.3 and spring 2.5 for backing beans. I searched over Internet for this simple need all weekend but I couldn't managed ...

33. Initializng a Backing Bean With Parameters on Page Load with JSF 2.0    stackoverflow.com

I am trying to initialize a backing bean on page load. Already looked for many solutions, but most of them are using links,buttons or not having parameters at all. scenario: A customer logins ...

34. View scoped bean is instantiated twice on one page, if there is no redirect when going to page    stackoverflow.com

I have a page where I use @ViewScoped bean. On page I get data from the bean, and call action on it. Something like this:

<h:form>
  <h:dataTable value="#{partyBean.foundOrganisations}" var="party">
   ...

35. Bean Not Getting Invoked From JSF Page    stackoverflow.com

In my JSF page I have lots of other form elements along with a commandbutton. For some reason commandbutton's action my bean's method is not getting invoked. If I create a test ...

36. How to set bean values for JSF page    stackoverflow.com

I have a JSF page(page 1) which returns values from another JSF page (page 2) and values are passed to backing bean properly. In fact values are passed to bean in ...

37. How do I access a non-managed-bean class in JSF page?    stackoverflow.com

I'am using facelets. I have one class (no managed bean):

package User;

public class User {
    public static String getHello() {
        return "Hello";
 ...

38. JSF2, reloading a page from a ViewScoped bean without destroying the bean?    stackoverflow.com

I've got a little problem I'd like to solve. I use Apache Myface 2 with Tomahawk and Trinidad. Trinidad delivers its Dialog Framework to create Modal Dialogs... My problem is that after the Dialog ...

39. Managed bean property not maintained in the next page by @ManagedProperty    stackoverflow.com

I am new for JSF. In my project am using @ManagedBean, @RequestScoped. Am using 4 pages in my project. My problem was bean values not maintain in the second, third ...

40. How to get user name in session bean when redirected to error page?    stackoverflow.com

Can anyone tell me how to get user name in session bean correctly? In our application we do it by calling this method:

@Resource
private EJBContext _context;

private String getUserName() {
    ...

41. Does not redirect to new page specified in the managed bean    stackoverflow.com

I have recently started learning Java EE 6 and I could need some help. I have made a search.xhtml page that has a form, some fields and a commandbutton. The action ...

42. How to call Backing Bean method to fetch the request Header value from Incoming request and forward result to a JSF page    stackoverflow.com

My requirement is " Our users are Authenticated by External System using SSO". On successful authentication the external system returns header variables viz. userId, firstName, lastName etc to our System. Currently I ...

43. Execute a bean's method before it may be used in the JSF page    stackoverflow.com

A request scoped bean collects data, from all many other request beans & business logic. This bean is used through the EL expressions in the page but before this request scoped ...

44. JSF error in the page - not able get or set values to the bean    stackoverflow.com

I am to do a web application with JSF, just to get and put a value from the JSF to bean and vice versa. I think I have done everything properly ...

45. set default bean first start page    coderanch.com

46. Invoke Backing Bean At Page Level    coderanch.com

47. Redirecting to another page in Bean    coderanch.com

48. two pages, single session bean problem    coderanch.com

50. page not binding to bean    coderanch.com

In the world of HTTP (whether JSF or otherwise), what happens in one tab or browser window has no effect on any other tab or window. Each is in effect, a completely separate program. HTTP cannot support true MVC operation. A server cannot post back unsolicited changes to the client. Only when the client requests data can any server-side changes be ...

51. How can I set bean property in JSF page?!    coderanch.com

zohreh, are you sure? I have jspx page : javax.faces.context.ExternalContext fc = javax.faces.context.FacesContext.getCurrentInstance().getExternalContext(); HttpServletRequest request1 = (HttpServletRequest) fc.getRequest(); lt.it.webforce.framework.backing.header.HeaderBacking hb = (lt.it.webforce.framework.backing.header.HeaderBacking) request1.getAttribute("headerBacking"); java.util.Enumeration en = request1.getAttributeNames(); //java.util.Enumeration en = request1.getAttributeNames(); for ( ; en.hasMoreElements() ;) { ...

52. How to set the value of bean property (type java.util.Set) form JSF page    coderanch.com

Hi, I have 2 tables category and product. they have one-to-many relation in them. Category : cat_id(PK),cat_name,cat_desc Product : prod_id(PK),prod_name,prod_desc,cat_id(FK) As both have one to many relation so i have declared a set in Category Table. ----------------------------------------------- class Category implements Serializable { ........ Set products; @OneToMany(mappedBy="cat_id") public void setProducts(Set prod) { this.products = prod; } public Set getProducts() { return products; ...

54. More than one bean a page    coderanch.com

Hi guys, I have a small issue, I want to have a page with 2 beans, i.e. a page loads up with a search function, you search waht you need (first bean) and then results have a bean associated with them i.e. accept/reject (second bean). Each bean operates inside a different form. The first bean works fine, The problem i'm encountering ...

55. how to initialize a backing bean before a page loads    coderanch.com

I was searching the JavaRanch forums and found a person running into a similar scenario as me. There were no responses, but I was hoping that perhaps we might get more insight two years later. Similarly, I have a bean that generates a picklist, which is read from a database. I want to initialize the beans properties before the page loads, ...

57. Obtaining Page URL from Managed bean    coderanch.com

It's actually not good practice. Manage Beans are ideally simple JavaBeans and therefore shouldn't be aware of the framework - including whether they're running under JSF or even in a web application at all. You can break out of the box by chasing uphill from the FacesContext, but as I've mentioned in other posts on this forum, javabeans are best employed ...

58. Execute backing bean method on another page?    coderanch.com

Hi all I would appreciate any suggesstions on the following scenario. I have the following. Page 1: Command Button Page 2: OutputText OutputText2 PrePopulateFields() When a user presses the command button on page 1 I wish to execute PrePopulateFields() and then direct the user to that page or redirect the user then call PrePopulateFields(); I'm not fussy so long as the ...

60. Blank page on backing bean exception    coderanch.com

When there is exception in the backing bean, a blank page is displayed. I was expecting response with status code 500. When I debug the http response the status code is 200. I have configured the webapp to display error page on status code 500. Since it is not returning status code 500, this page is not displayed. In web.xml ...

62. I have a problem in JSf Manage Bean when i edit a page    coderanch.com

I want to edit a page, and use a same Manage Bean that i use for Save a page. But when i define Manage bean scope request in Face con-fig then all values show null on Edit Grids...........If i change it to Session scope then its working fine.......... can any body help me about that problem........why this happen in Request scope??? ...

63. Constructor of a Backing Bean of JSF page Invoking Twice on Initial Load    coderanch.com

Hi, I Developed a JSF(1.2) Application using Sun RI Components and muy Problem is The Constructor of Backing Bean of a jsf File getting invoked twice when a JSF Page is loaded. I Placed a System.out.println("Inside the LoginBean"); My Code looks like: For login.jspx the backing bean is LoginBean.java public class LoginBean { //Constructor public LoginBean() { // To get the ...

65. count od Managed Beans for page    coderanch.com

67. Newbie question on resubmit of page not executing bean    coderanch.com

I have a page where in the bean method I'm executing has validation code and when I go in and fix the validation error in my page and click submit again I am NOT getting to the bean in the Here is my bean method that I'm calling: public void createTransaction() { // Get selected dropdown values from submitted ...

69. Invoking bean from included JSF page    coderanch.com

72. Process Validator in the backing bean vs in the jsf page    coderanch.com

In case of custom validator class, is it possible to use it directly in the backing bean, like jsf2 annotation ? Or do we need imperatively to call the validator in the xhtml file with the f:validator ? I would like to simplify the view. Otherwise, is it possible to create new validator annotation ? Has someone any example of backing ...

74. Same JSF request seems to execute page twice w/ diff backing bean instances    java.net

Hello, As we're debugging performance issues on our ear running in glassfish v1b14, we were surprised to see that our JSF backing beans get instantiated twice, apparently as the result of the execution of our JSPs twice as well, even though it's clearly within the same _RequestID. I can't imagine that's a feature! :-O It's impacting the performance of our site ...