File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes @PostConstruct dont work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "@PostConstruct dont work" Watch "@PostConstruct dont work" New topic
Author

@PostConstruct dont work

javier pavon
Greenhorn

Joined: Mar 03, 2010
Posts: 9
The construct for my backing bean it is called twice, so i need a method what will be call only once for init the bean parameters (database, webservices...), do this twice is very slow.

On internet i have said the annotation @postconstruct, but it is not working for me.

In my bean i have the constructor and the init method




I am using jsf 1.2, this is my header faces-config



and in the web.xml




I dont know why in the init method annotated with @postConstruct it is not ever call.
javier pavon
Greenhorn

Joined: Mar 03, 2010
Posts: 9
any ideas?
Dave Brown
Ranch Hand

Joined: Mar 08, 2005
Posts: 301
Just curious if you discovered the reason behind it being called twice?


Regards, Dave Brown
SCJP 6 - [url]http://www.dbws.net/[/url] - Check out Grails Forum
Dave Brown
Ranch Hand

Joined: Mar 08, 2005
Posts: 301
It looks like something to do with what librarys you are running with.

I actually have two different scenarios with the same project, netbeans runs my project fine with beans only being created once, whereas intellij is having the problem you mention and calling the method twice.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: @PostConstruct dont work
 
Similar Threads
Weired Problem with JSF TLD on Tomcat
Spring Security 3 - cant't access secured page
App doesn't work
@PostConstruct Method Not Called In JSF 2.0
isELIgnored="false"