Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

doPost() question

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am interested in creating a web app that uses JSP, Servlets and XML.

At the moment I have the following

JSP - Form input.
Servlet - Retrieving form data and sending that data to a java object.
Java object (1) - Converts data into xml file....instantiates java object (2).
Java object (2) - Sends that file to a database.

On the returning side the database will send back another XML file that I will then process using XSLT to display back to the user.

Can I place that XSLT code in the orignial Servlets doPost() method? So my doPost () method would:

1. Retrieve user inputted data from the form on my JSP page.

2. Instantiate a java object to convert that data to XML, in-turn that object will instantiates another object to send the XML file to a database.

3. Converts the resulting XML file sent from the database and displays it for the user.


Can one servlet doPost() method handle all of this? If not, how would I set up my application and classes to handle this work flow?

Thank you in advance
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Marko polo", please check your private messages for an important administrative matter.
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What part are you having problems with? Have you tried writing the code?
 
Mark Reddy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem is not really to do with coding, in fact the majority of the coding is done.

The problem is more of a design question. All I am really looking for is if the way I am handling the flow of data through the system is the correct/optimal way of doing it.

 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course a single method could handle all that--a single method can handle a lot. *Should* it handle it all? No, separate functionality should be broken out into other methods and/or classes as appropriate. It sounds like you're already doing this. So what's the problem?
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might find this article helpful.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic