• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet with JFreeChart RequestDispatcher to view

 
frank braunstein
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64613
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does it act like outside of Netbeans? How things act in an IDE is immaterial for real-world deployment.
 
frank braunstein
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic