Hi,
I know spring tags as well but they aren't the same of flash pattern in Rails (or Grails).
take look this controller generated by Roo:
Code:
@RequestMapping(value = "/system/{id}", method = RequestMethod.DELETE)
public String delete(@PathVariable("id") Long id) {
if (id == null)
throw new IllegalArgumentException("An Identifier is required");
findSystem(id).remove();
return "redirect:/system";
}
So, how I could redirect and send a message to client like "System was deleted!" ?
I Rails we have "flash" :P
from rails docs:
4.2 The Flash
The flash is a special part of the session which is cleared with each request. This means that values stored there will only be available in the next request, which is useful for storing error messages etc. It is accessed in much the same way as the session, like a hash. Let’s use the act of logging out as an example. The controller can send a message which will be displayed to the user on the next request:
Code:
class LoginsController < ApplicationController
def destroy
session[:current_user_id] = nil
flash[:notice] = "You have successfully logged out"
redirect_to root_url
end
end