Can we have a switch statement in JSP for XPath expression?

The tag works like a Java switch statement. With this, you can choose between a number of alternatives. Where the switch statement has the case statements, the tag has the tags. In a similar way, a switch statement has the default clause to specify a default action and the tag has the tag as the default clause.

Attribute

  • The tag does not have any attribute.

  • The tag has one attributes which is listed below.

  • The tag does not have any attribute.

The tag has the following attributes −

Attribute Description Required Default
select Condition to evaluate Yes None

Example



   
     JSTL x:choose Tags
   
   
      

Books Info:

                                           Padam History                ZARA                100                                        Great Mistry                NUHA                2000                                                               Book is written by ZARA                                  Book is written by NUHA                                  Unknown author.                  

The following result will be displayed −

Books Info:
Book is written by ZARA
Updated on: 2019-07-30T22:30:25+05:30

514 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements