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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:26:07+00:00 2026-06-01T22:26:07+00:00

So my team has a jsf and we use an EL statement to read

  • 0

So my team has a jsf and we use an EL statement to read in the value of an input box, works fine but by default we have our value set as what should be filled into the field. How can I set a default value for the input while still having the EL statement work.
Example:

 <h:inputText value="#{registrationBean.firstName}" styleClass="formEle"/>

I tried

<h:inputText value="#{registrationBean.firstName}First Name" styleClass="formEle"/>

but this breaks the connection when we submit.
Any ideas?

  • 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-01T22:26:10+00:00Added an answer on June 1, 2026 at 10:26 pm

    You’re looking for something which is called a “watermark” or “placeholder”. At low level, these days this is normally to be done by the HTML5 placeholder attribute:

    <input type="text" placeholder="First Name" />
    

    This works of course only in browsers supporting HTML5 and then only with JSF components supporting the new HTML5 attribute. The standard JSF <h:inputText> doesn’t support this natively (yet). You’d need to look for 3rd party component libraries supporting this. Among them is PrimeFaces with its <p:watermark>:

    <h:inputText id="firstName" value="#{registrationBean.firstName}" />  
    <p:watermark for="firstName" value="First Name" />  
    

    If using PrimeFaces is not an option for some reason, you’d need to reinvent it yourself in flavor of a custom component and/or a custom piece of JS/jQuery, exactly like <p:watermark> is doing under the covers.

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

Sidebar

Related Questions

My capstone team has decided to use Qooxdoo as the front end for our
Our product team has requested custom cursors during drag/drop operations. They have provided me
my team has made the decision recently to use Moq as our mocking framework
Our team has recently migrated to git. We have production web application server with
Our team has just started unittesting and mocking, and we have run into some
We have got 221gb table in our SQL Database, mainly duplicate data. Team has
Our team has just started developing for the Sitecore CMS. We find that after
Our team has recently been working on a logic and data layer for our
Our team has recently been considering pushing out a minor registry fix to users
Our team has a number of independant services, and (possibly nested) dependant versioned libraries

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.