Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

disable the tab for specific user  RSS feed

 
Megha Singhal
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am doing project using spring-hibernate.now i am stuck at one point that how should i disable some tabs for guest user which are enable for registered user and for that i can use one jsp page only. so i am not understanding what approach should i follow, the coding will be in the front end or back end or both because accessibility is checked by the database that if the person is guest so his detail will not be in the database and limited tabs will be shown to him or the tabs will remain disable on the other hand if the person is registered user than all tabs will be shown to him.

for tabs i am using bootstrap
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not a fan of showing disabled controls. I would rather opt for not displaying controls at all in the first place.
 
Megha Singhal
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Maneesh

so how can that be possible on one single page that certain tabs are showing to the guest and all tabs to the registered user.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Megha Singhal wrote:
so how can that be possible on one single page that certain tabs are showing to the guest and all tabs to the registered user.

Its not the same page for both. When you are 'preparing' the page, figure out guest/registered user and render your view accordingly

Or are you asking how to add tabs?
 
Megha Singhal
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No i have already add the tabs using bootstrap but all tabs are accessible so now i want to limit the access for the guest user that i am not able to figure out what approach i should follow
 
Jayesh A Lalwani
Rancher
Posts: 2762
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are many ways to do this. One way you can do it is in your style sheet, have a disabled style for every style. It should have the CSS properties to disable/hide the control. Then on the jsp page, you ned to decide which style to use for every control. This can be done by simply putting conditional tags around the control.


If you are using spring security, spring provides a jsp tag lib http://docs.spring.io/spring-security/site/docs/3.0.x/reference/taglibs.html that can be used to conditionally render the controls

Of course, if you aren't using spring security, you cannot use those tag libs. You will have to get your permissions from the database put it in the model. In the page, you will need to get HoS permissions and conditionally render the controls

Eta: since it sounds like you are not using spring security, I'm adding this thread to the JSP forum. They might have a better idea than mine regarding how to do this without spring security.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming that you have the information available about the role of the user on the page, it's a simple matter of using <c:if> (or other conditional JSTL actions) to determine whether to show page elements or not.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!