You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Peter Goetz <pe...@ichpacks.net> on 2006/02/10 16:31:04 UTC
[Shale] Property in ViewController Backing Bean is null
Hi there!
I'm new to Struts, to Shale and to this list, so excuse if I'm asking
dumb questions.
I have a simple .jsp (personmaintenance.jsp), backed by a backing bean
(PersonMaintenance.class.
In the jsp I have buttons with actions "save", "edit", "delete",
"create", for which I defined the corresponding methods in the backing
bean. The backing bean has two attributes, a person (for the form to
edit) and a persons Collection for an overview table. When calling the
jsp (personmaintenance.faces), everything is fine. The Collection gets
filled from the database, the person attribute is null.
Unfortunately if I hit one of the buttons "edit" or "delete", the
corresponding method is not being called. If the person attribute is
filled from the start, everything works fine.
Can somebody tell me what to do to get the methods executed when I hit
the button and the argument is null? Or am I missing something elementary?
Thanks a lot!
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [Shale] Property in ViewController Backing Bean is null
Posted by Peter Goetz <pe...@ichpacks.net>.
Hi again,
I tried the whole weekend, but I didn't get any results other than those
mentioned in the email below.
Shall I send some code to illustrate the problem or is it really so
unusual, what I'm trying to do?
Thanks a lot for any help!
Peter
Good morning Craig,
thank you, I think I'm making a progress with your help.
I set the immediate flag to true for my commandButton, and my method
gets executed as I wanted it to do. In the edit method I set an
attribute of the backing bean to its correct value (the person that
should be edited in the form), and this attribute is set correctly (in
the prerender method I see its correct values). But the form is not
being filled with the values.
I read the chapter about the lifecycle of a JSF page in the J2EE
tutorial, but didn't find the information where to tweak the application
to set the actual form values. In my opinion this should happen in the
Update Model Values phase, and that this phase has to be executed, when
no errors occurs at validating the request parameters. But it seems this
is not the case.
Could you please help me again and push me in the right direction?
Thanks a lot, I will name my first child after you, if my wife doesn't
complain. :)
Have a nice weekend!
Peter
Craig McClanahan wrote:
> On 2/10/06, Peter Goetz <pe...@ichpacks.net> wrote:
>
>>Hello Craig,
>>
>>thank you very much, I didn't know that the action method is not
>>executed when a validation error occurs. That seems to be the problem,
>>because all of my form input fields are required fields and the messages
>>get filled.
>>Is there a way to skip validation on some actions? I would like to
>>validate the form when submitting it, but not when I select one item in
>>a list to fill the form with. Or is it standard behaviour to extract
>>such data tables to an extra form in the .jsp?
>>Thank you very much, what I wrote so far in this group is really
>>excellent!
>
>
>
> The standard approach to doing this is to mark the commands you want to work
> this way with immediate="true". This causes the corresponding action to
> fire "immediately" :-) ... during the Apply Request Values phase of the
> request processing lifecycle, which comes *before* Process Validations.
>
> The most common use case for this is a Cancel button ... you don't want to
> have your validations executed if you're cancelling the input. But the same
> principle applies to your scenario.
>
> Good night!
>
>>Peter
>
>
>
> Craig
>
>
> Craig McClanahan wrote:
>
>>>One thing to double check is whether some validation rules are failing,
>>>which would cause the action method call to get bypassed. The simplest
>>
>>way
>>
>>>to verify this is to add an <h:messages> component to your page, which
>>
>>will
>>
>>>display any validation messages that exist, or nothing if there were no
>>>messages.
>>>
>>>It's also possible that an exception is getting eaten somewhere along
>>
>>the
>>
>>>way ... check the log file of your servlet container as well for any
>>
>>stack
>>
>>>traces.
>>>
>>>Craig
>>>
>>>
>>>On 2/10/06, Peter Goetz <pe...@ichpacks.net> wrote:
>>>
>>>
>>>>Hi there!
>>>>
>>>>I'm new to Struts, to Shale and to this list, so excuse if I'm asking
>>>>dumb questions.
>>>>I have a simple .jsp (personmaintenance.jsp), backed by a backing bean
>>>>(PersonMaintenance.class.
>>>>In the jsp I have buttons with actions "save", "edit", "delete",
>>>>"create", for which I defined the corresponding methods in the backing
>>>>bean. The backing bean has two attributes, a person (for the form to
>>>>edit) and a persons Collection for an overview table. When calling the
>>>>jsp (personmaintenance.faces), everything is fine. The Collection gets
>>>>filled from the database, the person attribute is null.
>>>>Unfortunately if I hit one of the buttons "edit" or "delete", the
>>>>corresponding method is not being called. If the person attribute is
>>>>filled from the start, everything works fine.
>>>>Can somebody tell me what to do to get the methods executed when I hit
>>>>the button and the argument is null? Or am I missing something
>>
>>elementary?
>>
>>>>Thanks a lot!
>>>>
>>>>Peter
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [Shale] Property in ViewController Backing Bean is null
Posted by Peter Goetz <pe...@ichpacks.net>.
Good morning Craig,
thank you, I think I'm making a progress with your help.
I set the immediate flag to true for my commandButton, and my method
gets executed as I wanted it to do. In the edit method I set an
attribute of the backing bean to its correct value (the person that
should be edited in the form), and this attribute is set correctly (in
the prerender method I see its correct values). But the form is not
being filled with the values.
I read the chapter about the lifecycle of a JSF page in the J2EE
tutorial, but didn't find the information where to tweak the application
to set the actual form values. In my opinion this should happen in the
Update Model Values phase, and that this phase has to be executed, when
no errors occurs at validating the request parameters. But it seems this
is not the case.
Could you please help me again and push me in the right direction?
Thanks a lot, I will name my first child after you, if my wife doesn't
complain. :)
Have a nice weekend!
Peter
Craig McClanahan wrote:
> On 2/10/06, Peter Goetz <pe...@ichpacks.net> wrote:
>
>>Hello Craig,
>>
>>thank you very much, I didn't know that the action method is not
>>executed when a validation error occurs. That seems to be the problem,
>>because all of my form input fields are required fields and the messages
>>get filled.
>>Is there a way to skip validation on some actions? I would like to
>>validate the form when submitting it, but not when I select one item in
>>a list to fill the form with. Or is it standard behaviour to extract
>>such data tables to an extra form in the .jsp?
>>Thank you very much, what I wrote so far in this group is really
>>excellent!
>
>
>
> The standard approach to doing this is to mark the commands you want to work
> this way with immediate="true". This causes the corresponding action to
> fire "immediately" :-) ... during the Apply Request Values phase of the
> request processing lifecycle, which comes *before* Process Validations.
>
> The most common use case for this is a Cancel button ... you don't want to
> have your validations executed if you're cancelling the input. But the same
> principle applies to your scenario.
>
> Good night!
>
>>Peter
>
>
>
> Craig
>
>
> Craig McClanahan wrote:
>
>>>One thing to double check is whether some validation rules are failing,
>>>which would cause the action method call to get bypassed. The simplest
>>
>>way
>>
>>>to verify this is to add an <h:messages> component to your page, which
>>
>>will
>>
>>>display any validation messages that exist, or nothing if there were no
>>>messages.
>>>
>>>It's also possible that an exception is getting eaten somewhere along
>>
>>the
>>
>>>way ... check the log file of your servlet container as well for any
>>
>>stack
>>
>>>traces.
>>>
>>>Craig
>>>
>>>
>>>On 2/10/06, Peter Goetz <pe...@ichpacks.net> wrote:
>>>
>>>
>>>>Hi there!
>>>>
>>>>I'm new to Struts, to Shale and to this list, so excuse if I'm asking
>>>>dumb questions.
>>>>I have a simple .jsp (personmaintenance.jsp), backed by a backing bean
>>>>(PersonMaintenance.class.
>>>>In the jsp I have buttons with actions "save", "edit", "delete",
>>>>"create", for which I defined the corresponding methods in the backing
>>>>bean. The backing bean has two attributes, a person (for the form to
>>>>edit) and a persons Collection for an overview table. When calling the
>>>>jsp (personmaintenance.faces), everything is fine. The Collection gets
>>>>filled from the database, the person attribute is null.
>>>>Unfortunately if I hit one of the buttons "edit" or "delete", the
>>>>corresponding method is not being called. If the person attribute is
>>>>filled from the start, everything works fine.
>>>>Can somebody tell me what to do to get the methods executed when I hit
>>>>the button and the argument is null? Or am I missing something
>>
>>elementary?
>>
>>>>Thanks a lot!
>>>>
>>>>Peter
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>>For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [Shale] Property in ViewController Backing Bean is null
Posted by Craig McClanahan <cr...@apache.org>.
On 2/10/06, Peter Goetz <pe...@ichpacks.net> wrote:
>
> Hello Craig,
>
> thank you very much, I didn't know that the action method is not
> executed when a validation error occurs. That seems to be the problem,
> because all of my form input fields are required fields and the messages
> get filled.
> Is there a way to skip validation on some actions? I would like to
> validate the form when submitting it, but not when I select one item in
> a list to fill the form with. Or is it standard behaviour to extract
> such data tables to an extra form in the .jsp?
> Thank you very much, what I wrote so far in this group is really
> excellent!
The standard approach to doing this is to mark the commands you want to work
this way with immediate="true". This causes the corresponding action to
fire "immediately" :-) ... during the Apply Request Values phase of the
request processing lifecycle, which comes *before* Process Validations.
The most common use case for this is a Cancel button ... you don't want to
have your validations executed if you're cancelling the input. But the same
principle applies to your scenario.
Good night!
>
> Peter
Craig
Craig McClanahan wrote:
> > One thing to double check is whether some validation rules are failing,
> > which would cause the action method call to get bypassed. The simplest
> way
> > to verify this is to add an <h:messages> component to your page, which
> will
> > display any validation messages that exist, or nothing if there were no
> > messages.
> >
> > It's also possible that an exception is getting eaten somewhere along
> the
> > way ... check the log file of your servlet container as well for any
> stack
> > traces.
> >
> > Craig
> >
> >
> > On 2/10/06, Peter Goetz <pe...@ichpacks.net> wrote:
> >
> >>Hi there!
> >>
> >>I'm new to Struts, to Shale and to this list, so excuse if I'm asking
> >>dumb questions.
> >>I have a simple .jsp (personmaintenance.jsp), backed by a backing bean
> >>(PersonMaintenance.class.
> >>In the jsp I have buttons with actions "save", "edit", "delete",
> >>"create", for which I defined the corresponding methods in the backing
> >>bean. The backing bean has two attributes, a person (for the form to
> >>edit) and a persons Collection for an overview table. When calling the
> >>jsp (personmaintenance.faces), everything is fine. The Collection gets
> >>filled from the database, the person attribute is null.
> >>Unfortunately if I hit one of the buttons "edit" or "delete", the
> >>corresponding method is not being called. If the person attribute is
> >>filled from the start, everything works fine.
> >>Can somebody tell me what to do to get the methods executed when I hit
> >>the button and the argument is null? Or am I missing something
> elementary?
> >>Thanks a lot!
> >>
> >>Peter
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: [Shale] Property in ViewController Backing Bean is null
Posted by Peter Goetz <pe...@ichpacks.net>.
Hello Craig,
thank you very much, I didn't know that the action method is not
executed when a validation error occurs. That seems to be the problem,
because all of my form input fields are required fields and the messages
get filled.
Is there a way to skip validation on some actions? I would like to
validate the form when submitting it, but not when I select one item in
a list to fill the form with. Or is it standard behaviour to extract
such data tables to an extra form in the .jsp?
Thank you very much, what I wrote so far in this group is really excellent!
Good night!
Peter
Craig McClanahan wrote:
> One thing to double check is whether some validation rules are failing,
> which would cause the action method call to get bypassed. The simplest way
> to verify this is to add an <h:messages> component to your page, which will
> display any validation messages that exist, or nothing if there were no
> messages.
>
> It's also possible that an exception is getting eaten somewhere along the
> way ... check the log file of your servlet container as well for any stack
> traces.
>
> Craig
>
>
> On 2/10/06, Peter Goetz <pe...@ichpacks.net> wrote:
>
>>Hi there!
>>
>>I'm new to Struts, to Shale and to this list, so excuse if I'm asking
>>dumb questions.
>>I have a simple .jsp (personmaintenance.jsp), backed by a backing bean
>>(PersonMaintenance.class.
>>In the jsp I have buttons with actions "save", "edit", "delete",
>>"create", for which I defined the corresponding methods in the backing
>>bean. The backing bean has two attributes, a person (for the form to
>>edit) and a persons Collection for an overview table. When calling the
>>jsp (personmaintenance.faces), everything is fine. The Collection gets
>>filled from the database, the person attribute is null.
>>Unfortunately if I hit one of the buttons "edit" or "delete", the
>>corresponding method is not being called. If the person attribute is
>>filled from the start, everything works fine.
>>Can somebody tell me what to do to get the methods executed when I hit
>>the button and the argument is null? Or am I missing something elementary?
>>Thanks a lot!
>>
>>Peter
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [Shale] Property in ViewController Backing Bean is null
Posted by Craig McClanahan <cr...@apache.org>.
One thing to double check is whether some validation rules are failing,
which would cause the action method call to get bypassed. The simplest way
to verify this is to add an <h:messages> component to your page, which will
display any validation messages that exist, or nothing if there were no
messages.
It's also possible that an exception is getting eaten somewhere along the
way ... check the log file of your servlet container as well for any stack
traces.
Craig
On 2/10/06, Peter Goetz <pe...@ichpacks.net> wrote:
>
> Hi there!
>
> I'm new to Struts, to Shale and to this list, so excuse if I'm asking
> dumb questions.
> I have a simple .jsp (personmaintenance.jsp), backed by a backing bean
> (PersonMaintenance.class.
> In the jsp I have buttons with actions "save", "edit", "delete",
> "create", for which I defined the corresponding methods in the backing
> bean. The backing bean has two attributes, a person (for the form to
> edit) and a persons Collection for an overview table. When calling the
> jsp (personmaintenance.faces), everything is fine. The Collection gets
> filled from the database, the person attribute is null.
> Unfortunately if I hit one of the buttons "edit" or "delete", the
> corresponding method is not being called. If the person attribute is
> filled from the start, everything works fine.
> Can somebody tell me what to do to get the methods executed when I hit
> the button and the argument is null? Or am I missing something elementary?
> Thanks a lot!
>
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>