Results 1 to 3 of 3
  1. #1
    athrunzala12 is offline Member
    Join Date
    Apr 2014
    Posts
    1
    Rep Power
    0

    Default Ajax in servlet to change value of variable.

    Good day guys!

    I have a servlet that creates a web interface thorught ajax. Something like this...

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
    IOException {
    PrintWriter ajax = new PrintWriter(response.getOutputStream());
    String action = request.getParameter("action");

    if ("start".equals(action)) {
    if (sched != null) {
    try {
    JobDetail jd =
    new JobDetail(JOB_NAME, GROUP_NAME, MMPreProcessorSchedulerJob.class);
    CronTrigger cronTrigger =
    new CronTrigger(TRIGGER_NAME, GROUP_NAME);
    String cronExpr = "0 0, 3, 6 * * ?";
    }
    }
    ajax.println("<html>");
    ajax.println(" <head>");
    ajax.println(" <title>MMPreProcessorScheduler - Web Interface</title>");
    ajax.println(" <link rel=\"stylesheet\" type=\"text/css\" href=\"css/mystyle.css\"></link>");
    ajax.println(" </head>");

    What I want is for my web interface to accept an input through a text field and and store that value on CronExpr variable which will be used by my servlet. How is this possible? I'm still a beginner with java.

    Thank You IA :)

  2. #2
    sehudson's Avatar
    sehudson is offline Senior Member
    Join Date
    Mar 2010
    Posts
    354
    Rep Power
    5

    Default Re: Ajax in servlet to change value of variable.

    You can get the value from the input field, and pass it as a parameter.
    Is that what you are trying to do?
    Last edited by sehudson; 06-02-2014 at 05:17 PM.

  3. #3
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    441
    Rep Power
    6

    Default Re: Ajax in servlet to change value of variable.

    Hi,

    I am not sure whether your servlet is working without any issues. If it's working fine, you could use request.getParameter() to get the input value.
    Mak
    (Living @ Virtual World)

Similar Threads

  1. flush data from servlet to jsp with ajax
    By Laerion in forum Advanced Java
    Replies: 1
    Last Post: 04-10-2011, 08:00 AM
  2. AJAX - JSP to Servlet simple sample pls
    By kurorolucifer15 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 02-20-2011, 07:58 AM
  3. Need ajax implementation of servlet?
    By alok_sharma in forum Java Servlet
    Replies: 0
    Last Post: 11-19-2010, 11:04 AM
  4. Ajax / servlet File upload
    By n3mesi83 in forum Java Servlet
    Replies: 0
    Last Post: 06-08-2010, 02:48 PM
  5. how to contact servlet from clientside through ajax
    By santhoskumara in forum Advanced Java
    Replies: 2
    Last Post: 08-10-2007, 06:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •