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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:31:37+00:00 2026-05-26T09:31:37+00:00

What is the best non-framework (JSP/Servlet only) way to create a form such that

  • 0

What is the best non-framework (JSP/Servlet only) way to create a form such that it can:

  1. Prepopulate with default values / data loaded from a database
  2. Redisplay submitted values which fail validation

It seems fairly straight forward to do one or the other, but creating a form that supports both simultaneously is tricky.

For example using

${param.scheduledDate}

works great for re-displaying a date on validation failure, but can’t easily be set programmatically on page load. Conversely,

${myBean.scheduledDate} 

works great for displaying values loaded from a database, but can’t re-display data on validation failure since the bean is using an object of type Date, not string.

A few things come to mind, but non really seem all that good:

  • use an intermediate bean with just strings
  • use a servlet filter to set parameters on page load
  • 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-26T09:31:37+00:00Added an answer on May 26, 2026 at 9:31 am

    Do it in the view side. Use the conditional operator ?: in EL:

    <input name="foo" value="${fn:escapeXml(empty bean.foo ? param.foo : bean.foo)}" />
    

    Note that I assume that unlike GET the POST request doesn’t prepopulate the ${bean} before validation has succeeded.

    This verboseness is by the way one of the reasons why MVC frameworks exist. JSF for example handles this fully transparently by the EditableValueHolder interface which is implemented by among others UIInput components.

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

Sidebar

Related Questions

What's the best way to wrap non-thread-safe code in the .net framework? I've got
What's the best way to generate a known number of non overlapping fixed radius
What's the best way to connect a GTK+ signal to a non-static member function?
What's the best way to generate 5 random non duplicating integers from 0 -
What is the best way to access components (e.g. imagelist, timer) from a form
What's the best algorithm to find the smallest non zero positive value from a
What is the best practice with regard to the Entity Framework and validating new
What's the best solution for embedding non-web fonts into a page without using Flash
I'm trying to figure out the best way to go about writing data transfer
I am looking for a best way to trigger windows application automation from Java

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.