File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes what is the equivalent code on jsp? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Reply locked New topic

what is the equivalent code on jsp?

Myel Gregory

Joined: Jul 07, 2011
Posts: 2
i have a javascript code i want it on jsp can someone help me? my code is

var user = document.getElementById("username").value;

var pw1 = document.getElementById("password").value;
var pw2 = document.getElementById("password2").value;

if (user == '' || pw1 == '') {
document.getElementById("username").value = 'Please enter a username.';
document.getElementById("test").style.visibility = 'hidden';
document.getElementById("username").style.visibility = 'visible';
document.getElementById("test2").value = 'Please enter a password.';
document.getElementById("test2").style.visibility = 'visible';
return false;
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63548

Please do not post the same question more than once.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: what is the equivalent code on jsp?
It's not a secret anymore!