Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

visual jsf is about to kill me

 
Jorge Bendahan
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I never want to work again with visual jsf , Here is my problem: I have 2 pages, Client and Client_update. In the Client page, when I select a client from a table the selected client get's stored in the sessionBean and it gets redirected to Client_update and all the client attributes are displayed in this new page, the user can change some of these values and finally press a button to save those changes, but when i debbug, the fields always contain empty values. i noticed that the pre-render method get's called several times, so i setted up a flag to get the values only once, but still it doesnt work, what can i do?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18156
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll admit that when WYSIWYG designers for JSF become common, I'll have a much easier time of things, but you're giving a classic illustration of why IDEs are dangerous. They let you think you can do something even when you don't actually know what you're doing. I've dug myself into some pretty deep holes that way.

Your problem isn't in the IDE, it's in uderstanding JSF itself. One of the peculiarities of JSF is that in a request/response cycle, both the setter and getter methods for backing bean properties can end up getting called multiple times and at times and in ways that aren't easily predictable. For this reason, the mutator methods should not have side-effects. In particular, avoid database services (not only do you risk data corruption, the performance hits can be considerable).

From your particular complaint, however, I think you're using the wrong scope. Unfortunately, JSF tends to require a lot more in the way of session scope objects than most other platforms, mostly because of its extensive use of postback. Since request-scope objects get created from scratch at the beginning of every request/response cycle that needs them, stuff that doesn't get posted back and forth evaporates quickly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic