File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How to show a table in Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to show a table in Servlet" Watch "How to show a table in Servlet" New topic
Author

How to show a table in Servlet

Nick Lee
Ranch Hand

Joined: Dec 17, 2002
Posts: 45
Hi all,
I got a little question about how to show the html like pages in the servlet.I can only use
ServletOutputStream out = res.getOutputStream();
to print sth on the brower,but it's can only show the string on the brower,not the table or even buttons.
Can we do this without JSP files?


Nick Lee
Juanjo Bazan
Ranch Hand

Joined: Feb 04, 2002
Posts: 231
You can use a PrintWriter to send Strings to the browser, but if that Strings are html text, you can send tables, buttons or whatever html element.
Here is a sample:

Of course you can also use the Dispatcher to forward the request/response to a jsp and delegate the view to a "view component".
Search for Model 2.
HTH
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12825
    
    5
You could also use one of the template based schemes where the servlet reads in a HTML formatted file that has special markers to show where the servlet is supposed to insert data.
Bill
Nick Lee
Ranch Hand

Joined: Dec 17, 2002
Posts: 45
I know,thank u very much.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to show a table in Servlet