This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
what sort of output are we talking about? More information please.
Joined: Jan 22, 2006
hi first i tell u about my application. in my application i am using one servlet in which doGet method is defined..in that doGet method i called one method of another java Class.. this method(method of java class) receiving some files from the QUEUE.. i want to print the result of every file received...one after another...on the browser......this is an JMS application......how can i send message or string from that program to the browser....
You have two options, 1) you can get the method to return the data as a String to the Servlet and get the servlet to write it to the client or 2) you can pass the PrintWriter or OPutputStream to the second class and get it write its own output to the client.
I tend to prefer option 1, since option 2 may require the second class to know it is outputting HTML data. This tends to confuse the responsibilities of the second class.