• Post Reply Bookmark Topic Watch Topic
  • New Topic

How can we put jsp or javascript code in java code on jsp  RSS feed

 
Ravinder Partap Tanwar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can we pass the input of jsp page on the java code in the same jsp?

for e.g. I want to put value of Gender field from the jsp into the java Variable gender.

document.form[0].gender.value

<%
String gender = document.form[0].gender.value;
%>

Thanks and Regards
Ravinder Partap
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't: the Java has executed before it gets to the client.
 
Anand Ramadurg
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ravinder,

Javascript will be executed at client side ( Browser) while scriplet ( i.e java code written in jsp ) will be executed at the server side. I don't know, what you are trying to achieve here.. May be you should explain your problem in detail...

Please go through this link... http://java.sun.com/products/jsp/html/jspbasics.fm.html
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!