Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about multiple forms on a page sharing a bean

 
Panos Skianis
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic