I have two Spring MVC actions that in this example takes one parameter from a form when submitted:
public ModelAndView login(HttpServletResponse response, HttpServletRequest request,
@RequestParam String requestedURL )
I would like to know if the attribute requestedURL can refer to a declared variable that actually hold the name of the incoming attribute input name="requestURL" ...
class Core {
static String requestedURL = "requestedURL";
}
pseudo code:
public ModelAndView login(..., @RequestParam String @ReadFrom(Core.RequestedURL) )
Notice the @ReadFrom
This is to avoid redundancy. Right now it is called requestedURL but in the future someone might want to change the input parameter name, this shouldn't be a hardcoded string in the applicaton in my opinion.
and
<input name="<%= Core.requestedURL %>" value="<%= requestedURL %>" />
and is read in the method when submitted. But does the attribute name have to be hardcoded in the incoming parameter of the action method?
Thanks!