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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:39:05+00:00 2026-05-15T21:39:05+00:00

I need to create a drop down menu in struts2 from List. How can

  • 0

I need to create a drop down menu in struts2 from List. How can I create an action class so that when a .jsp page is loaded, it populates the list first?

i found this link http://www.mkyong.com/struts2/struts-2-sselect-drop-down-box-example/ , it works too but for it work user must go to http://localhost:8080/Struts2Example/selectAction.action to make it work but what if someone were to directly go to select.jsp.

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

    Since you’re using a .jsp, you could load the dropdown with a scriptlet before you render the <s:select> tag.

    However, it’s better practice to allow the action to perform the loading and hide the .jsp files under /WEB-INF so they’re not directly accessible. A common approach to perform this is the Prepare interceptor.

    If you’ve got it in your interceptor stack, it will automatically invoke any method with the following name in your action before invoking the requested method:

    • prepare{MethodName}()
    • prepareDo{MethodName}()
    • prepare()

    That means you can do something like the following in your Action:

    public class YourAction extends ActionSupport {
    
        public String prepare(){
             // populate your drop down object
        }   
    
        public String view(){
             // forward to your jsp
             return SUCCESS;
        }
    
    }
    

    Then all you have to do is call your action’s view() method and prepare will be called first by Struts.

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

Sidebar

Related Questions

I need to create one drop down list contains some Languages. By selecting any
I need to create a drop down list (spinner) in eclipse for Android whereby
I need to create a Drop Down List in a Web User Control (.NET
I need to create drop down menu (see the picture). What methods are there?
Is there any standard way to create drop-down menu from QLineEdit without QCompleter? For
I need to create a drop down menu where I need to display 5
I need to know how I could create a drop down list to represent
I basically need to create a value by default for a drop down menu
I'm trying to essentially create a drop down menu tied to a field that
I need to create a custom component which consist of a drop down box,

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.