Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9165919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:01:26+00:00 2026-06-17T15:01:26+00:00

I have one jsp page which contains two text fields Start Date and End

  • 0

I have one jsp page which contains two text fields Start Date and End Date. User will input start date and end date and then I will query the database for data between those dates. When I click submit, it will just forward it to the current page and I will pass the dates as parameters. So far so good, but the problem is the image jfreechart does not refresh unless i refresh the browser itself.

Here is my form.

  <form method="GET" action='monitor' name="check">
  <table>
  <tr>
  <td>Start Date (dd/MM/yyyy format):</td>
  <td><input type="text" name="startDate"
  value="<%=startDate%>"></td>
  </tr>
  <tr>
  <td>End Date (dd/MM/yyyy format):</td>
  <td><input type="text" name="endDate" value="<%=endDate%>"></td>
  </tr>
  <tr>
  <td><input type="submit" value="check"></td>
  </tr>
  </table>
  </form>

  <img src="lineChart.png" width="600" height="400" border="0" usemap="#chart" />

Here is my inline code for generating the chart

   final File file1 = new File(getServletContext().getRealPath(".") + "/lineChart.png");
   ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info);

I tried doing writeChartAsPNG but it will overwrite the whole page. Page should still look like,

Start Date:
End Date: 

[ VIEW ] 

Monitor Data Chart
[  chart here ]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:01:28+00:00Added an answer on June 17, 2026 at 3:01 pm

    you’ll have to change things around pretty substantially to get the image to refresh inside the page when you click View, and you’ll end up writing a fair bit of javascript

    essentially what has to happen (which is pretty high level)

    1. make View a regular button, instead of a submit on the form.
    2. attach a click listener to the view button (check out the jQuery documentation for it’s click function)
    3. inside the listener, grab the values from the Start Date and End Date inputs
    4. set the src attribute of the image (using a mechanism like in this SO answer) to a jsp or servlet, sending the start and end dates as get variables (in the query string like ?startdate= ... &enddate= ...
    5. in that jsp or servlet, generate the chart and return the raw png output from jFreeChart with a content type of image/png (use response.setContentType("text/png")). This will display the image in the img tag correctly, and you won’t have to write a file out to the disk either.

    this process will update the image every time you hit View, with the values you input into your form.

    it’s a lot of steps, and I can’t really get into the nitty gritty of the implementation without knowing a whole lot more about your setup, but hopefully this will point you in the right direction

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one drop down list in my page, which contains two options. What
I have created one jsp form which contains the username textfield. On the click
I have written a small JSP page that contains a text box and a
I have 2 pages written in JSP the first page contains: <%@page contentType=text/html pageEncoding=UTF-8%>
I wonder if anyone can advise? I have a JSP which contains two forms,
I have a problem. I have used a jsp page which contains multiple frames.In
I have two jsp pages and one servlet. When user clicks submit button then
I have a jsp page which contains ten variables which I have to forward
In my JSF application I have one JSP page which keeps generating a warning
My problem is I have one html table in jsp page .And i applied

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.