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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:30:44+00:00 2026-06-01T07:30:44+00:00

I have a dropdown in my form that has a problem to populate when

  • 0

I have a dropdown in my form that has a problem to populate when validation failed. I use xml validation with Preparable interface. To access data for dropdown I need to pass some ID from the form. The problem is when validation failed and prepare()/prepareInput() called, none of the variables in class including ID is set. ID is hidden parameter in the form that does not change. Please advice.
Thank you,
Yuri

  • 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-01T07:30:45+00:00Added an answer on June 1, 2026 at 7:30 am

    prepare() in struts2 is rather synonymous with the role of init() in many other frameworks, that is it is called to initialise the action and fills a role very similar to the constructor.

    There seems to be something missing… using the default-stack all the parameters on the action should have been set before validation is called. So if the client is indeed passing in the parameters I can not see why or how any would be missing unless some part of your logic clears them.

    Sometimes it is necessary to acquire other objects as fields in your action derived from the values set by a form, or otherwise passed in as parameters. In this case you would like prepare to be called after values are set and then validate, if this scenario applies to you then the params-prepare-params stack is appropriate.

    Personally, I would put preparation logic into the actions execute method rather than the prepare method. It is only when I put multiple actions into a single class that the prepare method is most appropriate as it factors out what would be repetition. Then the params-prepare-params is a special case that can crop up although I would argue the if you use DI it may never need to be used.

    If this is not helpful please expand your question with the action class/xml mapping(if any) and provide the validation xml as well so we can see why this would be happening.

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

Sidebar

Related Questions

I have a simple form that has a list (dropdown list generated from a
i have a form that has a multiple select drop down. a user can
The Problem I have a page with a form on. It has a hidden
I have a form that has a field (Field A) that needs to be
In my application I have a drop-down form that fires up an AJAX request
Say I have a form that contains a drop-down list populated by values stored
i have two dropdown list. first drop down:1 enter code here <form:select path=custName id=custName>
I am using Asp.net dropdownlist in one of my form ..I have two dropdown
I have this HTML dropdown: <form> <input type=text id=realtxt onkeyup=searchSel()> <select id=select name=basic-combo size=1>
I have created a form with a dropdown list for 'Region'. Once the form

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.