You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Guy Bashan <gu...@gmail.com> on 2008/08/11 17:20:41 UTC

[MyFaces][Core] Action problem

Hi,

 

Is there a way to skip validation, but still post data to bean?

For example:

I have a screen in which data can be inputted. I also have a link near one
of the drop downs: "add new". When pressing "add new" user should go to
another screen allowing to enter a new item. Then when saving new item user
is directed to previous screen while preserving the value when screen was
left.

 

All my beans are "request scope". So I thought to use another session bean
to preserve the data, and when user comes back to the screen, simply copy
the data from session to the member of the bean. But, I have a problem
posting the data to the bean, when validation is still not satisfied.

 

Any way of dealing with this issue in JSF?

 

Thanks,

Guy.


RE: [MyFaces][Core] Action problem

Posted by Guy Bashan <gu...@gmail.com>.
Thanks,
Since I don't have too much controls on the screen, I thing I will simply
use control binding and I will get the data directly from the controls.
Anyway, is there some jsf api to get all the tree view and restore it? Or
this is it what Orchestra is dealing with?

Guy.



-----Original Message-----
From: simon.kitching@chello.at [mailto:simon.kitching@chello.at] 
Sent: Monday, August 11, 2008 6:35 PM
To: MyFaces Discussion
Subject: Re: [MyFaces][Core] Action problem

Guy Bashan schrieb:
>
> Hi,
>
>  
>
> Is there a way to skip validation, but still post data to bean?
>
> For example:
>
> I have a screen in which data can be inputted. I also have a link near 
> one of the drop downs: "add new". When pressing "add new" user should 
> go to another screen allowing to enter a new item. Then when saving 
> new item user is directed to previous screen while preserving the 
> value when screen was left.
>
>  
>
> All my beans are "request scope". So I thought to use another session 
> bean to preserve the data, and when user comes back to the screen, 
> simply copy the data from session to the member of the bean. But, I 
> have a problem posting the data to the bean, when validation is still 
> not satisfied.
>
>  
>
> Any way of dealing with this issue in JSF?
>
No, I don't think you can do that. At least not without a whole lot of 
complex code.
I would suggest just requiring the page to be valid before a new user 
can be added.

The "myfaces orchestra flow" project is actually designed to support 
this sort of thing. But that is still at an alpha-quality stage, and I 
would not recommend it for general use at the moment.

If you *really* want to do this, then I think you'll need to either
(a) save the whole view tree before navigating to the "add new" page, 
then restore it on return (what Orchestra Flow does), or
(b) walk the view tree and extract out the submittedValue property of 
each component, and restore that later, or
(c) save the raw submitted form data then reprocess that on return to 
the original view (minus the data that caused the "add new" command to 
execute)
I don't think any of these are very easy.

Regards, Simon


Re: [MyFaces][Core] Action problem

Posted by "simon.kitching@chello.at" <si...@chello.at>.
Guy Bashan schrieb:
>
> Hi,
>
>  
>
> Is there a way to skip validation, but still post data to bean?
>
> For example:
>
> I have a screen in which data can be inputted. I also have a link near 
> one of the drop downs: "add new". When pressing "add new" user should 
> go to another screen allowing to enter a new item. Then when saving 
> new item user is directed to previous screen while preserving the 
> value when screen was left.
>
>  
>
> All my beans are "request scope". So I thought to use another session 
> bean to preserve the data, and when user comes back to the screen, 
> simply copy the data from session to the member of the bean. But, I 
> have a problem posting the data to the bean, when validation is still 
> not satisfied.
>
>  
>
> Any way of dealing with this issue in JSF?
>
No, I don't think you can do that. At least not without a whole lot of 
complex code.
I would suggest just requiring the page to be valid before a new user 
can be added.

The "myfaces orchestra flow" project is actually designed to support 
this sort of thing. But that is still at an alpha-quality stage, and I 
would not recommend it for general use at the moment.

If you *really* want to do this, then I think you'll need to either
(a) save the whole view tree before navigating to the "add new" page, 
then restore it on return (what Orchestra Flow does), or
(b) walk the view tree and extract out the submittedValue property of 
each component, and restore that later, or
(c) save the raw submitted form data then reprocess that on return to 
the original view (minus the data that caused the "add new" command to 
execute)
I don't think any of these are very easy.

Regards, Simon