⑴ 如何用eclipse寫登錄注冊頁面的代碼
java寫的用戶登錄實例,實際頁面展示使用的jsp,那麼下面是jsp的登錄頁面代碼:
1、login.jsp代碼
<%
string name = request.getparameter("username");
string pwd = request.getparameter("password");
//out.println(name+pwd);
string sql ="select * from info where username='"+name+"' and password='"+pwd+"'";
//out.println(sql);
statement stm= null;
resultset rs =null;
try
{
stm = conn.createstatement();
rs = stm.executequery(sql);
if(rs.next())
{
session.setattribute("username",name);
response.sendredirect("index.html");
}
else
{
response.sendredirect("index1.html");
}
}
catch(sqlexception e)
{
e.printstacktrace();
}
%>
<!--登錄的表單-->
<form name="form1" method="post" action="login.jsp">
<p>
<label for="username"></label> 用戶名
<input type="text" name="username" id="username">
</p>
<p>
<label for="passwrod"></label> 密碼
<input type="text" name="passwrod" id="passwrod">
</p>
<p>
<input type="submit" name="button" id="button" value="提交">
</p>
</form>
2、用戶信息表,存放用戶名和密碼:
user_info 表
create table if not exists `test` (
`id` int(8) not null auto_increment,
`username` char(150) default null,
`password` varchar(32),
`times` int(4) not null,
primary key (`id`)
) engine=myisam default charset=utf8 auto_increment=1 ;
⑵ 前端代碼難不難學
CSS和HTML、JavaScript這是前端學習的三個語言,其中HTML是自簡單,設計到代碼多的就是CSS、JavaScript,入,門簡單,達到初級前端水平很容易。但是精通各種框架需要一定學習實踐
1、CSS和HTML
剛入門的朋友,應該把重點放在 CSS和HTML基礎知識的學習上。關於 CSS(3) 你需要了解以下一些知識點:web標准、HTML相關概念、HTML標簽、路徑相關概念、錨點及其他、表格標簽、表單標簽、綜合案例,注冊頁面、CSS選擇、CSS字體樣、CSS外觀屬性、調式、CSS復合選擇器、標簽顯示模式、CSS背景、CSS三大特性等等。總的來講,CSS和HTML的學習還是比較簡單的。
2、JavaScript
JavaScript一直都是前端工程師進步的基石, JavaScript 的理解深度決定了前端開發者的職業發展。關於JavaScript的學習內容包括了瀏覽器執行JS過程、JS變數、數據類型、運算符、流程式控制制語句(if else 、三元表達式、switch)、循環(for、while、do while)、數組、冒泡排序、函數、作用域、預解析、對象、內置對象、簡單類型和復雜類型等。只有在熟悉了JavaScript基礎語法的基礎上,我們才能繼續深入學習前端技術。
前端需要掌握這些基本技能
精通html,能夠書寫語意合理,結構清晰,易維護的html結構;
精通css,能夠還原視覺設計,並兼容業界承認的主瀏覽器;
熟悉javascript,了解ECMAscript基礎內容,掌握至少兩種js框架
⑶ 前端注冊調用介面 需要什麼欄位
先定義一個簡單的webapi,簡單到差不多...
1
前端代碼中載入jquery,在定義四個按鈕...
2
get和post,我習慣用$.get和$.post,當...
3
put和delete,只能用$.ajax來處理。
⑷ 求大神寫一下jsp的簡單的注冊界面代碼。
1.需要一個jsp頁面:
//login.jsp核心代碼:
<form action="${pageContext.request.contextPath}/servlet/UserServlet" method="post">
<input type="text" name="loginname" /><input type="password" name="password"/>
<input type="submit" value="登錄"/>
</form>
2.需要一個servlet來驗證登錄信息
//UserServlet 核心代碼
class UserServlet extends HttpServlet{
protected void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
process(request, response);
}
protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
process(request, response);
}
private void process(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
PrintWriter pw = response.getWriter();
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html");
String loginname = request.getParameter("loginname");
String password = request.getParameter("password");
//創建一個service來處理業務邏輯(包括查詢資料庫操作)
UserService service = new UserService();
boolean bool = service.validateUser(loginname,password);
if(!bool){
pw.println("用戶名或密碼錯誤");
}else{
pw.println("登錄成功");
}
}
3.需要一個service處理業務邏輯(包括查詢資料庫操作)
//UserService 核心代碼
public class UserService{
/**
*查詢資料庫驗證用戶是否存在,返回boolean
*/
public boolean validateUser(String loginname,String password){
boolean bool = false;
Connection conn = null;
PreparedStatement ps = null;
//這里以mysql為例
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "");
String sql = "select login_name,pass_word from t_user where login_name=? and pass_word=?";
ps = conn.prepareStatement(sql);
ps.setString(0, loginname);
ps.setString(1, password);
ResultSet rs = ps.executeQuery();
if(rs.next()){
bool = true;
}
} catch (Exception e) {
e.printStackTrace();
} finally{
try {
if(conn != null){
conn.close();
conn = null;
}
if(ps != null){
ps.close();
ps = null;
}
} catch (SQLException e) {
e.printStackTrace();
}
}
return bool;
}
}
⑸ 注冊頁面html中的登錄按鈕代碼
<input type="button" name="submit" value="Log in" class="left" onclick="OnSubmits()" />
⑹ 前端代碼是怎麼弄的
Web前端開發技術包括三個要素:HTML、CSS和JavaScript,但隨著RIA的流行和普及,Flash/Flex、Silverlight、XML和伺服器端語言也是前端開發工程師應該掌握的。Web前端開發工程師既要與上游的交互設計師、視覺設計師和產品經理溝通,又要與下游的伺服器端工程師溝通,需要掌握的技能非常多。這就從知識的廣度上對Web前端開發工程師提出了要求。如果要精於前端開發這一行,也許要先精十行。然而,全才總是少有的。所以,對於不太重要的知識,我們只需要「通」即可。但「通」到什麼程度才算夠用呢?對於很多初級前端開發工程師來說,這個問題是非常令人迷惑的。 總之前端學習了這些就夠了:div+css+javascript+flash+xml
⑺ 網頁中怎樣點注冊按鈕進入注冊頁面,代碼是什麼
這個問題有點.....
常規的點擊注冊按鈕進入注冊頁面是超鏈接,點擊後會跳轉到新頁面
如 跳轉頁面是b頁面的話
<a href="b頁面">注冊</a>
只要利用一句非常普通的html代碼就可以實現。
當然,注冊按鈕也有圖像或者css仿圖像模式,這個涉及到css(樣式表)。
注冊頁面是一個表單的提交,要用到資料庫.. 數據提交也設置編程,編程有很多種語言,常見的asp,php,.net,java...很多
想學的話很簡單,網路搜一下w3cschool 去學一下就可以了,還有很多視頻教程。
⑻ 游戲注冊頁面js代碼怎麼寫
//郵箱,用戶名,密碼正則已經驗證完成的情況下
varbtn=$("#targetBtn");
btn.on("click",function(){
varusername=$("#username").val(),
password=$("#password").val(),
email=$("#email").val;
if(username==""){
alert("請填寫用戶名");
returnfalse;
}
//...此處省略if判斷
$.ajax({
url:"...",
type:POST,
data:{"..."},//這里寫提交的數據
success:function(data){
if(data.message=="success"){
alert("注冊成功")
}
}
})
⑼ 注冊/登陸頁面HTML代碼該怎麼寫
以下為個人原創教學例子,任何人引用需註明出自網路知道用戶am7972,樓主可供參考
該例子涵蓋了文本框、密碼框、下拉菜單、單選框、復選框及文本區的使用
同時在數據的使用方面涵蓋了文本型、數值型、日期型、布爾型的使用
也涵蓋了在會員信息入資料庫前,進行嚴格的數據檢查
不足處,JS驗證還不是太完善,不過有服務端認證足夠了
<title>會員注冊</title>
<script type="text/javascript">
<!--function CheckForm()
{
if(document.userinfo.username.value == "")
{ alert("請輸入姓名,姓名不能為空!");
document.userinfo.username.focus();
return false;
}
if(document.userinfo.username.value.length > 10)
{
alert("輸入的姓名長度最多為10個字元!");
document.userinfo.username.focus();
return false;
}
}
//--></script>
</head>
<body>
<table border="1" width="53%" bordercolorlight="#000000" cellspacing="0" id="table1" height="358" bordercolor="#000000" bordercolordark="#FFFFFF" cellpadding="0">
<form method="POST" action="bb.asp" name="userinfo" onsubmit="return CheckForm();">
<tr><td colspan="2" height="37"> <p align="center">會員注員</td> </tr>
<tr> <td width="37%" align="right">姓名:</td> <td width="61%"> <input type="text" name="username" value="libin" size="13"> </td> </tr>
<tr> <td width="37%" align="right">密碼:</td> <td width="61%"> <input type="password" name="userPassword" size="20" value="123"></td> </tr>
<tr> <td width="37%" align="right">性別:</td> <td width="61%"><input type="radio" value="True" checked name="Sex">男 <input type="radio" name="Sex" value="False">女</td> </tr>
<tr> <td width="37%" align="right">生日:</td> <td width="61%"> <input type="text" name="userSR" size="11" value="1985-03-12"></td> </tr>
<tr> <td width="37%" align="right">年齡:</td> <td width="61%"><input type="text" name="userNL" size="9" value="13"></td> </tr>
<tr> <td width="37%" align="right">愛好:</td> <td width="61%"> <input type="checkbox" name="ah" value="sw">上網 <input type="checkbox" name="ah" value="ds" checked>讀書 <input type="checkbox" name="ah" value="ty">體育</td> </tr>
<tr> <td width="37%" align="right">上網方式:</td> <td width="61%">
<select size="1" name="swfs"> <option selected value="bhsw">撥號上網</option> <option value="wxsw">無線上網</option> <option value="gxsw">光纖上網</option> </select>
</td> </tr>
<tr> <td width="37%" align="right">個人簡介:</td> <td width="61%"><textarea rows="9" name="userGrjs" cols="34"></textarea></td> </tr> <tr> <td colspan="2" height="38"> <p align="center"><input type="submit" value="提交" name="B1"> <input type="reset" value="重置" name="B2"></td>
</tr>
</form>
</table>
====bb.asp的會員注冊非法數據監測====
<%
username = Request("username")
userPassword = Request("userPassword")
Sex = Request("Sex")
userSR = Request("userSR")
userNL = Request("userNL")
ah = Request("ah")
swfs = Request("swfs")
userGrjs = Request("userGrjs")
'判斷數據合法性,絕對不能讓非法數據進入系統
'判斷姓名username合不合法,是否包含非法數據
username = Trim(username) '例如:" 張 三 "經過處理之後變成"張 三"
If username ="" Then
Response.write "姓名不能為空"
Response.End
End If
If Len(username)>10 Then
Response.write "姓名字數不能超過10個字" 'Len("Z")=1 Len("國")=2
Response.End
End If
For i = 1 To Len(username)
q = Mid(username,i,1)
If InStr("!@#$%^&*()_-+|<>?/"",.",q)>0 Then
Response.write "姓名不能包含特殊符號!@#$%^&*()_-+|<>?/"",."
Response.End
End If
Next
'判斷密碼合不合法,是否包含非法數據userPassword = Trim(userPassword)If userPassword ="" Then Response.write "密碼不能為空" Response.EndEnd If
If Len(userPassword)>20 Then
Response.write "密碼字數不能超過20個字"
Response.End
End If
'判斷密碼合不合法,是否包含非法數據
Sex = Trim(Sex)
If Sex = "" Then
Response.write "性別不能為空"
Response.End
End If
If Sex <> "True" And Sex <> "False" Then
Response.write "性別不能為不男不女"
Response.End
End If
'判斷生日合不合法,是否包含非法數據
userSR = Trim(userSR)
If userSR ="" Then
Response.write "生日不能為空"
Response.End
End If
If Len(userSR)<8 Or Len(userSR)>10 Then '例如:2012-6-3 2012-11-23
Response.write "你輸入的生日字數不對,應為2012-6-3或2012-11-23格式"
Response.End
End If
If IsDate(userSR)=False Then
Response.write "你輸入的生日格式不能轉化為日期,請核實"
Response.End
End If
If DateDiff("yyyy",userSR,Date())<1 Or DateDiff("yyyy",userSR,Date())>200 Then
Response.write "根據你輸入的生日你可能小於1歲或已經超過200歲了,請核查重新輸入"
Response.End
End If
'判斷年齡合不合法,是否包含非法數據userNL = Trim(userNL)If userNL ="" Then
Response.write "年齡不能為空"
Response.End
End If
If IsNumeric(userNL)=False Then
Response.write "你輸入的年齡不能轉化為數值,請核查"
Response.End
End If
userNL = CInt(userNL)
If userNL<0 Or userNL>200 Then
Response.write "你輸入的年齡不能小於0歲或者大於200歲,請核查"
Response.End
End If
'判斷愛好合不合法,是否包含非法數據ah = Trim(ah) '選擇多個愛好則系統會用,分開 //測試
ah = Replace(ah," ","")
arrAh = Split(ah,",")
For i = LBound(arrAh) To UBound(arrAh)
If arrAh(i)<>"sw" And arrAh(i)<>"ds" And arrAh(i)<>"ty" Then
Response.write i & "你選擇的愛好有問題,請核查" & arrAh(i)
Response.End
End If
Next
'判斷上網方式合不合法,是否包含非法數據swfs = Trim(swfs)If swfs = "" Then
Response.write "上網方式不能為空"
Response.End
End If
If swfs<>"bhsw" And swfs<>"wxsw" And swfs<>"gxsw" Then
Response.write "你選擇的上網方式有問題,請核查"
Response.End
End If
'判斷個人簡介是否為空,是否超出1000個字
userGrjs = Trim(userGrjs)
If userGrjs = "" Then
Response.write "個人簡介不能為空"
Response.End
End If
If Len(userGrjs) > 1000 Then
Response.write "個人簡介不能超過1000個字"
Response.End
End If
Response.write "數據合法性檢測通過"
%>
====登陸的HTML代碼可相信樓主參照會員注冊代碼應該沒問題了====
⑽ 前端怎麼實現登錄和注冊
登錄注冊設計到數據儲存和讀取,需要後端代碼的支持下才能前端