This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes Question about multiple forms on a page sharing a bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Question about multiple forms on a page sharing a bean" Watch "Question about multiple forms on a page sharing a bean" New topic
Author

Question about multiple forms on a page sharing a bean

Panos Skianis
Greenhorn

Joined: Mar 12, 2010
Posts: 2
Hi,

relatively new to JSF and there are a few things I definitely do not understand.
I have tried to look around for an answer but no luck - if this too naive then let me apologize in advance...
Looked at the code and config to see if it is the cause of this but I did not spot anything yet.

Project using JSF1.2 and Tiles.
The approach taken is that each tile will have its own form (and they are HTML wise independent - so no nesting of HTML forms will occur and so on).
Question: is that a "bad" thing to do?

Assume that we have two tiles (left and right)
The functionality on the left will be mainly to display items with an edit/remove button next to them and the functionality on the right is to diplay/update the contents of an item if one is selected or simply add a new item.
Note that you may have different types of items on the left which means the right tile will be different depending on the type. So since the left is common and the right changes then templating seems to be a sensible thing to do.
Currenlty I am mainly familiar with Tiles so that's where we are.


A bean is shared between these two forms (ie some values are displayed on one form and some on the other.
Question/Problem
Would you expect the shared bean to be instantiated twice (my init function with @PostConstruct seems to be called twice when the page is loaded...).
The bean is configured with request scope so I do expect the init function to be executed once when the page is loaded but not twice...

I will investigate further by setting one form around all the tiles (which will take a bit of time in our set up) but I was wondering if anybody has seen this and could it be related to the two forms.

Thanks,
Pan


Panos Skianis
Greenhorn

Joined: Mar 12, 2010
Posts: 2
Please ignore my ramblings - after going away for an hour and coming back I spotted the error straight away.
the redirect was set for the navigation link .... d@mn, don't think I will live this down... That was the issue this time at least...

thanks,
P.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about multiple forms on a page sharing a bean
 
Similar Threads
html:mutibox and validation Error
is it advisable to use super.execute()?
Interesting tiles/struts making a menu question
EJB3 double reference issue.
Struts1 - Create Action and Form for a JSP used in Tiles