Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

automatic form submission  RSS feed

 
Mike Halford
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can a form have a backing bean action method as an action, eg

So that I can submit the form automatically.. eg


or how else do I submit a form without user intervention?
 
Tim Holloway
Bartender
Posts: 18705
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. The form tag will ultimately get translated into an HTTP POST request routed to the JSF dispatcher servlet. And, of course, when you do HTTP POST, the entire form's data gets sent, not just a single item.

However check the JSF button tag docs. I'm pretty certain that I have done forms with multiple buttons where I did actions based on which button was clicked.
 
Mike Halford
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I don't want a button though. I want to submit the form automatically.
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you against creating a button or you dont want to show the button on the page ? if case 2, create a button and make it invisible and use javascript to invoke button click action. hope it helps !

Thanks,
 
Mike Halford
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I was going to go for the 'invisible button' option. The page with the form on is only transitory, the user only sees the page fleetingly unless the network is on a go slow. It just says 'Loading...' and then posts the request on automatically. I want it to be transparent, the user shouldn't have to do anything. The page is only there really because I can't get the initial POST request to populate a managed-bean with session scope, see my other question near by . So, as a workaround I'm putting the data into a request-scoped bean first and then copying that data into the session-scope
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!