I have written a simple JSF-page which contains only one single inputText:

<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
        
<f:view>
        <f:loadBundle
basename="ca.gc.nrc.iit.toml.frontend.bundles.RateCourse"
var="MessageBundle"/>
        <html>
                <head>
                        <link href="css/stylesheet.css" rel="stylesheet"
type="text/css"/>
                        <title>
                                <h:outputText
value="#{MessageBundle.dialogtitle}" />
                        </title>
                </head>

                <body>
                        <h:form id="RateCourseForm">
                        <h:panelGrid id="grid" columns="4">
                                        <h:outputText
value="#{MessageBundle.dialogtitle}" />
                                        <h:inputText id="test"
value="#{RateCourseBackingBean.evaluation}" required="true" />

                                        <h:commandButton id="submit"
action="#{RateCourseBackingBean.submit}"
value="#{MessageBundle.submitbuttonlabel}" immediate="true" />
                                        <h:commandButton id="cancel"
action="#{RateCourseBackingBean.cancel}"
value="#{MessageBundle.cancelbuttonlabel}" immediate="true" />
                                </h:panelGrid>
                        </h:form>
                </body>
        </html>
</f:view>


The Backing Bean looks like

package ca.gc.nrc.iit.toml.frontend;

//import javax.faces.model.*;

public class RateCourseBackingBean {
        
        private String evaluation = "test";

        public String submit() {
                System.out.println(this.evaluation);
                return "submit";
        }
        
        public String cancel() {
                return "cancel";
        }

        public String getEvaluation() {
                return evaluation;
        }

        public void setEvaluation(String evaluation) {
                this.evaluation = evaluation;
        }
}

It works so far but the System.out.println() in submit() only ever prints
"test" on the console.

And I don't know why.

Did I make a mistake in the nesting of the tags of the JSF-page?
(What is the official nesting of elements? The JSF-Spec does not seem to
state what an empty JSF-page should look like and how the elements are to be
nested.)

Do you have any idea where that mistake is?

Thanks

Matt

Reply via email to