1.jsp登陆界面源代码
2.Javaç®å代ç ï¼
jsp登陆界面源代码
1、login.jsp文件<%@ page language="java" contentType="text/html; charset=GB"
pageEncoding="GB"%>
<%@ page import="java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4. Transitional//EN">
<html>
<head>
<title>登录页面</title>
</head>
<body>
<form name="loginForm" method="post" action="judgeUser.jsp">
<table>
<tr>
<td>用户名:<input type="text" name="userName" id="userName"></td>
</tr>
<tr>
<td>密码:<input type="password" name="password" id="password"></td>
</tr>
<tr>
<td><input type="submit" value="登录" style="background-color:pink"> <input
type="reset" value="重置" style="background-color:red"></td>
</tr>
</table>
</form>
</body>
</html>
2、登录登录逍遥西游 源码judge.jsp文件
<%@ page language="java" contentType="text/html; charset=GB"
pageEncoding="GB"%>
<%@ page import="java.util.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4. Transitional//EN">
<html>
<head>
<title>身份验证</title>
</head>
<body>
<%
request.setCharacterEncoding("GB");
String name = request.getParameter("userName");
String password = request.getParameter("password");
if(name.equals("abc")&& password.equals("")) {
3、权限权限妖魔道源码afterLogin.jsp文件
%>
<jsp:forward page="afterLogin.jsp">
<jsp:param name="userName" value="<%=name%>"/>
</jsp:forward>
<%
}
else {
%>
<jsp:forward page="login.jsp"/>
<%
}
%>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=GB"
pageEncoding="GB"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4. Transitional//EN">
<html>
<head>
<title>登录成功</title>
</head>
<body>
<%
request.setCharacterEncoding("GB");
String name = request.getParameter("userName");
out.println("欢迎你:" + name);
%>
</body>
</html>
扩展资料:
1、源码源码报表导出源码Data_uil.java文件
import java.sql.*;
public class Data_uil
{
public Connection getConnection()
{
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
}catch(ClassNotFoundException e)
{
e.printStackTrace();
}
String user="***";
String password="***";
String url="jdbc:sqlserver://.0.0.1:;DatabaseName=***";
Connection con=null;
try{
con=DriverManager.getConnection(url,简单简单帝国影视 源码user,password);
}catch(SQLException e)
{
e.printStackTrace();
}
return con;
}
public String selectPassword(String username)
{
Connection connection=getConnection();
String sql="select *from login where username=?";
PreparedStatement preparedStatement=null;
ResultSet result=null;
String password=null;
try{
preparedStatement=connection.prepareStatement(sql);
preparedStatement.setString(1,username);
result=preparedStatement.executeQuery();//可执行的 查询
if(result.next())
password=result.getString("password");
}catch(SQLException e){
e.printStackTrace();
}finally
{
close(preparedStatement);
close(result);
close(connection);
}
System.out.println("找到的数据库密码为:"+password);
return password;
}
public void close (Connection con)
{
try{
if(con!=null)
{
con.close();
}
}catch(SQLException e)
{
e.printStackTrace();
}
}
public void close (PreparedStatement preparedStatement)
{
try{
if(preparedStatement!=null)
{
preparedStatement.close();
}
}catch(SQLException e)
{
e.printStackTrace();
}
}
public void close(ResultSet resultSet)
{
try{
if(resultSet!=null)
{
resultSet.close();
}
}catch(SQLException e)
{
e.printStackTrace();
}
}
}
2、login_check.jsp:文件
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4. Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>验证用户密码</title>
</head>
<body>
<jsp:useBean id="util" class="util.Data_uil" scope="page" />
<%
String username=(String)request.getParameter("username");
String password=(String)request.getParameter("password");
if(username==null||"".equals(username))
{
out.print("<script language='javaScript'> alert('用户名不能为空');</script>");
response.setHeader("refresh",登录登录zbar 源码运行 "0;url=user_login.jsp");
}
else
{
System.out.println("输入的用户名:"+username);
String passwordInDataBase=util.selectPassword(username);
System.out.println("密码:"+passwordInDataBase);
if(passwordInDataBase==null||"".equals(passwordInDataBase))
{
out.print("<script language='javaScript'> alert('用户名不存在');</script>");
response.setHeader("refresh", "0;url=user_login.jsp");
}
else if(passwordInDataBase.equals(password))
{
out.print("<script language='javaScript'> alert('登录成功');</script>");
response.setHeader("refresh", "0;url=loginSucces.jsp");
}
else
{
out.print("<script language='javaScript'> alert('密码错误');</script>");
response.setHeader("refresh", "0;url=user_login.jsp");
}
}
%>
</body>
</html>
3、loginSucces.jsp文件
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4. Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO--1">
<title>Insert title here</title>
</head>
<body>
<hr size="" width="%" align="left" color="green">
<font size="6" color="red" >登录成功 </font>
<hr size="" width="%" align="left" color="green">
</body>
</html>
4、权限权限user_login.jsp文件
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4. Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO--1">
<title>登录界面</title>
</head>
<body background="C:\Users\win8\workspace\Login\image\9dcbdceab5cfbc_.jpg" >
<center>
<br><br><br><br><br><br>
<h1 style="color:yellow">Login</h1>
<br>
<form name="loginForm" action="login_check.jsp" method="post">
<table Border="0" >
<tr >
<td>账号</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>密码</td>
<td><input type="password" name="password">
</td>
</tr>
</table>
<br>
<input type="submit" value="登录" style="color:#BC8F8F">
</form>
</center>
</body>
</html>
Javaç®å代ç ï¼
æ±å©ä¸ä¸ªç®åJAVA代ç
1ãæç®åçjava代ç è¯å®å°±æ¯è¿ä¸ªäºï¼å¦ä¸ï¼publicclassMyFirstApp{ publicstaticvoidmain(String[]args){ System.out.print(Helloworld)ï¼}}âhelloworldâå°±æ¯åºè¯¥æ¯ææå¦javaçæ°æçç第ä¸ä¸ªä»£ç äºã
2ãè¿åªæ¯ä¸ä¸ªç®åå®ä½ç±»ï¼å«åjavabeanï¼ãpublicPassengeræ¯æé å½æ°çéåï¼å¨ç±»ä¸ä¹å¯ä»¥ä¸åï¼ä¸åçè¯ç³»ç»ä¼é»è®¤ç»ä¸ä¸ªæ åæé å½æ°ï¼å³æ²¡æåæ°çï¼ã
3ãè¿æï¼ä½ è¦ç¡®ä¿ç®æ çä¸å¾æsg/DTè¿ä¸¤ä¸ªç®å½ã追é®ï¼æå¤é®ä¸å¥ãè¿æ®µä»£ç å±äºJ2EEå§ï¼ä¸è½è¿æ ·è¯´ï¼J2EEæ¯JAVAä½ç³»çä¸é¨ä»½ï¼æ¯ä¸ç§JAVAåºç¨å¼åçææ¯æ¶æãä½ è¿æ®µä»£ç åªæ¯ä¸æ®µJAVAçåºç¡ä»£ç ã
4ãrunæ¹æ³æ¯çº¿ç¨çæ§è¡ä½ã线ç¨å¯å¨æ¶åªè¿è¡testä¸å¾runæ¹æ³ã
5ãaå为7//æ¥çå å±å¾ªç¯ç»§ç»c=3å¤æcrç»æåç°æç«è¿å ¥ifcontinueloopåå°äºå¤å±å¾ªç¯rèªå¢1å为3//...//LZè¦æ³¨æï¼aä¸ç´æ¯å¨å¾ªç¯å¤ï¼è¿ä¸¤ä¸ªå¾ªç¯ä¸ç´å¨æ¹åaçå¼ï¼ä¹å°±æ¯açå¼ä¸ç´æ¯å¨å¢çã
æ±ä¸ä¸ªç®ååæ趣çJAVAå°æ¸¸æ代ç
1ãSystem.out.println(çæ°å游æï¼è¯·è¾å ¥ä¸ä¸ªæ°0å°ï¼è¾å ¥-1ç»æ游æï¼)ï¼inti=sc.nextInt()ï¼if(i==-1){ breakï¼}count++ï¼if(ir){ System.out.print(ä½ çå°äºã
2ã--æ±å¤§ç¥æç¹å¦ä½ç¨javaåæ«é·å°æ¸¸æ详ç»...ææºä»£ç å--æä¹ç¨Javaåä¸ä¸ªæ«é·ç¨åºï¼è¦ååããå好äºç»å --æ±é«æåä¸ä¸ªæ«é·çJAVA代ç ï¼ææ¿åºçæ¬èµæè æ´å¤ã
3ãSystem.out.println(helloworldï¼)ï¼}}åºæ¬æ¦å¿µJavaæ¯ä¸ç§å¯ä»¥æ°å跨平å°åºç¨è½¯ä»¶çé¢å对象çç¨åºè®¾è®¡è¯è¨ã
4ãEJBè¾ å©ä¹¦ç±ï¼ãç²¾éEJBï¼ç¬¬ä¸çï¼ã以ä¸ä¹¦ç±å¯ä¸çµå书ï¼ä½æ¯çµåççä¹ äºè®ç´¯ï¼ç¼çåä¸äºã
JAVAçä¸æ®µç®å代ç 1ãpublicclassHelloWorld{ publicstaticvoidmain(String[]args){ System.out.println(helloworldï¼)ï¼}}åºæ¬æ¦å¿µJavaæ¯ä¸ç§å¯ä»¥æ°å跨平å°åºç¨è½¯ä»¶çé¢å对象çç¨åºè®¾è®¡è¯è¨ã
2ãè¿æï¼ä½ è¦ç¡®ä¿ç®æ çä¸å¾æsg/DTè¿ä¸¤ä¸ªç®å½ã追é®ï¼æå¤é®ä¸å¥ãè¿æ®µä»£ç å±äºJ2EEå§ï¼ä¸è½è¿æ ·è¯´ï¼J2EEæ¯JAVAä½ç³»çä¸é¨ä»½ï¼æ¯ä¸ç§JAVAåºç¨å¼åçææ¯æ¶æãä½ è¿æ®µä»£ç åªæ¯ä¸æ®µJAVAçåºç¡ä»£ç ã
3ãç¯å¢è¯è¨Javaæ°æ®åºServerï¼è¿æ¥æ¹å¼ç´è¿ãå¦æä½ æ¯XPç³»ç»è¿è¦æSP3çè¡¥ä¸ã
4ãDBSQLManagerdbsm=newDBSQLManager()ï¼///å°±æ¯è¿ä¸è¡ä¸è½éè¿ã
5ãbmouthç½ååççæ ¹æ¬ä¸é¢æ å ³ï¼çæå°æ¾é¼ ç»ä½ çæºä»£ç å§ã
6ãa+=bå°±ç¸å½äºå°açå¼åbçå¼ç¸å ååå ¥åéaä¸ã
ä¸ä¸ªç®åçJavaç¨åºä»£ç ?源码源码1ãpublicclassHelloWorld{ publicstaticvoidmain(String[]args){ System.out.println(helloworldï¼)ï¼}}åºæ¬æ¦å¿µJavaæ¯ä¸ç§å¯ä»¥æ°å跨平å°åºç¨è½¯ä»¶çé¢å对象çç¨åºè®¾è®¡è¯è¨ã
2ãè¿ä¸ªæ ·åè¯å®ä¸è¡æãå¨ææçç¨åºè®¾è®¡éé¢æ ¹æ¬å°±æ²¡æè¿æ ·çåæ³çãï¼é¤äºæä¸ç¥éçï¼ä½ åªè½è¿æ ·åï¼if(9=x&&x=)è¿ç§æ¹å¼çãä¸ç¶æ¯ä¼æ¥éçé¢ãä½ æ¹æ¹çã
3ãå¯ä»¥åä¸ä¸ªæ¹å¤çæ件ï¼å¨éé¢è°ç¨javaèææºè¿è¡ä½ çjavaç¨åºãä¹å¯ä»¥ç¨æç§ç¼ç¨è¯è¨ï¼åvbï¼cæc++ç¼ä¸ªç¨åºï¼çæexeï¼è½è°ç¨javaèææºè¿è¡ä½ çç¨åºï¼å¾ç®åçã
4ãå³é®ä»¥ç®¡çåæéæå¼è¿ä¸ªbatæ件ãç¼åjava代ç ï¼æ°å»ºææ¬æ件ï¼ç¼åä¸ä¸ªç®åçjavaç¨åºï¼ç¶åå¦å为Hello.javaã注æç±»çååè¦åä¿åçæ件åå³Hello.javaç¸åã
5ãJavaå¯ä»¥å¼åå端ï¼æspringï¼springmvcï¼springbootï¼springcouldççé½æ¯ä½¿ç¨Javaå¼åãJavaä¹æå端æ¡æ¶ï¼æJqueryï¼JavaScriptï¼JSPï¼Servletï¼ç»ç§°JavaWEBå¼åã
6ãæ¯å¦myeclipseï¼é£ä¹å°±æ¯å建ä¸ä¸ªç±»ï¼ç¶åæ²å ¥mainï¼alt+/å¯ä»¥å¯¼åºmainå½æ°ï¼Javaç¨åºçå ¥å£å°±æ¯mainï¼ãå¦æ没æç¨å·¥å ·ï¼éè¦é ç½®ç¯å¢åéçï¼é 置好ä¹åã