You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Matthias Klein <ma...@cmklein.de> on 2005/09/14 14:33:29 UTC
Form data passing problem
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
RE: Form data passing problem
Posted by Matthias Klein <ma...@cmklein.de>.
Thanks. It works now.
Matt
-----Original Message-----
From: Volker Weber [mailto:volker@weber-oldenburg.de]
Sent: Mittwoch, 14. September 2005 14:47
To: MyFaces Discussion
Subject: Re: Form data passing problem
Hi,
you must remove the immediate="true" form your submit button!
this skips the updatemodel phase.
Matthias Klein wrote:
> 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
>
--
-------------------------------------------------------------------------
Volker Weber Dietrichsweg 38a 26127 Oldenburg Germany
MAILTO:Volker@weber-oldenburg.de HTTP://www.weber-oldenburg.de
Re: Form data passing problem
Posted by Volker Weber <vo...@weber-oldenburg.de>.
Hi,
you must remove the immediate="true" form your submit button!
this skips the updatemodel phase.
Matthias Klein wrote:
> 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
>
--
-------------------------------------------------------------------------
Volker Weber Dietrichsweg 38a 26127 Oldenburg Germany
MAILTO:Volker@weber-oldenburg.de HTTP://www.weber-oldenburg.de
RE: Form data passing problem
Posted by Matthias Klein <ma...@cmklein.de>.
Thanks for your quick response. I deleted that but it still doesn't work.
Any suggestions?
Did I make a mistake with the nesting of the tags and elements?
Thanks
Matt
_____
From: Atree Blu [mailto:atreeblu@gmail.com]
Sent: Mittwoch, 14. September 2005 15:05
To: users@myfaces.apache.org; matthias@cmklein.de
Subject: Re: Form data passing problem
Hi, the problem is immediate="true" on the submit commandButton. If you add
this option the "properties sets step" and "validations step" are skiped and
the action is executes immediatly.
I hope this help you
Nicola
On 9/14/05, Matthias Klein <ma...@cmklein.de> wrote:
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
Re: Form data passing problem
Posted by Atree Blu <at...@gmail.com>.
Hi, the problem is immediate="true" on the submit commandButton. If you add
this option the "properties sets step" and "validations step" are skiped and
the action is executes immediatly.
I hope this help you
Nicola
On 9/14/05, Matthias Klein <ma...@cmklein.de> wrote:
>
> 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
>
>
Re: Form data passing problem
Posted by Volker Weber <us...@weber-oldenburg.de>.
Hi,
you must remove the immediate="true" form your submit button!
this skips the updatemodel phase.
Matthias Klein wrote:
> 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
>