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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:41:39+00:00 2026-05-20T10:41:39+00:00

all data is required to be trimmed before going database. i currently use hibernate

  • 0

all data is required to be trimmed before going database. i currently use hibernate with JSF.
where would you put this logic in? in hibernate entity bean,or JSF backing beans?
what’s pros and cons. is there any other suggestion?

  • 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-20T10:41:40+00:00Added an answer on May 20, 2026 at 10:41 am

    Do it in the view side. You can just create a JSF Converter for String.class.

    @FacesConverter(forClass=String.class)
    public class StringTrimmer implements Converter {
    
        @Override
        public Object getAsObject(FacesContext context, UIComponent component, String value) {
            return value.trim();
        }
    
        @Override
        public String getAsString(FacesContext context, UIComponent component, Object value) {
            return value.toString();
        }
    
    }
    

    Or when you’re still on JSF 1.2, get rid of @FacesConverter and register it as follows in your faces-config.xml.

    <converter>
        <converter-for-class>java.lang.String</converter-for-class>
        <converter-class>com.example.converters.StringTrimmer</converter-class>
    </converter>
    

    Either way, it’ll be applied on all input properties of the String type without the need to change anything else.

    This is not possible on JSF 1.1 or older due to the internal design.

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

Sidebar

Related Questions

I am creating an C# WPF application that intake RS232 data and store all
Before I start explaining the code I will first give my use case so
I am currently faced with the task of importing around 200K items from a
We're converting to markdown, before we used an 'in-house' system, where both the image
Maybe that's not exactly the solution i need, but this is what i want
I have a set of Objects (ViewModel objects used to build strongly typed Views)
I'm using asp.net mvc 3 with jquery unobtrusive validation. I recently changed from standard
I am converting a php project into ruby on rails. The previous project used
I've been struggling a while in order to get my primary links to display

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.