This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
My problem is how my application can get the data taken from MYSQL database by the servlet I want to view this data in my application This application(Not the servlet. The one on the Clint side)is not an applet(web based). It is a class that extends JFrame(The one with the getdeleteText() method).
Thanks you [ October 28, 2005: Message edited by: Sameera Abeysinghe ]
I believe calling connect.setDoOutput(true); makes request post and servlet expects post data. Remove it or do false.
Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
Sameera Abeysinghe
Ranch Hand
Joined: Nov 15, 2004
Posts: 104
posted
0
Hi, Thanks for the fast reply�s
Are you sure that it is possible to connect to a URL that contains GET parameters in this fashion?
I believe calling connect.setDoOutput(true); makes request post and servlet expects post data. Remove it or do false.
I am very new to servlet programming so a working code will be a big help
This is what I want to do
I send the groupid(variable group) to the servlet through the url. It works fine. The servlet takes that groupid and get some data from the database. That also works fine. My problem is after getting the data what I have is a result set. I want the data in this result set to be shown in my application. How can I do it (I think the servlet has to send it so �.) Thanks
If your application has a JSP front-end with more number of fields and othe rdata vallidations to be done then you should be using taglibs ( the very famous ResultSetIterationTag ) ..........or if your application has only few fields to be populated then directly put them in a session and access them at front-end.
BE GOOD AND DO GOOD. THAT IS THE WHOL EOF RELIGION. -- Swami Vivekananda
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35439
9
posted
0
I don't see what JSP has to do with any of this.
One basic problem you have is that you call both response.getOutputStream and response.getWriter. That won't work, you can only use one of them at a time. (I'm actually surprised you're not getting exceptions when you do that, but that's a different topic.)
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
posted
0
Originally posted by Sameera Abeysinghe: My problem is after getting the data what I have is a result set. I want the data in this result set to be shown in my application. How can I do it (I think the servlet has to send it so �.)
Yes you need to respond back after processing. Technically, you need to take a request dispatcher from your request object and then do forward. It would be forwarded to the view/JSP. Otherwise you can render the response in your servlet as well.
Tip: While forwarding request to some JSP page in order to show the result. Bind your collection of TO to request object. Where collection of TOs would be filled by your resultSet.
Ones again Thank You for the reply�s But I am not sure you all understood my problem.
amarender reddy -- your application has a JSP front-end with more ....
My application is not web based(so no jsp or applets) Sameera Abeysinghe -- side)is not an applet(web based). It is a class ....
Ulf Dittmer -- actually surprised you're not getting exceptions ... I was testing to find a way to do this so don�t know what exactly I did
Adeel Ansari -- Tip: While forwarding request to some JSP page in order to show the result........... My application is not web based(so no jsp or applets) Sameera Abeysinghe -- side)is not an applet(web based). It is a class ....
The link TO is useful. But not sure it can do what I want So more reply�s is always well come.
Why are you trying to read the response as an ObjectInputStream? It is very clearly going to be a text stream since you did a response.getWriter(0) Of course it is corrupted. Bill