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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:40:50+00:00 2026-06-08T16:40:50+00:00

I need to write in jsf 2 texts on a line with different colors.

  • 0

I need to write in jsf 2 texts on a line with different colors. Here is my code:

<h:panelGrid id="accessinfo_grid" columns="3">
<h:outputText id="loginid" value="#{msgs.loginId}" styleClass="label"/>
<h:outputText id="loginid_asterix" value="#{msgs.asterix}" styleClass="error_message"/>
<h:inputText  id="inputusername" disabled="true" value="#{userAccount.userName}"/>
<h:outputText id="password" value="#{msgs.passwordID}" styleClass="label"/>
<h:outputText id="passwordid_asterix" value="#{msgs.asterix}" styleClass="error_message"/>
<h:secretText  id="inputpassword" disabled="true" value="#{userAccount.password}"/>
</h:panelGrid> 

I want the output to be to be something like this with * with red color:

Login:* edit_box
Password:* edit_box

But now is something like this:

Login:   * edit_box
Password:* edit_box

I want that * red to be just after the first text. Probably i should try to use something else then a panelGrid but I don’t know what/how.

I am newbie at this.

Thanks,

  • 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-08T16:40:51+00:00Added an answer on June 8, 2026 at 4:40 pm

    In a <h:panelGrid>, which generates a HTML <table>, every direct child JSF component will end up in its own <td>. You need to group the JSF components which should end up in the same <td> in a <h:panelGroup>.

    <h:panelGrid id="accessinfo_grid" columns="2">
        <h:panelGroup>
            <h:outputText id="loginid" value="#{msgs.loginId}" styleClass="label"/>
            <h:outputText id="loginid_asterix" value="#{msgs.asterix}" styleClass="error_message"/>
        </h:panelGroup>
        <h:inputText id="inputusername" disabled="true" value="#{userAccount.userName}"/>
    
        <h:panelGroup>
            <h:outputText id="password" value="#{msgs.passwordID}" styleClass="label"/>
            <h:outputText id="passwordid_asterix" value="#{msgs.asterix}" styleClass="error_message"/>
        </h:panelGroup>
        <h:inputSecret id="inputpassword" disabled="true" value="#{userAccount.password}"/>
    </h:panelGrid> 
    

    (note that I replaced the non-existent h:secretText by h:inputSecret, not sure why you used it)

    Note that this has nothing to do with CSS. You’d still have exactly the same problem when disabling CSS. I’d suggest to take a JSF pause and concentrate on reading some decent HTML tutorial to understand better how it all works what JSF is generating (you can see it by opening the JSF page in browser and doing rightclick and View Source).

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

Sidebar

Related Questions

I need to write a C++ code coverage program that takes in another C++
I need to write the output of the code I have to a file
I need to create a jsf dataTable dynamically which means no of columns will
I need to write a program used internally where different users will have different
I need to figure out a way to write the contents of a JSF
The application need write file's last modification date. void Dater(String DateFile) { File file
I need to write a script in Matlab, which will read some data from
I need to write a query where I need to find the ' character.
I need to write some input data files for a python program, and I
I need to write a program that prints 0.(03) for input 1 and 33.

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.