1 Reply Latest reply on May 22, 2013 10:45 AM by orotas

    Best practice from passing messages from servlets

    danchapmanme Level 1

      Is there a best practice for passing user messages (typically errors) back to the page from servlets?

       

      e.g. http://localhost:4502/content/geometrixx/en.html?message=Some user error message

       

      Dan

        • 1. Re: Best practice from passing messages from servlets
          orotas Level 4

          Well I suppose that answer to that question depends somewhat on your requirements, but I would say using a query string as you have indicated would be less than ideal because the page with the message would not be cached. No depending on your requirements and what sort of message you are passing that might be OK - especially if you message is highly personalized.

           

          If however you have a limited number of standard messages to display a more common approach is to have each message have it's own page and then to configure the servlet to redirect to the appropriate page based on the desired message.

           

          If you want the user to end up on the same page they submitted to the servlet from then another common approach would be to have the post to the servlet be AJAX and then display the message client side without having to change the URL.