Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

[SOLVED] refresh servlet due to dynamic data  RSS feed

 
Chad Clites
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet that displays a list of text read from a file. I am simply reading the lines of text into an array, and then looping through the array to display the data.

I have some other servlets that are used to edit, delete, and add data. Once each of the servlets does the required manipulation, the text is written back to a file, and the main servlet is reloaded. I am using the following code to reload my "portal" servlet:[code}

RequestDispatcher dispatcher=getServletContext().getRequestDispatcher( "/PortServlet" );
dispatcher.forward( request, response );[/code]

Once the portal servlet is recalled, it reloads with the altered data. And it all works without a hitch...almost. What is happening is that the data is being appended to the already existing data, so the data is displaying twice.

I thought maybe it was a quirk with Netbeans, so I set up Tomcat as a development server, migrated everything over, and it is still doing the same thing, so I am assuming that it is some sort of caching issue, or just something that needs to be reconfigured in Tomcat.. or of course my approach is wrong and I need to re-visit my code.

I have Tomcat set so that my servlets are reloadable, but if I am understanding correctly, that only changes things if the source code of the servlet changes, and has nothing to do with the data. At any rate, I have been searching for two days pretty much non-stop, and apparently am not able to formulate the proper question... I don't want to reload the servlet, I want to refresh it before it is displayed, and I can't find how to do that, so before I continue scouring the Tomcat forums, I wanted to make sure there wasn't something I wasn't missing..

Thanks...

EDIT: I think I found someone with a similar issue..
http://www.coderanch.com/t/360943/Servlets/java/change-values-servlet-context

[ August 16, 2005: Message edited by: C Clites ]

EDIT 2: I have also tried the following;
Adding to my web.xml file, and adding

To my servlet.

[ August 16, 2005: Message edited by: C Clites ]
[ August 16, 2005: Message edited by: C Clites ]
 
Chad Clites
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I apologize for the double post, but I solved my propblem by learing my arraylist after the information had been read from it.... works like a champ now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!