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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:08:59+00:00 2026-05-28T19:08:59+00:00

I’m using JSF2.0 and am building up a wizard. I have encountered a problem

  • 0

I’m using JSF2.0 and am building up a wizard. I have encountered a problem with SelectBooleanCheckboxes. Here is the workflow:

  • Load page with checkboxes (values are bound to a SortedMap in the backing bean).
  • Tick them, and click next. This increments a cursor, which the page uses to determine which PanelGroup the load.
  • The (correct) values are persisted to the bean.
  • Click back (cursor is decremented) and page renders the editable checkboxes. The first checkbox is not ticked (even though the bound variable holds a value of true for that box).

This cursor-based approach (which contains all of the wizard screens) doesn’t seem to work. However, if i slightly modify this so that the prev/next buttons bring up different xhtml pages, this issue disappears.

Unfortunately I cant do this. We are going to plug this wizard into a modal dialog, so visiting a new page on prev/next will not work

I’ve written up a smallish example of this (rather than asking you to wade through the entire wizard).

Here is the Java class:

@ConversationScoped
@Named("hashBool")
public class HashBoolTest2 implements Serializable {   

    private static final long serialVersionUID = 1962031429874426411L;

    @Inject private Conversation conversation;

    private List<RestrictionItem> list;
    private SortedMap<String, Boolean> values;

    private int cursor;

    public HashBoolTest2( ) {
        List<String> none = new ArrayList<String>();
        none.add("");

        this.setList( new ArrayList< RestrictionItem >( ) );
        this.getList().add( new RestrictionItem( "a", "a", none ) );
        ...
        this.getList().add( new RestrictionItem( "e", "e", none ) );

        this.setValues( new TreeMap< String, Boolean >() );

        this.setCursor( 0 );
    }

    @PostConstruct
    public void andThis() {
        this.conversation.begin( );
    }

    // getters and setters for instance variables

    @Override
    public String toString() {
        return "Values : " + this.values.toString( ) + " List: " + this.list.toString( );
    }

    public void kill() {
        this.conversation.end( );
    }

    public void doNext(ActionEvent e) {
        this.cursor++;
    }

    public void doPrev(ActionEvent e) {
        this.cursor--;
    }
}

Here is the XHTML fragment:

<?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"
  xmlns:c="http://java.sun.com/jsp/jstl/core">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>IGNORED</title>
</head>
<body>
  <ui:composition>
    <h:panelGroup id="container">
      <h:form>
        <!-- edit state -->
        <h:panelGroup id="edit" rendered="#{hashBool.cursor eq 0}">
            <code>
              <h:outputText value="#{hashBool.toString()}" escape="false"/>
            </code>

            <ul>
              <ui:repeat value="#{hashBool.list}" var="elem">
                <li>
                  <h:selectBooleanCheckbox id="elem" value="#{hashBool.values[elem.id]}" title="#{elem.displayName}" />
                  <h:outputLabel for="elem" value="#{elem.displayName}"/>
                </li>
              </ui:repeat>
            </ul>
        </h:panelGroup>

        <!-- view state -->
        <h:panelGroup id="view" rendered="#{hashBool.cursor eq 1}">
          <code>
            <h:outputText value="#{hashBool.toString()}" escape="false"/>
          </code>
        </h:panelGroup>

        <br/>

        <!-- buttons -->
        <h:panelGroup id="buttons">
          <f:ajax render=":container">
            <h:commandButton value="Prev" actionListener="#{hashBool.doPrev}"/>
            <h:commandButton value="Next" actionListener="#{hashBool.doNext}"/>
          </f:ajax>
          <h:commandButton value="Kill" actionListener="#{hashBool.kill()}"/>
        </h:panelGroup>

      </h:form>
    </h:panelGroup>
  </ui:composition>
</body>
</html>

Any suggestions are welcome! (And sorry if this is a double post, i havnt been able to uncover anything similar while searching here)

  • 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-28T19:09:00+00:00Added an answer on May 28, 2026 at 7:09 pm

    Mainly to ensure that the Wisdom of the Ancients remains properly documented (http://xkcd.com/979/): Turns out this is a bug within JSF 2.0.2 (which comes bundled with Liferay 6.0 GA 4). See here for more info: http://java.net/jira/browse/JAVASERVERFACES-1561

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has

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.