i am new to JSP and this is my first trial on JSP
i have a table "des"
1. id - auto increment
2. desn - varchar(50)
and i wanted to access the table data on my JSP(index.jsp) file:
<%@ page import="java.sql.*" %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Add Employee</title> <script>
function set_val(spn,vl){
if(vl){
document.getElementById(spn).style.color="Green";
document.getElementById(spn).innerHTML="Valid!";
}
else{
document.getElementById(spn).style.color="Red";
document.getElementById(spn).innerHTML="Invalid Entry!!";
}
}
function validate_name(x){
var patt = /^[a-zA-Z]{4,30}$/;
if(patt.test(x.value)){
set_val("val_name",true);
}
else{
set_val("val_name",false);
}
}
function validate_addr(x){
var patt = /^[-a-zA-Z\s\,\.]{5,50}$/;
if(patt.test(x.value)){
set_val("val_addr",true);
}
else{
set_val("val_addr",false);
}
}
</script> </head> <body> <form action="addnverify.jsp" method="post" name="empp"> <table width="80%" align="center" border="1px" cellpadding="1px" cellspacing="1px"> <tr><TH colspan="3">Employee Registration</TH></tr> <tr> <th align="left">Name</th> <td><input type="textbox" onblur="validate_name(this);" name="empname"></td> <td><span id="val_name" style="text-align: right;"></span> </tr> <tr> <th align="left">Address</th> <td><textarea rows="5" cols="50" onblur="validate_addr(this);" name="empaddr">