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

  • Home
  • SEARCH
  • 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 637837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:40:02+00:00 2026-05-13T20:40:02+00:00

I am creating a form in JSF to save a new entity bean. I

  • 0

I am creating a form in JSF to save a new entity bean. I binding the properties of the new entity to input elements use the value property e.g. , where backing bean is JSF managed mean and newEntity is filed of the backing bean whcih contains a new instance of my entity. For properties which are value types (like numbers), the input fields will be populated with default values (e.g. 0). I want all the fields to be blank initially and saved back the new entity instance when the page is submitted. I suppose I could make all the properties null able by using types such as Integer but the values aren’t null able in the database and it doesn’t seem right that the requirements of my user interface should dictate the form of by business layer. I am looking at this the wrong way?

  • 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-13T20:40:03+00:00Added an answer on May 13, 2026 at 8:40 pm

    I assume that if the fields aren’t nullable, then they are required. If you put required="true" on the field, then validation should fail before the value can be assigned. This means it won’t try to assign null values to your attribute. You may have to write a custom validator to do this for some types of fields.

    Alternatively, you can write a converter. This converter would have to convert empty values to some predetermined constant such as -1 that you know is invalid. And vice versa, it would have to convert -1 to empty value for display. Then you have to deal with all the invalid values before sending it to the business layer.

    I’ve used both of these methods, but I much prefer the first. If the fields are not required, they should be nullable in the business layer.

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

Sidebar

Related Questions

I'm creating a JSF 2-application and I'm trying to use form validation in the
I am creating form fields dynamically. If I use <script> $().ready(function() { $(input[name=salesPrice1]).blur(function() {
I am creating a JSF form where I have an email field. I need
Eariler I happily used the following code for creating form elements (inside Zend_Form descendant):
Goal: I want to use jsf`s i18n Scenario: creating resource bundle (utf-8) file info:
When creating form elements with Zend (using Zend Studio for Eclipse), I'd like some
I want creating form field hints where the default value shows 'Password' and on
When creating a form, I wish to use one field on the model as
I'm creating a form with dojo, and I want a range-restricted number input field.
I'm creating login form using JSF 2.0. Below is the detailed description. When I

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.