jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] Type-safe outcomes

From: Kito Mann <kito.mann_at_virtua.com>
Date: Fri, 17 Apr 2015 10:51:28 -0400

One of the things I've never really liked about JSF are the string-based
outcomes. As a matter of fact, I often use enums instead. What do people
thing about providing a type-safe alternative like the one brought up on
the MVC EG below?

---------- Forwarded message ----------
From: Christian Kaltepoth <christian_at_kaltepoth.de>
Date: Fri, Apr 17, 2015 at 10:38 AM
Subject: [jsr371-experts] Re: [mvc-spec users] Re: Sample application
To: "<jsr371-experts_at_mvc-spec.java.net>" <jsr371-experts_at_mvc-spec.java.net>


I agree with Rodrigo that we could think about ways that are more typesafe.

I'm very impressed by what is possible with VRaptor4:

http://www.vraptor.org/en/docs/ten-minute-guide/#create-form-redirecting
http://www.vraptor.org/en/docs/view-and-ajax/#redirect-and-forward

Perhaps someone from the VRaptor could describe it in more detail?

Christian




2015-04-17 16:05 GMT+02:00 Rodrigo Turini <rodrigo.turini_at_caelum.com.br>:

> IMO it's not that nice depending on a String to do this job. A simple
> typo will cause problems. Why not working in a type safe solution?
>
> just like result.redirectTo("/items") or even result.forwardTo("/items").
>
> What do you think? And Christian, great work! Thanks for doing this.
>
> Rodrigo Turini
> Caelum | Ensino e Inovação
> www.caelum.com.br
>
> 2015-04-17 10:56 GMT-03:00 Kito Mann <kito.mann_at_virtua.com>:
>
> (2) Redirect:
>>>
>>> /*
>>> * An Ozark specific way of doing redirects. Should this go into the
>>> spec?
>>> * Redirecting here is fine as the method doesn't need to render any
>>> * messages for the user which would get lost during the redirect.
>>> */
>>> return "redirect:/items";
>>>
>>> Yes, the intent was to propose this for the MVC spec. Seems pretty
>>> convenient. Comments?
>>>
>>
>> We should consider doing this like JSF, since there is precedence. JSF
>> does it like this:
>>
>> return "/items?faces-redirect=true";
>>
>> so we could do:
>>
>> return "/items?mvc-redirect=true";
>>
>>>
>>>
>>
>


-- 
Christian Kaltepoth
Blog: http://blog.kaltepoth.de/
Twitter: http://twitter.com/chkal
GitHub: https://github.com/chkal