how to display different div when i returned from servlet?

130 views Asked by At

i have a jsp file with different div. First i display a div with login page after logged in it goes to servlet page and return back to same jsp page. My question how to display the different div after returning from the servlet?

2

There are 2 answers

0
Ashwin Golani On

First make the div display none Then send data using ajax to ur sevlet

$('#button id').click(function() { 
    $.ajax({     
       type: 'POST',   
       url: '..yourservlet',   
       data:your data,
       success: function(data)
       {     
          $('#div id you want to display').style.visibility = visible:// this will display ur div
       }
   });
});
0
Vikas Bodke On

Code snippets would have helped.

From what i get, you are trying to display the same JSP to the user, before & after logging him in, but providing a different view/div.

You can leverage the fact that once a user is logged-in, a flag/user object is usually added to the session/response(or you can add the same). You can then use this to block/display your div respectively.