Hi John,
The url generation is nothing fancy, just a custom method that uses standard spring url generation:
Code:
public String getRenderUrl(String action, String queryString) {
PortletURL portletUrl = renderResponse.createRenderURL();
if(!StringUtils.hasText(action)){
action = renderRequest.getParameter("action");
if(action == null){
action = "";
}
}
portletUrl.setParameter("action", action);
if(restoreParameters != null) {
//If there are restore parameters (for restoring the session from the
// history) then add these parameter to the url. If the user clicks
//on this url then the parameters will be stored in browser's history.
addParameters(portletUrl, restoreParameters);
}
if(queryString != null) {
addParameters(portletUrl, queryString);
}
return portletUrl.toString();
}
I agree with you on the portlet caching, but for this specific portlet caching is disabled due to the requirements.
Resetting on the client side is for this case not sufficient since the pages does not need to clear the fields only but also redisplay the old values on the page from the back-end objects.
My last option is, as you mentioned, to handle this reset using an ActionUrl and in the controller perform a check based on the request parameter being passed (reset, update, delete...).
For now I changed the page to use window.location.reload(), together with the specified href value. Disadvantage is that the page is reloaded and the back-end is called to retrieve data again.
From your email I guess the best plausible solution will be to handle this using an ActionUrl and implement proper request parameters checking in the controller.
Thx a lot,
Cheers, Devx