File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes how to save a transaction screen Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "how to save a transaction screen" Watch "how to save a transaction screen" New topic
Author

how to save a transaction screen

ajay vasudevan
Greenhorn

Joined: Apr 23, 2005
Posts: 21
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

Joined: May 24, 2004
Posts: 783
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 ]

    “Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: how to save a transaction screen