Create Navigation class to avoid "magic strings" and code duplication
parent
ae58a5b6e4
commit
de96be2471
@ -0,0 +1,16 @@
|
||||
package ru.ulstu.grant.controller;
|
||||
|
||||
import org.springframework.validation.Errors;
|
||||
|
||||
public class Navigation {
|
||||
public static final String REDIRECT_TO = "redirect:%s";
|
||||
public static final String GRANTS_PAGE = "/grants/grants";
|
||||
public static final String GRANT_PAGE = "/grants/grant";
|
||||
|
||||
public static String hasErrors(Errors errors, String page) {
|
||||
if (errors.hasErrors()) {
|
||||
return page;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue