File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Better way to send a http response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Better way to send a http response" Watch "Better way to send a http response" New topic
Author

Better way to send a http response

Jill scott
Greenhorn

Joined: Nov 30, 2009
Posts: 1
Hi,

I have a servlet that responds to a request with value for 3 fields, say a="1" b="2" and c="3"

Which is the better way to send these as response? setting these as parameters in ServletRequest object or putting these values in a Serializable POJO and send it to client?

Please respond
AjayKumar Panigrahi
Greenhorn

Joined: Nov 21, 2009
Posts: 21
Hi jill
That depends on your application.what are you interested to do with those values?
As far i am concerned, its better to set these parameters in ServletRequest if you just need to respond.And if you need to store it in the database better to go with plain old java objects.Its good architecture DAO data access object


Ajay Kumar, SCJP5
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61089
    
  66

What is the client? How does it expect the information? What is it going to do with it?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Don't get me started about those stupid light bulbs.
 
subject: Better way to send a http response