aspose file tools *
The moose likes Servlets and the fly likes How to read an object in Servlets ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to read an object in Servlets ?" Watch "How to read an object in Servlets ?" New topic
Author

How to read an object in Servlets ?

Lijoy John
Ranch Hand

Joined: Jul 24, 2001
Posts: 32
Hi to All,
I have a java application(Implements.java) in which I have an object(obj) of another bean class called Details.java. Now this object obj is storing information like
Request_id
Name,
Status_code,
Message
Address
in the Implements class.
How can a servlet read this object obj ? or how can the Implements class send this object obj to the servlet and how should it be send ? obj as a whole or first retrieving the values like
String req-d = obj.getRequestID();
String name = obj.getName();

and then sending it to the servlet. Can ServletInputStream be a possible solution to this ?.
Kindly advise me how i can proceed furthere with this.
Thanks,
Regards,
John
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12839
    
    5
If the application is running on the same network as the servlet, the RMI approach would work. Thats what J2EE uses to move objects around. My servlets and JSP book has an example of a servlet talking to a RMI server. Or you could do the equivilent with sockets and object serialization.
Bill

------------------
author of:
Lijoy John
Ranch Hand

Joined: Jul 24, 2001
Posts: 32
Hi William,
Thanks for replying to my query. It would be kind of you to let me know where i can find some examples how to get this working using Sockets and serialisation in servlets.
I also have an option of having a java class instead of using servlets. In that case also, is it possible to use sockets and serialisation.
Once i get the 4 fields into the servlet or a java class then i want to send that fields like name, request_id, status to a web page in Cold Fusion. Kindly advise me how i could proceed with that .
Thanks one again,
Regards,
John
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16315
    
  23

Actually, it sounds like you're trying to do an Enterprise Java Bean the hard way.


Customer surveys are for companies who didn't pay proper attention to begin with.
Lijoy John
Ranch Hand

Joined: Jul 24, 2001
Posts: 32
Hi,
As per the requirement , I would have to opt to either servlet or through a java class acting like a bean. If its a bean then I intend to have a method with the possible functionalities for receiving the object from Implements class and then sending the values through an HHTP post to the web page with an extension .cfm which should accept the values.
Kindly advise.
Thanks,
Regards,
John

Originally posted by Tim Holloway:
Actually, it sounds like you're trying to do an Enterprise Java Bean the hard way.[/B]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12839
    
    5
"fields like name, request_id, status to a web page in Cold Fusion."
Sorry I have never worked with Cold Fusion, it sounds like you might need a JSP solution, does Cold Fusion let you mix in JSP tags?
Bill
Lijoy John
Ranch Hand

Joined: Jul 24, 2001
Posts: 32
Hi Bill,
The web page i want to send the data is same as an html page with 4 text boxes , it accepts the values , and it will accept the http post request, like http://cfs/package/admin/status.html or status.cfm.
Thanks for replying back.
Regards,
John

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to read an object in Servlets ?