Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes Servlet with JFreeChart RequestDispatcher to view Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet with JFreeChart RequestDispatcher to view" Watch "Servlet with JFreeChart RequestDispatcher to view" New topic
Author

Servlet with JFreeChart RequestDispatcher to view

frank braunstein
Ranch Hand

Joined: Dec 17, 2009
Posts: 60
Hello,
i dont get the hang out of this:

I have an html.file with a <form action="doAction">-tag that forwards to a servlet. This servlet creates a "chart.png"-file and then forwards the request and the response to the view (result.jsp). Sadly the view cant use the previously created chart.png at compilation time, since it takes its time to write the file. So the result shows only a missing img-frame. After a few seconds or so the chart.png-file appears in Netbeans under the Folder specified. Of course the second attempt does display a chart.png, but i need it at request time. Haha! That was funny!

I need the chart to be fully written, when the result.jsp <img src="FOLDERS/chart.png"> builds the html output.

What can i do?

EDIT 1:
I will try to stuff the code that creates the chart.png-file into a thread within the servlet. I dont like this workaround, it causes a delay, which i dont want! Hints please.

EDIT 2:
The problem remains even with a Thread.sleep(30000);, the problem is the Netbeans IDE, which does the refresh of the pic-containing folder. The refresh does happen when the user maximizes the IDE.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61608
    
  67

What does it act like outside of Netbeans? How things act in an IDE is immaterial for real-world deployment.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
frank braunstein
Ranch Hand

Joined: Dec 17, 2009
Posts: 60
Bear Bibeault wrote:What does it act like outside of Netbeans? How things act in an IDE is immaterial for real-world deployment.


Actually after redeployment, by the way configuring JCreator -with all corresponding jar-files neccessary to use JFreechart- and a stand-alone-Tomcat *sigh*. This outside-netbeans-ide solution worked.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet with JFreeChart RequestDispatcher to view