Results 1 to 4 of 4
  1. #1
    raghu9198's Avatar
    raghu9198 is offline Member
    Join Date
    Dec 2008
    Posts
    32
    Rep Power
    0

    Default javascript variable

    hello everybody ,
    i have a doubt actually i am trying to assign a javascript variable to jsp variable is it possible to do that ???
    if so how can i do that ?????

    thanks
    raghu,

  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    8

    Default

    No, you can't do that. JSP code runs when the HTML is generated at the Web application server. Javascript runs when the HTML is rendered by the browser.

  3. #3
    lightstream is offline Member
    Join Date
    Jan 2009
    Posts
    9
    Rep Power
    0

    Default

    You could assign a JSP variable to a Javascript one easy enough but the other way round you're going to have to send data to the server one way or another (eg form post, AJAX)

  4. #4
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    Java Code:
    <% int number=10; %>
    <script language="JavaScript">
    var numb='<%=number%>';
    
    </script>

    But vice versa I have not seen.

Similar Threads

  1. JavaScript help
    By Jeremy720 in forum New To Java
    Replies: 1
    Last Post: 11-08-2008, 11:36 PM
  2. javascript
    By fiero in forum New To Java
    Replies: 1
    Last Post: 09-22-2008, 02:45 PM
  3. please help with javascript code!!!!
    By sahkab in forum New To Java
    Replies: 1
    Last Post: 11-26-2007, 04:20 PM
  4. Jsp and javascript
    By Ed in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 07-04-2007, 05:54 AM
  5. javascript validation
    By yuchuang in forum New To Java
    Replies: 5
    Last Post: 05-14-2007, 04:38 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
  •