This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I am trying to plot a quadratic curve in a servlet which will display the output as a pdf file. I am not sure if Graphics2D in java.awt.Graphics2D can be used in servlet, so i gave it a try. I face some problems as described below:
My servlet code:
Error shown by Eclipse:
public void paint(Graphics g)
Suggestion by Eclipse: "Void is an invalid type for the variable paint" (This wasn't a problem if it is a normal Java file, not a servlet)
Error shown by Eclipse:
doc.add(new Paragraph(quadcurve));
Suggestions by Eclipse: 1. "Remove argument to match Paragraph();" > Doing so will remove the quadcurve
2. "Change type of quadcurve to float" > But quadcurve is not a float in the first place.
Any help to resolve this issue will be greatly appreciated.
Ulf Dittmer wrote:You can't have a method inside of a method.
I'm not quite sure what you're trying to do, but I very much doubt that it's going to work. The Servlet API has no provisions for a "paint" method.
I am trying to draw Quadratic curves with my Servlet which will then output the curve in pdf format. I thought I can achieve that using Graphics2D in the java.awt.Graphics2D. So, can I say that Graphics2D is not supported in servlet?