how to put the value of the session in the text field and label with id "txt" and "lb

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • adonis11
    New Member
    • Jan 2015
    • 1

    #1

    how to put the value of the session in the text field and label with id "txt" and "lb

    Code:
    <head>
    <script type="text/javascript">
    function g() {
    	var q=s1;
    	document.getElementById("txt").value=q;
    	document.getElementById("lbl").value=s1;
    }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <%
    String s1=(session.getAttribute("abc")).toString();
    out.print("<h1>The source from test2.jsp is as follows:</h1>");
    out.print("The value of s from test2.jsp: "+s1);
    %>
    
    <div >
    <input type="button" id="btn" onclick="g()" value="Load"/>
    <input type="text" id="txt">
    <label id="lbl"></label>
    </div>
    
    </body>
    Last edited by Dormilich; Jan 15 '15, 09:57 AM. Reason: please use code tags when posting code
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    do you want to do that in JavaScript or JSP?

    Comment

    Working...