• Post Reply Bookmark Topic Watch Topic
  • New Topic

hiding delete button for one category value  RSS feed

 
Barbara Norway
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Here is a question that I believe will be pretty easy for one of you jsp experts to answer (I hope):

If I have a jsp program that is called by a dozen or so menu items but would like to hide the delete button for one of the choices, how can I do it? I have a tree.js menu with lots of different categories (choices) that need to be able to insert, query, edit, and delete records. I have one function that will query the records based on a user-inputted range of values, return the values and then allow the user to select record(s) to be deleted or downloaded. All categories use the same set of jsps with the information specific to the particular category carried along to "fill in" the fields, table_name, etc.

In other words I need to conditionally hide the delete button for one of the categories but would prefer not to just code a separate set of jsps for it (that would be a kludge :-) )

Thanks very much in advance for your help with the syntax and please let me know if you need clarification of what I'm trying to do.

Barbara
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are any number of way to conditionalize within a JSP. I'd recommend getting the JSTL set up for your web (if not already).

You can then set a scoped variable for the condition you want to test for and use the <c:if> tag as appropriate.

For example, you could set up a scoped variable (aka 'attribute') for whether the delete button is to be displayed or not named 'allowDelete'.

On page, you could then use:



to generate the delete button only if allowed.

When the request is submitted for the delete action be sure to also check on the server that delete is allowed. Simply not showing the button is not sufficient security.
[ November 19, 2004: Message edited by: Bear Bibeault ]
 
Barbara Norway
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear for your valuable reply. I will put it to good use. I believe that I have a good handle on preventing deletion from the database for this table but I will spend more time thinking about it to be sure

Cheers.
Barbara
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!