[jboss-user] [Beginners Corner] - Portlet keeps data on reload

francsi do-not-reply at jboss.com
Fri Nov 24 04:19:00 EST 2006


Hello!

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
  |   {
  | 	response.setContentType("text/html");
  | 	String fachbereich = (String) request.getParameter("fb");
  | 	
  | 	if (fachbereich != null){
  | 		dbConnection db = new dbConnection();
  | 		db.getConnection();
  | 		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);
  | 	}
  |   }
  | 

cya,
jan

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3988357#3988357

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3988357



More information about the jboss-user mailing list