注册页面源码
Ⅰ 表单注册页面代码
谁会为那几个没什么实际意义的网络分给你做这么累的事哦???
Ⅱ java注册页面代码
很简单,
建一个叫student的对象,然后给他几个属性。
存在一个list里就行了,
登录的时候就便利这个list,发现有一样的,就给他进去,没有就报错。
你用可以存key和valu的容器也行。
Ⅲ 网页设计里的注册源代码
是jsp吗,还是asp什么的
首先数据库连接没问题,且库中有测试用户名和密码,我这里有一个拿去参考吧~
输入页面加入<from>表单,将用户输入内容提交到validation.jsp进行验证。
<form name="myform" action="validation.jsp" method="post">
<table cellSpacing="0" cellPadding="0" width="100%" border="0" height="143" id="table212">
<tr>
<td width="13%" height="38" class="top_hui_text"><span class="login_txt">用户: </span></td>
<td height="38" colspan="2" class="top_hui_text"><input name="username" class="editbox4" value="" size="20"> </td>
</tr>
<tr>
<td width="13%" height="35" class="top_hui_text"><span class="login_txt"> 密码: </span></td>
<td height="35" colspan="2" class="top_hui_text"><input name="userpass" class="editbox4" type="password" size="20" >
<img src="images/luck.gif" width="19" height="18"> </td>
</tr>
<td height="35" > </td>
<td width="10%" height="35" ><input name="Submit" type="submit" class="button" id="Submit" value="登 陆" onclick="return valid()"> </td>
<td width="80%" class="top_hui_text"><input name="cs" type="reset" class="button" id="cs" value="取 消"></td>
</tr>
</table>
<br>
</form>
然后第二个页面validation.jsp接收数据,验证通过后进入其他页面,比如'login.jsp'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>活动日志</title>
</head>
<%//接收客户端提交的数据
String username=request.getParameter("username");
String pass=request.getParameter("userpass");
try{
ResultSet rs=inBean.executeQuery("select * from employees where emp_name='"+username+"' and emp_pwd='"+pass+"'");//执行sql语句并返回结果
if(rs.next())
{ out.print("<script>window.location='login.jsp' </script>");
}
else{
// out.print("登陆失败");
out.print("<script>alert('用户名或密码错误,请重新登录...'); window.location='index.jsp' </script>");
// response.sendRedirect("index.jsp.html");
}
//rs.close();
rs.close();
}
catch(SQLException e1){out.println("SQL异常!");}
%>
<%session.setAttribute("userinfo", username); %>
<body>
</form>
</body>
</html>
Ⅳ 网页中加入用户名、密码、登陆及新用户注册源代码
如果在网络中使用登陆机制一般都需要数据库支持具体的代码,特别是数据库操作部分和自身的数据库各表及字段名称有关,同时实现的方式还有很多特殊情况的处理,在这里很难提供,并且从安全的角度讲,登陆与注册也不易放置在同一页面,同时还要有数据审核处理页面,甚至可以说这需要一个系统。,建议你到免费的源代码基地去找。
Ⅳ 求struts2的注册页面(含数据库连接+插入数据)的源代码,
首先是页面
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<base href="<%=basePath%>">
<title>登录页面</title>
</head>
<body background="img/login.jpg">
<br>
<br>
<p><s:form action="login/loginAction.action" method="post">
<span></span> <s:textfield name="user.user_name" label="用户名" />
<span></span> <s:password name="user.user_password" label="密码" />
<!-- 用来防止重复提交 s:token-->
<s:token/><s:submit value="登录"/><div align="center" ><a href="reg.jsp" title="想注册~?快点我!!!"><h3>欢迎来到小八戒论坛<h3></a></div>
</s:form></p>
</body>
</html>
然后是Action
package net.bbs.login.action;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.bbs.login.bean.UserVO;
import net.bbs.login..LoginDaoInterface;
import net.bbs.system.ibatis.config.DaoConfig;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
@SuppressWarnings("serial")
public class LoginAction extends ActionSupport{
private UserVO user;
public UserVO getUser() {
return user;
}
public void setUser(UserVO user) {
this.user = user;
}
@SuppressWarnings("unchecked")
@Override
public String execute() throws Exception {
Map session = ActionContext.getContext().getSession();
String name = user.getUser_name();
String password = user.getUser_password();
user.setUser_name(name);
user.setUser_password(password);
LoginDaoInterface L = (LoginDaoInterface)DaoConfig.getDao(LoginDaoInterface.class);
List<UserVO> List = new ArrayList<UserVO>();
//将用户信息存入到session中
List = L.Login(user);
if(List!=null&&List.size()>0){
session.put("user", List.get(0));
return SUCCESS;
}
return ERROR;
}
}
然后是 DAO
package net.bbs.login.;
import java.util.ArrayList;
import java.util.List;
import com.ibatis..client.DaoManager;
import net.bbs.base..BaseDaoImpl;
import net.bbs.login.bean.UserVO;
import net.bbs.system.ibatis.config.DaoConfig;
public class LoginDaoImpl extends BaseDaoImpl implements LoginDaoInterface{
public LoginDaoImpl(DaoManager Manager) {
super(Manager);
}
@SuppressWarnings({ "null", "unchecked" })
public List<UserVO> Login(UserVO user) {
List<UserVO> userList = new ArrayList<UserVO>();
try {
List<Object> L = selectList("login.SelectUser",user);
for(Object obj:L){
UserVO u = new UserVO();
u = (UserVO)obj;
userList.add(u);
}
return userList;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public boolean addUser(UserVO user) {
try {
addInfo("login",user);
return true;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
}
Struts.xml 配置文件~~
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="login" namespace="/login" extends="struts-default">
<action name="loginAction" class="net.bbs.login.action.LoginAction">
<result>/welcome.jsp</result>
</action>
</package>
</struts>
Ⅵ JS注册页面代码
这不是源码不源码的事,这得看你用的是什么技术,asp?php?JSP?能给你的只有Ajax的代码,后台的得看你用的什么技术。var xmlHttp;
try {
xmlHttp = new XMLHttpRequest();
} catch (trymicrosoft) {
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (othermicrosoft) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
xmlHttp = false;
}
}
}function getList(id) {
xmlHttp.open('POST', '<%=basePath%>displayWorkCharacterTree.do?id='+id,true);
xmlHttp.onreadystatechange = handleResponse;
xmlHttp.send(null);
}function handleResponse() { if(xmlHttp.readyState == 4){
if (xmlHttp.status == 200 || xmlHttp.status == 0){
alert("已经注册"); }
}
}
Ⅶ 高价急求一个安卓程序(简单的登陆界面和注册界面)源码和程序 教程也可以
1
MainActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button dengluButton =(Button)findViewById(R.id.button1);
Button zhuceButton=(Button)findViewById(R.id.button2);
final EditText yonghumingEditText=(EditText) findViewById(R.id.editText1);
final EditText mimaEditText=(EditText) findViewById(R.id.editText2);
zhuceButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent=new Intent();
intent.setClass(MainActivity.this, ZhuceActivity.class);
startActivity(intent);
}
});
dengluButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
FileInputStream fis;
try {
fis = new
FileInputStream(Environment.getExternalStorageDirectory().getParent()+"/"+yonghumingEditText.getText().toString());
byte[] input =new byte[fis.available()];
while(fis.read(input)!=-1);
fis.close();
String mimastring=new String(input);
if (mimastring.equals(mimaEditText.getText().toString())==true) {
Toast.makeText(getApplicationContext(), new String(input),Toast.LENGTH_SHORT).show();
String mimaString= new String(input);
if (mimastring.equals(mimaEditText.getText().toString())==true) {
Toast.makeText(getApplicationContext(), "成功登陆", Toast.LENGTH_SHORT).show();
Intent intent =new Intent();
intent.setClass(MainActivity.this,ZhuceActivity.class );
startActivity(intent);
}
else {
Toast.makeText(getApplicationContext(), "用户名或密码错误", Toast.LENGTH_SHORT).show();
}
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Intent intent=new Intent(MainActivity.this,AbActivity.class);
startActivity(intent);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
2. ZhuceActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_zhuce);
Button zhucebingfanhuiButton = (Button) findViewById(R.id.button1);
final EditText yonghumingEditText=(EditText) findViewById(R.id.editText1);
final EditText mimaEditText=(EditText) findViewById(R.id.editText2);
zhucebingfanhuiButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
File writeFile=new File(Environment.getExternalStorageDirectory().getPath(),yonghumingEditText.getText().toString());
if (!writeFile.exists()) {
try {
writeFile.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
String abcString =mimaEditText.getText().toString();
FileOutputStream fos;
try {
fos=new FileOutputStream(writeFile);
fos.write(abcString.getBytes());
fos.flush();
fos.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Intent intent= new Intent();
intent.setClass(ZhuceActivity.this, MainActivity.class);
startActivity(intent);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.zhuce, menu);
return true;
}
}
三、
package com.example.zhuanhuan;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import com.example.zhuanhuan.MainActivity;
import com.example.zhuanhuan.R;
import android.os.Bundle;
import android.os.Environment;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class KkkActivity extends Activity {
private File writeFile;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.kkk);
Button backButton = (Button) findViewById(R.id.button1);
final EditText yonghumingEditText = (EditText) findViewById(R.id.editText1);
final EditText mimaEditText = (EditText) findViewById(R.id.editText2);
backButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
File writeFile = new File(Environment.getExternalStorageDirectory().getPath(), yonghumingEditText.getText().toString());
if (!writeFile.exists()) {
try {
writeFile.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
String abcString = mimaEditText.getText().toString();
FileOutputStream fos;
try {
fos = new FileOutputStream(writeFile);
fos.write(abcString.getBytes());
fos.flush();
fos.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Intent intent = new Intent();
intent.setClass(KkkActivity.this, MainActivity.class);
startActivity(intent);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.kkk, menu);
return true;
}
}
四、
package com.example.zhuanhuan;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class AaaActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.aaa);
Button jianceButton = (Button) findViewById(R.id.button1);
jianceButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.setClass(AaaActivity.this, QqqActivity.class);
startActivity(intent);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.aaa, menu);
return true;
}
}
Ⅷ 求大神写一下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用户注册页面代码,用MYSQL数据库
function CkUser(){
$.ajax({
type: "POST",
url: "__URL__/ajax",
data: "act=CkUser&username="+$('#username').val()+"&userid="+$('#userid').val(),
success: function(msg){
if(msg>0){
alert("用户名已存在!");
$('#username').val('');
}
}
});
}
<input name="username" type="text" class="input" id="username" size="20" value="{$rs.username}" onblur="CkUser()" />
<php>
$act = trim($_POST["act"]);
switch($act)
{
case "CkUser":
$username = trim($_POST["username"]);
$userid = intval($_POST["userid"]);
$db = M("userinfo");
$num = $db->where("username='$username' and userid!=$userid and isdel=0")->count();
echo $num;
break;
}