File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes javascript to jsp? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "javascript to jsp?" Watch "javascript to jsp?" New topic
Author

javascript to jsp?

Myel Gregory
Greenhorn

Joined: Jul 07, 2011
Posts: 2
i you help me guys converting javascript to jsp/servlet in net beans
the code is like this

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;
}

please help me.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

I have no idea what you are asking.

But, if you are asking if you can convert that JavaScript code to JSP code, then no, you cannot. The JavaScript code runs after the user has filled in values into the form. Any JSP code runs before the page is even sent to the browser, so there is no way that JSP code can access form values from a form that the user hasn't even seen yet.

Please read this article to understand how JSP works.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: javascript to jsp?
 
Similar Threads
tool tip problem?
javascript validation
what is the equivalent code on jsp?
Accessing invisible checkbox parameter
facing problem while submitting