Results 1 to 2 of 2
  1. #1
    sauravsinha is offline Member
    Join Date
    Mar 2010
    Posts
    10
    Rep Power
    0

    Question how to access JSP variable in javascript

    Can anybody suggest me a way to access JSP variable in javascript.Actually I want to access a variable kept in session earlier and use it in javascript to check with the current value supplied in the text field. Is it possible if I write
    var abc=<%=session.getAttribute("xyz");%>

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    835
    Rep Power
    6

    Default

    You can use..is the above object return value is String....then u should use it like this below

    var abc='<%=session.getAttribute("xyz");%>'
    Ramya:cool:

Similar Threads

  1. Default Access (package access) confusion
    By gauravrajbehl in forum New To Java
    Replies: 1
    Last Post: 11-18-2009, 10:48 AM
  2. javascript variable
    By raghu9198 in forum New To Java
    Replies: 3
    Last Post: 01-29-2009, 07:42 AM
  3. Replies: 1
    Last Post: 08-07-2007, 07:51 AM
  4. variable access from another file
    By riadmazloum in forum AWT / Swing
    Replies: 1
    Last Post: 08-06-2007, 07:13 PM
  5. Access a variable
    By Eric in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 08:29 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
  •