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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:34:01+00:00 2026-06-10T02:34:01+00:00

This is my code: botoes.xhtml <?xml version=1.0 encoding=ISO-8859-1 ?> <!DOCTYPE html PUBLIC -//W3C//DTD XHTML

  • 0

This is my code: botoes.xhtml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h=" http://java.sun.com/jsf/html"
    xmlns:f=" http://java.sun.com/jsf/core">

<h:head>
    <title>K19 - Eventos</title>
</h:head>

<h:body>
    <h:form>
        <h:commandButton id="botao-jonas" value="Jonas" disabled="false" actionListener="#{BotaoBean.sorteiaBotao}" />
        <h:commandButton id="botao-marcelo" value="Marcelo" disabled="true" actionListener="#{BotaoBean.sorteiaBotao}" />
        <h:commandButton id="botao-rafael" value="Rafael" disabled="true" actionListener="#{BotaoBean.sorteiaBotao}" />
    </h:form>
</h:body>
</html>

and BotaoBean.java:

import javax.faces.bean.ManagedBean;
import javax.faces.component.*;
import javax.faces.event.ActionEvent;


@ManagedBean(name="BotaoBean")
public class BotaoBean {

    public void sorteiaBotao(ActionEvent event) {
        UIComponent formulario = event.getComponent().getParent();

        UIComponent botaoJonas = formulario.findComponent("botao-jonas");
        UIComponent botaoMarcelo = formulario.findComponent("botao-marcelo");
        UIComponent botaoRafael = formulario.findComponent("botao-rafael");

        botaoJonas.getAttributes().put("disabled",true);
        botaoMarcelo.getAttributes().put("disabled",true);
        botaoRafael.getAttributes().put("disabled",true);

        double numero = Math.random();

        if (numero<1.0/3.0) {
            botaoJonas.getAttributes().put("disabled",false);
        } else if (numero<2.0/3.0) {
            botaoMarcelo.getAttributes().put("disabled",false);
        } else {
            botaoRafael.getAttributes().put("disabled",false);
        }
    }    
}

I run and gives the following exception:

javax.servlet.ServletException: /botoes.xhtml: Property ‘sorteiaBotao’
not found on type BotaoBean
javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)

I don’t know how to solve. I did the same as tutorial example. Can anyone help me?

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-10T02:34:03+00:00Added an answer on June 10, 2026 at 2:34 am

    The exception indicates that the actionListener="#{BotaoBean.sorteiaBotao}" is been treated as a value expression instead of a method expression (it’s looking for a property and thus it’s trying to just print the value returned by a getter, which obviously doesn’t exist at all; as the exception says).

    This in turn indicates that the whole component and the attribute are not been recognized by the JSF renderer.

    This in turn indicates that the h: tag library of the component isn’t (properly) been declared.

    And indeed, you’ve there a dangling space in the taglib URI:

    xmlns:h=" http://java.sun.com/jsf/html"
    

    This space doesn’t belong there in the taglib URI. Fix it accordingly:

    xmlns:h="http://java.sun.com/jsf/html"
    

    Don’t forget to do the same for f: tag library, it has also a misplaced space in its URI.

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

Sidebar

Related Questions

This code is ment to download the source code of an html file but
This code worked (correctly reflected the user's current timezone) back in the aspx version.
This code compiles and runs with either a public implicit bool cast (commented out
This code: public class PhotoDescriptor { public DateTime DateCreatedUtc { get; set; } }
This code in the default login template: {{ form.errors }} Produces this html output
This code does not compile. public class Diamond { public static void diamondOfAsterisks(String *
This code i put it in the HTML page for check the file value,
This code below allows me to find the word error in all my files
This code is the core of a much larger script that works great in
This code disabled mouse scroll functionality, when i click on the document. $(document).on(click, function

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.