Forums Register Login

need of Design Pattern with servlet

+Pie Number of slices to send: Send
hi,

I am writing a servlet which updates multiple database tables at once...
now I have a HTML front end file and a servlet. and I am printing the output about successful and unsuccessful insertion using out.print() where out is a PrintWriter to Response object of servlet

Total business logic is there in the servlet

My questions are

1. Is it possible for me to adopt MVC pattern for this

2. if not How I should organize my code...How to divide and place....

3.Where to keep the output info....
+Pie Number of slices to send: Send
  • Browser hits servlet (controller) and gets forwared to the JSP (view) with the form
  • User fills out form and submits. Form is submitted to the servlet.
  • Servlet parses form parameters. If OK, instanciates bean (model) and passes values to it. The bean has all the JDBC code in it.
  • The bean performs all database function and returns results (possibly in the form of another bean) to the servlet.
  • The servlet binds the results to the request object and forwards to the JSP for display.
  • The JSP (using either jsp:getProperty or EL, or JSTL..) presents the results to the user.

  • +Pie Number of slices to send: Send
    hi ben,

    I am updating 20 to 30 tables on a single click..
    It is an application of Data Population from MS-Excel file to Oracle...

    I wont fill the data in forms ...only the input i give is the file name with location... I should be able to display about successful/unsuccessful insertions rowwise
    +Pie Number of slices to send: Send
    Do as Ben directed. Then put some logic while inserting data in tables. You can populate a collection of a Bean, which would have appropriate message in it. Then bind that collection with your request object, and so forth. . . so forth.
    +Pie Number of slices to send: Send
    You'll also want to look into a file upload library.
    I use http://jakarta.apache.org/commons/fileupload
    It's feeding time! Give me the food you were going to give to this tiny ad:
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com


    reply
    reply
    This thread has been viewed 896 times.
    Similar Threads
    *.faces suffix mapping
    Multiple url-pattern in filter-mapping OC4j 10.1.3.3 Servlet 2.5
    URL rewriting in Struts1
    Change URL http/unbeatableonline.com/swbeatableonline.com to http/unbeatableonline.com
    problem with using URIs as parameters
    More...

    All times above are in ranch (not your local) time.
    The current ranch time is
    Mar 28, 2024 18:54:50.