Results 1 to 6 of 6
  1. #1
    kulangotski is offline Senior Member
    Join Date
    Feb 2009
    Posts
    117
    Rep Power
    0

    Default a little question about on the sequence of actions done by a servlet

    hi thanks for reading.

    I just would like to know what executes when you have an html button inside a form.?
    and this is how my button is written

    Java Code:
    <input type = "submit" onClick="jScriptMethod()" value="Edit">
    this piece of button is inside a form. and the container form has an action point to a servlet. now my question is, because there is an onclick action too here. what triggers first?

    when I click a button, does it do the onclick method first? or does it submit the form data straight to the servlet? thanks!

    all answers would be appreciated, thank you :D

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default

    Not actually a Java question, but...the onClick fires first. It's often used to validate a form prior to actually submitting.

  3. #3
    only_java is offline Member
    Join Date
    Mar 2011
    Posts
    16
    Rep Power
    0

    Default

    First your onClick="jScriptMethod()" will be called and then form will be submitted.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default

    Are you just going to repeat answers already given...in old threads?

    Anyone would think you were simply trying to get your post count up...

  5. #5
    asmitarnd is offline Member
    Join Date
    Mar 2011
    Posts
    22
    Rep Power
    0

    Default

    onclick is fired first then servlet action

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,817
    Rep Power
    19

    Default

    Why are you answering questions that have already been answered?

Similar Threads

  1. Servlet Mapping question.
    By Mega Man X in forum Java Servlet
    Replies: 2
    Last Post: 02-17-2010, 02:15 PM
  2. Linked list sequence and array sequence
    By Predz in forum New To Java
    Replies: 1
    Last Post: 12-31-2009, 01:30 AM
  3. Question regarding url-pattern in Servlet
    By basark in forum Java Servlet
    Replies: 1
    Last Post: 09-06-2008, 01:05 PM
  4. Servlet Question
    By sandor in forum Java Servlet
    Replies: 5
    Last Post: 12-19-2007, 11:27 AM
  5. Servlet question
    By Peter in forum Java Servlet
    Replies: 2
    Last Post: 07-04-2007, 01:34 PM

Posting Permissions

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