wood burning stoves 2.0*
The moose likes Servlets and the fly likes output in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "output in servlet" Watch "output in servlet" New topic
Author

output in servlet

srini kami
Greenhorn

Joined: Dec 29, 2002
Posts: 26
Hello
I am having trouble formatting output from database to browser.
I have follwoing code in try block of servlet.
try{

Statement stmt = conn.createStatement();
String req_show= "select title from request";

ResultSet rs = stmt.executeQuery(req_show);

while (rs.next() ) {

String titl = rs.getString(1)+"\n";
out.println(titl);out.println("\n");
I get values from above column (title)but they are showing in one row like following
//output
test test check
I want it to show as a cloumn
test
test
check
how do i do that?. I will appreciate it it if you could help me with this.
Thank you


Thank you<br />Srini
Sam Walker
Ranch Hand

Joined: Nov 06, 2002
Posts: 65
If out is of type PrintWriter and you�re trying to display your data in a browser then try this
out.println(titl+�<br>�);
srini kami
Greenhorn

Joined: Dec 29, 2002
Posts: 26
Hi Sam
Thank you. I tried it and it works fine now.
Thank you
Sam Walker
Ranch Hand

Joined: Nov 06, 2002
Posts: 65
You�re welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: output in servlet
 
Similar Threads
Servlet API 2.2
Passing parameter to servlet from another servlet
dynamic parameters
formatting JDBC output
Passing parameters