This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Better way to send a http response" Watch "Better way to send a http response" New topic

Better way to send a http response

Jill scott

Joined: Nov 30, 2009
Posts: 1

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

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

Joined: Jan 10, 2002
Posts: 60049

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]
I agree. Here's the link:
subject: Better way to send a http response
Similar Threads
using EJB and JMS from J2ME
WebLogic Developer Exam
MQ messages stuck forever
limitting the size of SOAP response
Simple Chat Program HTTP / Servlets