By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 1,944 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

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

P: 1
Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <script type="text/javascript">
  3. function g() {
  4.     var q=s1;
  5.     document.getElementById("txt").value=q;
  6.     document.getElementById("lbl").value=s1;
  7. }
  8. </script>
  9. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  10. <title>Insert title here</title>
  11. </head>
  12. <body>
  13. <%
  14. String s1=(session.getAttribute("abc")).toString();
  15. out.print("<h1>The source from test2.jsp is as follows:</h1>");
  16. out.print("The value of s from test2.jsp: "+s1);
  17. %>
  18.  
  19. <div >
  20. <input type="button" id="btn" onclick="g()" value="Load"/>
  21. <input type="text" id="txt">
  22. <label id="lbl"></label>
  23. </div>
  24.  
  25. </body>
Jan 15 '15 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
do you want to do that in JavaScript or JSP?
Jan 15 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.