Alternative Flow in Spring

2

In the face of the situation: I am in the car registration screen, where I can select the brand and enter the model. If I need to register a template that does not have the previously registered trademark, I have a link that leads to the trademark registration page. The correct would be at the end of the registration of the mark, return to the car registration screen, and not be displayed the standard screen of list of marks.

How to implement this in Spring?

    
asked by anonymous 31.01.2014 / 20:37

2 answers

1

The softer way for the user would be to implement the markup screen on a View and on a separate Controller, and then, when the user is registering the car, you can use a Dialog (type jQuery UI) and display the Brand registration view only, all via ajax. This way, the user does not lose what he is doing in the car.

Another possibility is to use session to save what the guy was writing on the car screen, redirect him to the brand name, and then return it to the car. But using session is not very much the concept of Spring MVC, which is something done for Request-Response, so the first option is the "most correct".

    
03.02.2014 / 17:14
1

You can send a POST or GET variable to the tag record page. Depending on the value of this variable, you know where to target when you finish registering the tags.

if(request.getParameter("flagOrigem").equals("1")){
return "cadastro/carros";
}else{
return "lista/marcas";
}

the variable "flagOrigem" was sent from the car registration page with the value="1";

But I agree with @Renanlf that the most elegant solution for the user is to use jModal with ajax;

    
04.02.2014 / 15:22