html表单action属性值,HTML中的form表单中的action属性
用戶提問
在一本書中,在一個處理用戶注冊的html里,作者把action的值設為"regist.jsp",如下:
function on_submit()
{ if (form1.username.value=="")
{ alert("用戶名不能為空,請輸入用戶名!");
form1.username.focus();
return faldse;
}
if (form1.userpassword.value=="")
{ alert("用戶密碼不能為空,請輸入密碼!");
form1.userpassword.focus();
return false;
}
if(form1.reuserpassword.value=="")
{ alert("用戶確認密碼不能為空");
form1.reuserpassword.focus();
return false; }
if (form1.userpassword.value!=form1.reuserpassword.value)
{ alert("密碼與確認密碼不同!");
form1.reuserpassword.focus();
return false;
}
}
新用戶注冊新用戶注冊
用戶名(*):
密?碼(*):
再輸一次密碼(*):
性別:男女
但令人無語的是:作者沒有介紹該怎么寫regist.jsp。用瀏覽器訪問結果找不到regist.jsp
請問該如何編寫這個regist.jsp呢?
推薦答案
regist.jsp大概如下:
《%
String username=request.getParameter("username");
String userpassword=request.getParameter("userpassword");
String sex=request.getParameter("sex");
//以下這句是顯示用戶注冊添加的表單值
out.print("用戶名:"+username+"
密碼:"+userpassword+"
性別:"+sex);
//以下這句是往數據庫中插入記錄!
//String sql="insert into 用戶注冊表(用戶名,密碼,性別) values ("+username+","+userpassword+",'"+sex+"')";
//statement.executeUpdate(sql);
%》
注意把以上的《》換成英文狀態下的左右尖括號!
輔助答案
用戶:轟轟iooooo
2017年10月01日
要根據你的需求來編寫吧
用戶:pingfan121
2017年10月20日
建議先學習一下jsp語法,了解jsp是個什么東西,自然就知道怎么寫了!
總結
以上是生活随笔為你收集整理的html表单action属性值,HTML中的form表单中的action属性的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ppt生成器_小米发布会ppt词云怎么做
- 下一篇: css样式子绝父相,子绝父相_HTML+