Results 1 to 3 of 3
  1. #1
    fierof2 is offline Member
    Join Date
    Jul 2010
    Posts
    24
    Rep Power
    0

    Default URL parameters not getting passed during javascript submit

    I am doing form submit from javascript when a image is clicked. Below is the form tag in my code

    <form name="tictactoe" id="tictactoe" method="GET" action="GameAction">

    The image is present in the form tag. When i click the image i call a java script method shown below

    Java Code:
        function selection(selected){  
            theform = window.document.tictactoe;  
            theform.action="GameAction?selection=selected.id";  
            theform.submit();  
        }
    The problem I am facing is the page gets submitted but i am not able to receive the parameter "selection" in the server.
    request.getParameter("selection") is coming as null.

    It would be great if someone would help in resolving this problem. I tried googling but didn't get a solution.

  2. #2
    fierof2 is offline Member
    Join Date
    Jul 2010
    Posts
    24
    Rep Power
    0

    Default Re: URL parameters not getting passed during javascript submit

    I found the solution. I had to use the POST method to make it work.

  3. #3
    gopakumar is offline Member
    Join Date
    Oct 2011
    Posts
    3
    Rep Power
    0

    Default Re: URL parameters not getting passed during javascript submit

    This is somewhat confusing , can you just elaborate what was the problem and how did you solve it?
    As you said it was showing null value in servlet.. The servlet might be having doGet()...(as your form method is "get").
    How can it work , if you change the same to "Post"?

Similar Threads

  1. hiding passed parameters using window.location.href = 'params' method
    By kulangotski in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 07-01-2011, 12:49 PM
  2. Replies: 5
    Last Post: 11-21-2010, 02:08 PM
  3. entities are passed by value or passed by reference
    By syntrax in forum New To Java
    Replies: 1
    Last Post: 12-17-2009, 07:13 AM
  4. passing parameters to next jsp using javascript
    By sridevisala in forum New To Java
    Replies: 0
    Last Post: 11-20-2009, 05:34 AM
  5. Cannot get passed these syntax errors
    By MrKP in forum New To Java
    Replies: 1
    Last Post: 05-12-2008, 07:05 AM

Tags for this Thread

Posting Permissions

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