0

Hellow I am trying to load a jsf page depending on a parameter I pass from a previous page.

I am passing the parameter in the url and trying to read it in the @PostConstruct method of the second page's managed bean to determine what to display in the second page.

The parameter I pass is already defined in the second page's managed bean as the following:

@ManagedProperty("#{param.displayText}")
String displayText;

but the problem is that when I try to read the value of displayText in the @PostConstruct method it is still set to null.

I noticed that all fields in the managed bean are still set to null at the time @PostConstruct method executes.

any help please, is there any other method I should be using other than @PostConstruct?

  • how do you pass paraeter to new page? it's important. because e.g. is will work. but will not work. – bhdrk Apr 25 '14 at 22:06
  • Simply means the value was not set. You're omitting a lot of context here: What kind of bean is your backing bean (cannot a CDI bean)? How are you passing the variable from the previous page? Everything the bean needs is supposed to be available as at `@PostConstruct`, so something is seriously wrong with your setup – kolossus Apr 26 '14 at 06:53
  • the application I am building is not purely JSF, I am using Jdeveloper to build a java ee web application, which includes JSF, JSP and servlets. My web pages are .jspx could this have anything to do with not having proper setup? – user3574533 Apr 26 '14 at 11:02
  • see this link please http://stackoverflow.com/questions/23310094/jsf-managed-bean-fields-not-initialized-at-postconstruct – user3574533 Apr 26 '14 at 11:19

0 Answers0