Results 1 to 3 of 3

Thread: Renderurl not sent after the first time

  1. #1
    Join Date
    Jul 2007
    Posts
    8

    Default Renderurl not sent after the first time

    Hi folks,
    I have a problem when sending a renderUrl. I have a "reset" button in my page which is used to reset the page to its initial state (like empty the serch fields etc...). Below is the code I use to implement this Reset button:

    Code:
    <input type="button" class="button" value="Reset" onclick="window.location.href='${portletUrl.getRenderUrl(actions.userSettings, 'customer.user.id=' + customerUser.userID)}';return false;"/>
    The problem is that clicking on this reset button works only the first two times. After that, clicking doe not result in sending a renderUrl to the my controller. It seems like after the first time the broweser caches the page and no actions take place when clicking.
    I have tried testing this by emptying the browser cache but that did not help either.

    Any help is appreciated,

    gr, Devx

  2. #2
    Join Date
    Sep 2004
    Location
    Arizona, USA
    Posts
    383

    Default

    Well, this doesn't sound like it has anything to do with Spring, but we'll see what we can do to help.

    What is the code that is generating your URL? I don't recognize that as a standard idiom.

    Do you have portlet render caching enabled? Perhaps that is where the problem is occurring. Think about the ramifications of turning caching off for the entire portlet, or even for that response before you do it -- it can have serious implications for performance and load.

    One good option might be to reset the page via an ActionURL of some kind instead of via a RenderURL. Actions should never result in caching at any layer in the stack.

    Another option: Is it possible reset things just on the client side? If all you are doing is clearing form fields then you can definitely do that without reloading the page.

    Hope all that helps!

  3. #3
    Join Date
    Jul 2007
    Posts
    8

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •