Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

How to read an object in Servlets ?

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Saloon Keeper
Posts: 21975
150
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, it sounds like you're trying to do an Enterprise Java Bean the hard way.
 
Lijoy John
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic