1 Reply Latest reply on Nov 28, 2006 3:54 AM by Jan Francsi

    Portlet keeps data on reload

    Jan Francsi Newbie


      Here is my problem:

      I'm building a Portlet that should work as some kind as adress book.
      First the user has to chose a special departement. Then all members of that department will be listet with phone and email. so far, so good.

      If one changes to an other location of the website and then returns to the portlet, he gets the list of persons he had searched allready instead of the form to choose a new department.
      Why? Because the doView method asks for a variable submittet by that form to decide what should be displayed. And that variable contains the last search attribute instead of being empty at initialisation.

      Well, my english isnt quite good enough to give a better explanation. So, here is the code of the doView method.
      BTW... I've noticed the same behavior in the helloworld example:On reload (maybe change from default to test and back), you can't type in a new name.

      protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
       String fachbereich = (String) request.getParameter("fb");
       if (fachbereich != null){
       dbConnection db = new dbConnection();
       List contactList;
       if (fachbereich.compareTo("Alle") == 0) {
       contactList = db.getData("");
       } else {
       contactList = db.getData(fachbereich);
       request.setAttribute("contactList", contactList);
       PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/ContactsView.jsp");
       prd.include(request, response);
       } else {
       PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/AuswahlView.jsp");
       prd.include(request, response);