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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:31:28+00:00 2026-05-14T00:31:28+00:00

The real question: Is there a way to clear certain attributes for all components

  • 0

The real question: Is there a way to clear certain attributes for all components on an initial page load?

Background info:

In my application, I have a JSF 2.0 frontend layer that speaks to a service layer (the service layer is made up of Spring beans that get injected to the managed beans).

The service layer does its own validation, and I do the same validation in the frontend layer using my own validator classes to try and avoid code duplication somehow. These validator classes aren’t JSF validators, they’re just POJOs.

I’m only doing validation on an action, so in the action method, I perform validation, and only if it’s valid do I call through to the service layer.

When I do my validation, I set the styleClass and title on the UIComponents using reflection (so if the UIComponent has the setStyleClass(:String) or setTitle(:String) methods, then I use them).

This works nicely, and on a validation error I see a nicely styled text box with a popup containing the error message if I hover over it. However, since the component is bound to a Session Scoped Managed Bean, it seems that these attributes stick. So if I navigate away and come back to the same page, the styleClass and title are still in the error state.

Is there a way to clear the styleClass and title attributes on each initial page load?

Thanks,

James

P.S. I’m using the action method to validate because of some issues I had before with JSF 1.2 and it’s validation methods, but can’t remember why… so that’s why I’m using the action method to validate.

  • 1 1 Answer
  • 1 View
  • 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-14T00:31:28+00:00Added an answer on May 14, 2026 at 12:31 am

    Ok, so I must use a PhaseListener, see this blog entry by BalusC and this other blog entry, that’s a much better way of doing what I’m doing already – setting the styleClass manually using reflection – which gets all components with messages and highlights them… I’m gonna do the same, however think it’s possible to add an attribute instead, haven’t tried it yet.

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

Sidebar

Related Questions

Question: is there a way to map a single foreign key to a number
So here is the question : is there any way to create a Context
My real Question is which of these is more efficient in terms of loading
If this is not a real question then feel free to close ;)
Ok, I think I have a real question for a change. I implemented a
Real noob question no doubt, but I can't get my head around this behaviour.
This is a real newbie question. I have simple app that selects a picture
So this should be a real easy question but I can't seem to find
A real F# noob question, but what is |> called and what does it
I had asked a question on how to implement real time updates in ASP.NET

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.