velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <nbu...@gmail.com>
Subject Re: Server-side redirect from VelocityTools?
Date Fri, 27 Jun 2008 02:21:52 GMT
On Thu, Jun 26, 2008 at 5:37 PM, Claude Brisson <claude@renegat.net> wrote:
> Le jeudi 26 juin 2008 à 15:42 -0600, White, Tim a écrit :
>> > I don't use any centralized controller anymore - never understood why
>> it was an
>> > advantage. So I'm using a kind of MV paradigm with a decentralized
>> controller,
>> > and I'm very happy with it. It's quite straightforward and more
>> flexible.
>>
>> Right - I'm trying to do more of a 'pull' MVC model, where I centralize
>> the business logic into Velocity Tools, rather than into the
>> controllers.
>>
>> A classic example of needing to do a server side redirect though is "are
>> we authenticated?  No?  Back to the login page, please".
>
> Ah. For this very specific example, I use a filter (the Velosurf's
> AuthenticationFilter) - but for a tiny webapp, it could hold.

yeah, filters are a great fit for authentication.

> I'll give another example:
>
> Whenever I commit forms (which have many and/or text fields), I use the
> "redirect after post" technic, mainly to avoid the "would you like to
> resubmit data?" (or alike) dialog which pops up when the user just wants
> to refresh the page.
>
> For this purpose, I use small "action templates" (*.do => my
> ActionServlet) in which I use VTL as a basic scripting language (who can
> do the most can do the least) that look typically like this:
>
> #if($some_model_object.validate($params))
>  #do_something_with($params)
>  #redirect("/thank_you.vtl")
> #else
>  $logger.error("Houston, we've got a problem: $query")
>  #seterror("please try again!")
>  #redirect("/the_form.vtl")
> #end

which is essentially using Velocity to script your "action
controller".  though there are "real" scripting languages better
suited to this, i suppose it at least reduces the number of
technologies/languages you have to think about. :)

>
>
>        Claude
>
>> Tim
>>
>>
>> This communication is the property of Qwest and may contain confidential or
>> privileged information. Unauthorized use of this communication is strictly
>> prohibited and may be unlawful.  If you have received this communication
>> in error, please immediately notify the sender by reply e-mail and destroy
>> all copies of the communication and any attachments.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Mime
View raw message