Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7967937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:59:53+00:00 2026-06-04T06:59:53+00:00

Displaying Spring Dropdown in JSP if user does NOT have value in it.. I

  • 0

Displaying Spring Dropdown in JSP if user does NOT have value in it.. I am trying to find out how to write some Spring code that will not display the following dropdown if the user has a value in the borough field coming back from the server?

<form:select path="borough">
 <form:option value="Staten Island">Staten Island</form:option>
 <form:option value="Queens">Queens</form:option>
 <form:option value="Brooklyn">Brooklyn</form:option>
 <form:option value="Bronx">Bronx</form:option>
 <form:option value="Manhattan">Manhattan</form:option>
</form:select>  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T06:59:54+00:00Added an answer on June 4, 2026 at 6:59 am

    You can use jstl conditional tag to get this done

    <c:if test="${empty borough}">
        <form:select path="borough">
        <form:option value="Staten Island">Staten Island</form:option>
        <form:option value="Queens">Queens</form:option>
        <form:option value="Brooklyn">Brooklyn</form:option>
        <form:option value="Bronx">Bronx</form:option>
        <form:option value="Manhattan">Manhattan</form:option>
        </form:select>  
    </c:if>
    

    As per comment:

    You can achieve if else by using c:choose

    <c:choose>
        <c:when test="${empty borough}">
            <form:select path="borough">
            <form:option value="Staten Island">Staten Island</form:option>
            <form:option value="Queens">Queens</form:option>
            <form:option value="Brooklyn">Brooklyn</form:option>
            <form:option value="Bronx">Bronx</form:option>
            <form:option value="Manhattan">Manhattan</form:option>
            </form:select>
        </c:when>
        <c:otherwise>
            This is the else block, you can have multiple when clause so it will become if else if else code
        </c:otherwise>
    </c:choose>
    

    Some documentation

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Spring 3.0.x web project that is displaying a page of links
There's a dropdown displaying 1-10 from where the user selects the number of textboxes
I have a string variable which also has some PHP code in it. The
Does Java and/or Spring have the concept of properties? I have bunch of domain
I'm trying not to use the ',' char as a thousand separator when displaying
I'm using Spring. I've got a JSP with a form:select in it displaying the
I'm working on a Spring MVC 3 web application, I have some JSPs that
There are some helpful extension methods for using displaying enums in dropdown lists. For
I have problem with displaying error message in spring Application.i am using Spring MVC
I have string like : '<New guest with special chars>' Its displaying nice with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.