首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

菜鸟级别的有关问题,望高手们解救

2011-12-23 
菜鸟级别的问题,望高手们解救现在老板要我开发一个系统,其中有个功能就是在JSP页面上进行对数据库的某个字

菜鸟级别的问题,望高手们解救
现在老板要我开发一个系统,其中有个功能就是在JSP页面上进行对数据库的某个字段进行 "增、删、改 ",听高手们说实现这个功能不难,我现在急阿,到底怎么开发阿。。。。有现成的代码可以看看吗?望高手们解救下小弟。。

[解决办法]
虽然简单 但是涵盖的内容很多 。。。
[解决办法]
那得看啥要求了,最簡單的就是在JSP里直接連數據庫,再寫個方法類
[解决办法]
什么叫不通过数据库,你用jdbc连接操作数据库就是通过数据库呀
[解决办法]
如果是刚开始要学还没学的学生这么问还情有可原,楼主怎么可以开始工作还问这样的入门问题呢???
这个问题好解决,因为还是入门级的,以后的诸多进阶问题又怎么办呢?
如果楼主认为利用业余时间自学能来得及,也不必在这里问了。
真为楼主感到不乐观啊。
出于交流学习,我还是列一个例子吧,其中涉及的类较多,不能一一给出,明白原理,根据实际情况修改即可:

这是添加数据的前台页面:admin_add.jsp

<%@ page contentType= "text/html; charset=GBK " %>

<html>
<head>
<title> JSP数据库数据操作前台界面 </title>
<meta http-equiv= "Content-Type " content= "text/html; charset=GBK ">
<link href= "../css/style.css " rel= "stylesheet " type= "text/css ">
</head>
<script languge= "javascript ">
function adduser()
{
if(isFilled(pages.user_name)==false)
{
alert( "真实姓名不能为空或含有非法字符! ");
pages.user_name.focus();
return false;
}
if(isFilled(pages.user_code)==false)
{
alert( "登陆名不能为空或含有非法字符! ");
pages.user_code.focus();
return false;
}
if(isFilled(pages.user_password)==false)
{
alert( "密码不能为空或含有非法字符! ");
pages.user_password.focus();
return false;
}
if(pages.user_repassword.value== " ")
{
alert( "请确认密码! ");
pages.user_repassword.focus();
return false;
}
if(pages.user_password.value!=pages.user_repassword.value)
{
alert( "密码确认错误! ");
pages.user_repassword.focus();
}
else
{
pages.action = "admin_refer.jsp ";
pages.submit();
}
}
function isFilled(elm)
{
var temp = " ";
var string=elm.value;
string = " " + string;
splitstring = string.split( " ");
for(i = 0; i < splitstring.length; i++)
temp += splitstring[i];
if (temp == " " || temp == null)
return false;
else {
if(isSpec(elm))
return false;
else
return true;
}
}
function isSpec(elm)
{
var digits= " <> '\ "#&?*!%$^& "
for (var i=0;i <elm.value.length;i++){
temp=elm.value.substring(i,i+1)
if (digits.indexOf(temp)!=-1){
return true;
}
}
return false ;
}
function home_click()
{
pages.action= "admin_list.jsp "
pages.submit();
}
</script>
<form name= "pages " method= "post " action= " ">
<input type= "hidden " name= "type " value= "add " >
<BODY bgcolor= "#ffeff7 " leftmargin= "0 " topmargin= "0 " marginwidth= "0 " marginheight= "0 ">


<table width= "98% " border= "0 " cellspacing= "0 " cellpadding= "0 " align= "center ">
<tr>
<td bgcolor= "#FF97BE " height= "25 "> <div align= "center "> <font color= "#FFFFFF "> <b> 用
户 添 加 </b> </font> </div> </td>
</tr>
<tr>
<td bgcolor= "#FFDDEA "> <p> &nbsp; </p> <table width= "60% " border= "0 " align= "center " cellspacing= "1 " bgcolor= "#999999 " class= "tableBorder ">
<tr>
<td width= "18% " bgcolor= "f7f7f7 ">
<div align= "left "> 登 陆 名: </div> </td>
<td width= "82% " align= "left " bgcolor= "f7f7f7 ">
<input name= "user_code " type= "text " size= "25 " class= "photo_boder " maxlength= "20 ">
<font color= "red " size= "3 "> * </font> </td>
</tr>
<tr>
<td width= "18% " bgcolor= "#FFFFFF ">
<div align= "left "> 真实姓名: </div> </td>
<td width= "82% " align= "left " bgcolor= "#FFFFFF ">
<input name= "user_name " type= "text " size= "25 " class= "photo_boder " maxlength= "20 ">
<font color= "red " size= "3 "> * </font> </td>
</tr>
<tr>
<td width= "18% " bgcolor= "f7f7f7 " >
<div align= "left "> 密  码: </div> </td>
<td width= "82% " align= "left " bgcolor= "f7f7f7 ">
<input name= "user_password " type= "password " size= "25 " class= "photo_boder " maxlength= "20 ">
<font color= "red " size= "3 "> * </font> </td>
</tr>
<tr bgcolor= "#FFFFFF ">
<td width= "18% ">
<div align= "left "> 确认密码: </div> </td>
<td width= "82% " align= "left ">
<p>
<input type= "password " class= "photo_boder " name= "user_repassword " size= "25 " maxlength= "20 ">
<font color= "red " size= "3 "> * </font> </p> </td>
</tr>
</table>
<br>
<table align= "center ">
<tr>
<td width= "15% " height= "25 " align= "right "> <div align= "center ">
<input name= "Submit " type= "button " class= "button " value= "提 交 " onClick= "javascript:adduser(); ">
</div> </td>
<td width= "35% " height= "25 "> <div align= "center ">
<input name= "Submit2 " type= "reset " class= "button " value= "清 空 " >
</div> </td>
</tr>


</table> </td>
</tr>
<tr>
<td height= "30 "> <div align= "center "> </div> </td>
</tr>
</table>
</body>
</form>
</html>

热点排行