This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

What should the Form action do for EJB call?  RSS feed

 
steve dowdall
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm calling an ejb from my jsp. Since I need to get an employee ID and a Doctype variable from the user, I will use a combobox and a textfield. I will retreive the variables and pass them to the business method for the ejb. My question is since I have to use an html form to get my user's info, what does the form action have to be set to so that when they hit the submit button it runs the EJB?
Steve
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you hit the Submit button, your ACTION= should point to a servlet that itself would invoke the EJB and stick the results in the Request and then forward it to the destination view (AKA JSP).
I personally don't like JSPs calling EJBs directly or holding references to them (like if a servlet puts said reference in the Request).
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no FORM method that can directly call an EJB - that's not how EJBs work - they're neither expected nor encouraged to generate HTML and they don't use HTTP in any event.
The reason why direct invocation of EJBs on a JSP isn't encourage, BTW, is that the lookup mechanism for an EJB requires more logic than is thought to be good to place on a construct that's intended primarily for display. Also, the EJB lookup code varies with the JNDI mechanism being used.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!