[seam-dev] Replacing pages.xml
Gavin King
gavin.king at gmail.com
Fri Feb 19 00:40:47 EST 2010
You should even be able to make this work:
@View(.....)
login {
@Inject Login loginBean;
public MyAppPage next(MyAppPage page, Object outcome) {
if ( loginBean.isLoggedIn() )
return main;
else
return login;
}
},
of course we would need a little infrastructure for injecting into enum values.
On Thu, Feb 18, 2010 at 11:37 PM, Gavin King <gavin.king at gmail.com> wrote:
> Oops, this is a MUCH better way to write this code:
>
>
> public enum MyAppPage implements Page<MyAppPage> {
>
> @View(.....)
> login {
> public MyAppPage next(MyAppPage page, Object outcome) {
> if (Boolean.TRUE.equals(outcome))
> return main;
> else
> return login;
> }
> },
>
> @View(.....)
> main {
> public MyAppPage next(MyAppPage page, Object outcome) {
> return main;
> }
> },
>
> @View(.....)
> logout {
> public MyAppPage next(MyAppPage page, Object outcome) {
> return login;
> }
> };
>
> }
>
--
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org
More information about the seam-dev
mailing list