Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to save a transaction screen

 
ajay vasudevan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai folx,
it z regarding a JSP transaction screen.
how do u save the data to database while pressing the Save Button.

in servlet doGet gets executed first and on the Save ,the very same page is committed with doPost method.all the database related stuffs like begin tran, insert, update and delete , commit tran take place here .

is this is way to be followed ?
how is it to be done in JSP ?i mean the correct way ???


please reply back...

ajay vasudevan
scjp 1.4
 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ajay,

First, please type out your words fully when posting a message. It does not take any more time to spell out 'you' instead of 'u' or 'folks' instead of 'folx', and it will make you post more readible and easier to understand.

Second, if you are asking for the correct way to process form data and save it to a database in a JSP page, well there isn't really a correct way. You should be doing this type of processing in a servlet, and then forwarding request to the JSP to present the view to the user.

in servlet doGet gets executed first and on the Save ,the very same page is committed with doPost method.
I am not sure I understand what the question is here. Basically, the flow of control should be as follows:
  • User enters data into a form and hits the submit button
  • The data is sent to a servlet (which was identified in the form's action attribute)
  • The servlet processes the data, saves it to a database, sets up any request and/or session attributes that the user might need, and uses a RequestDispatcher to forward on to a JSP page.
  • The JSP page uses request/session attribtues to present a view back to the user.

  • [ July 11, 2005: Message edited by: Paul Bourdeaux ]
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic