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 5976079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:10:37+00:00 2026-05-22T21:10:37+00:00

we have list box.This will show the different states in US. I want state

  • 0

we have list box.This will show the different states in US. I want state “LA” should be as preselected.But I dont know the position of “LA” in the list. It may vary.We are using the following script for this.

<select id="state" name="state" title="State" class="js_required prompt_text grid_2" tabindex="5">
                <option>State</option>
                <s:iterator value="@com.homeservices.action.utils.StateCode@values()">
                    <option value="<s:property/>"><s:property/></option>
                </s:iterator>
</select>

var @com.homeservices.action.utils.StateCode@values() gives a list of values:

AA
AE
AK
CA
CT
IL
LA
MA
MD

……etc.

Can some one please suggest how to make LA as a preselected state.

  • 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-05-22T21:10:38+00:00Added an answer on May 22, 2026 at 9:10 pm

    The Struts Approach

    <s:select id="state"
              name="state"
              title="State"
              headerKey=""
              headerValue="State"
              list="@action.StateCode@values()"
              cssClass="js_required prompt_text grid_2"
              value="@action.StateCode@LA"
              tabindex="5"/>
    

    The JSP Approach (JSTL/JSP-EL)

    <%@ page import="action.StateCode" %>
    <c:set var="states" value="<%=StateCode.values()%>"/>
    
    <select id="state" name="state" title="State"
            class="js_required prompt_text grid_2" tabindex="5">
        <option>State</option>
        <c:forEach items="${states}" var="state">
            <option value="${state}" ${state == 'LA' ? 'selected="selected"' : ''}>${state}</option>
        </c:forEach>
    </select>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, I want to have a list of links, where each link will show
I have a list box like this, <asp:ListBox ID=ListBox1 runat=server Height=175px Width=213px> <asp:ListItem Value=all>All</asp:ListItem>
For a list box in WPF I have this template: <ControlTemplate x:Key=ListBoxItemControlTemplate1 TargetType={x:Type ListBoxItem}>
i have a list box and i want to add a folder/directory to that
I have an html list box and want to double click an item in
I have a list of links, and I have this search box #reportname. When
No error in logcat, but the suggestion list will not show I am not
I have this problem when i try to synchronize a observable list with listbox/view
I have a list box control that contains enough items to list them with
I have the list box control (ASP.NET Control On aspx page, language C# ).

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.