aspose file tools
The moose likes JSP and the fly likes How can we put jsp or javascript code in java code on jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSP
Reply Bookmark "How can we put jsp or javascript code in java code on jsp" Watch "How can we put jsp or javascript code in java code on jsp" New topic
Author

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

Ravinder Partap Tanwar
Greenhorn

Joined: Jun 21, 2009
Posts: 2
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


- Ravinder Partap
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12612
You don't: the Java has executed before it gets to the client.
Anand Ramadurg
Greenhorn

Joined: Aug 14, 2008
Posts: 1
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 opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 48799

Please read The Secret Life of JSPs.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
 
subject: How can we put jsp or javascript code in java code on jsp
 
developer file tools