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 Display / Hide Table based on output Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Display / Hide Table based on output" Watch "Display / Hide Table based on output" New topic
Author

Display / Hide Table based on output

riya das
Greenhorn

Joined: Sep 16, 2011
Posts: 8
Hi,

I have the following requirement:
I have a servlet that calls an ajax script and accordingly displays the result in a table. When I first load the page , I need to hide the table and once I click on a button 'Charge' I need to call the ajax function and display the result in the table by making it visible ? How do i achieve this ? Any help is appreciated.

Following is snipped of my existing code


My ajax script:
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56157
    
  13

CSS. Make the table hidden until script makes it visible.

Why are you building up HTML in servlet? Gather the data in the servlet then forward to a JSP to format the table HTML.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Miku Ranjan
Ranch Hand

Joined: Oct 11, 2011
Posts: 98
Hi,
You can use jstl tag, jsp scriptlet or javascript to achieve it.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56157
    
  13

Miku Ranjan wrote:Hi,
You can use jstl tag, jsp scriptlet or javascript to achieve it.

No, you can't. Not when using Ajax to fetch the new table.
Miku Ranjan
Ranch Hand

Joined: Oct 11, 2011
Posts: 98
Hi,
Yes Bear is right if you are using ajax that simply you can use some javascript to change the css to hide /show.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Display / Hide Table based on output
 
Similar Threads
JavaScript not working in IE7 but working in firefox
Regading getElementById
Problem getting servlets working
Creating table inside div
How to getParameter value