why is this?
could it be that I can't use a single managed bean for multiple view component?
I'm thinking of defining multiple instances of commentEntityController bean in faces-config.xml. would this be an appropriate solution my problem?
any suggestion would do please, thanks.
Here i have commentEntityController managed bean to work with the view:
When you submit a form, you're submitting only that form. No data from any other form or any other place on the webpage is submitted. Also, forms cannot contain other forms (no form nesting).
This is not a JSF restriction, this is how HTML forms work. JSF merely inherited the behavior. It's actually useful in some cases - such as when there's a little corner of the screen with a "search" or "login" form separate from the main body form(s).
You could put the entire panel in a single form if you wanted to, though.
An IDE is no substitute for an Intelligent Developer.
Tried you suggestion and removed form from both panel components but the behavior still continue. What should I do now?
-
1
-
-
-
-
That, in fact, is what a form is. It's not a display element, it's a logical container for all of the data that will be posted to the server in a single request. You simply cannot submit more than one form in a given request/response cycle. You'd have to re-invent the Web itself to do otherwise.
And backing beans are not Controllers. I don't care what Netbeans names them. Backing beans are always Models. In JSF, the Controllers are all built into JSF and you never code your own Controllers.
An IDE is no substitute for an Intelligent Developer.
"Controller" is usually used to mean that part of the Model/View/Controller subsystem that transfers changes in the Model to the View and changes to the View into the Model. The persistence services normally don't limit themselves to GUI (View) connections and they're usually one-way - changes to the database don't automatically reflect back up through the persistence services - you have to explicitly ask the service for them. At which time the persistence service will query the database.
An IDE is no substitute for an Intelligent Developer.
Tim Holloway wrote:The usual term for a persistence interface is "service". In my apps, the persistence services are a separate layer of classes. Depending on complexity, I either put business logic in action methods (which some people would condemn) or I have my backing beans invoke a business layer and that's what in turn invokes the persistence services.
"Controller" is usually used to mean that part of the Model/View/Controller subsystem that transfers changes in the Model to the View and changes to the View into the Model. The persistence services normally don't limit themselves to GUI (View) connections and they're usually one-way - changes to the database don't automatically reflect back up through the persistence services - you have to explicitly ask the service for them. At which time the persistence service will query the database.
Few things I want to ask, tim, what exactly is business logic? I hear this often and I'm confused. I also want to beleive the business layer is ejb isn't it?
For a small app that just allow users comment, like, share et al on some random content, what could the 'business logic' be?
Do most apps even have one?
I'm building what could be considered toy app by big guns like you but I must say I'm really cracked up.
I'm still battling with the issue behind this thread and I'd like to know if you can take a look at my facelet code and tell me why I'm still having this issue. Maybe point out some things im doing wrong. Its a personal project so no big deal. If you wish I'll send them to you directly. If you wish.
Victor Ade wrote:I have multiple <p:panel/> which are bound to the same managed bean for a simple 'save inputted text from <p:editor/> to database. however, when I load my page to test if data would save to DB I realize only the first <p:panel/> saves to database. The other with id="basic2" wouldn't even trigger any action.
why is this?
could it be that I can't use a single managed bean for multiple view component?
I'm thinking of defining multiple instances of commentEntityController bean in faces-config.xml. would this be an appropriate solution my problem?
any suggestion would do please, thanks.
Here i have commentEntityController managed bean to work with the view:
Done with this one.
Business logic validates data, assembles it into bundles that might be transferred to some other stage, computes things like totals, averages, and so forth and just does the "thinking" part of the system.
While there are apps and parts of apps which do nothing more than bring data up for editing/display and then write it back (CRUD), many systems are more complex. That's what the business logic is for.
You seem to have quoted your original question and I can only give you my original answer. Your problem is not in Java and it's not in JSF. It's in the World Wide Web itself.
No matter how many or few JSF backing beans you have, a form can only submit data that's within that form. If you want to submit data from multiple forms on a page, that's going to require multiple submits, because only one form can be submitted per request/response cycle. Otherwise, you'll have to expand things so that everything's on one form.
An IDE is no substitute for an Intelligent Developer.

Hug your destiny! And hug this tiny ad:
Thread Boost - a very different sort of advertising
https://coderanch.com/t/674455/Thread-Boost-feature
|