aspose file tools*
The moose likes JSF and the fly likes Page Navigaion issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Page Navigaion issue" Watch "Page Navigaion issue" New topic
Author

Page Navigaion issue

Kumar Gaurav
Ranch Hand

Joined: Apr 08, 2008
Posts: 108
Hi All,

I have kept <tr:inputHidden /> tag ouside the <tr:table /> in a jsp page.
I have written some business logic in the getter method of this hidden component. The problem is this method is getting called twice, first time when the page is loaded and second time when i click on save method( correspondingly save() method is called). Is there any way to prevent the getter method invocation for the second time.

It is very urgent. Please provide some inputs.


Regards,
Gaurav
Amir Iqbal
Ranch Hand

Joined: Jun 23, 2007
Posts: 97
wel Kumar i am not an expert in JSF. but my suggestion is just check that either the method (which is called twice), are you using the same method in <tr:dataTable> or not. because if it is so, then the main reason is that whenever you navigate to this page first time this method got invoked by page load event of jsf. and the second time when you click it.
so you may check it.

if i my solution is wrong then SORRY from my side.
Regards


i am Java +ve Now !
Kumar Gaurav
Ranch Hand

Joined: Apr 08, 2008
Posts: 108
Nope. Well i think page is getting refreshed on clicking save() method. well is there any way to stop page refreshing while clicking on save button so that getter method could not be invoked seocnd time.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Originally posted by Kumar Gaurav:
I have written some business logic in the getter method of this hidden component. The problem is this method is getting called twice


Getters are there to return bean properties. Nothing more. A getter can be called more than once in the bean's life. You need to realize this.

To do some preload logic, you normally use the bean's constructor or initialization block for that. To do some action logic, you normally use the bean's action method for that.

If your bean is designed that way that you really need to execute some logic in the getter, then you should be using lazy loading.

Example:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Page Navigaion issue