根号老师,您好。
我是一个零基础的学员,因工作需要,需要学习java并且希望用其做一个很简单的登陆页面+另外一个增删查改的功能。就是首页登陆,登陆进去以后是另外一个页面,然后敲进去的内容查询出来再对其进行增删查改的动作。就这两个页面。我买了两本书,一个是java编程入门指南,一个是java web项目开发。我应该怎么系统的学习呢。作为一个零基础的人。一共12分了。感谢回复!
<%@ page language="java" import ="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="java.sql.date"%>
<%@ page contentType="text/html;charset=GBK" language="java" errorPage="" %>
<%@ page import="java.sql.*" %>
<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<title>SMT機台配置修改</title>
<script language="javascript">
function check()
{
if(myform.user.value.length == 0 ||myform.password.value.length == 0 )
{ alert("存在空"); }
else
{
myform.submit()
}
}
</script>
</head>
<body>
<%
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@10.194.168.200:1526:npasy1","sfis1","sfis1");
%>
<%
Statement stmt=conn.createStatement();
ResultSet rs=null;
//out.println(con);
%>
<form method="post" name="myform" action="login.jsp">
<%
try{
String user=request.getParameter("user");
if(user==null)
{
%>
<br>
<br>
<br>
<br>
<br>
<br>
<center> <h2>SMT機台配置修改</h2>
<br>
<br>
<br>
</center>
<table align="center" width="400">
<tr>
<td width=180 align="center">工號</td>
<td><input type="text" name="user" ></td></tr>
<tr><td width=180 align="center">密碼</td><td><input type="password" name="password" ></td></tr>
<tr><td width=180 align="center"><input type="submit" name="button" value="登錄" onClick="check();"></td>
<td><input type="reset" name="other" value="重置" onClick="javascript:window.close();"></td></tr>
</table>
</form>
<%
}
else
{
String password=request.getParameter("password");
String sql="select * from sfis1.c_user_t where emp_no='"+user+"' and pass_word='"+password+"' and dep_name='ASSYKITTING'";
out.println(sql);
rs=stmt.executeQuery(sql);
if(rs.next())
{
response.sendRedirect("main.jsp?user="+user);
}
else
{
%>
<script language="javascript">
alert("登錄失敗");
self.location.href="login.jsp";
</script>
<%
}
}
}catch(Exception e){
}finally{
if(rs!=null){
rs.close();
rs=null;
}
if(stmt!=null){
stmt.close();
stmt=null;
}
}
%>
這個報錯http500 老師幫忙看看咋整啊...
fengxue1983 发表于2020-01-06 10:31
<%@ page language="java" import ="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="java.sql.date"%>
<%@ page contentType="text/html;charset=GBK" language="java" errorPage="" %>
<%@ page import="java.sql.*" %>
<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<title>SMT機台配置修改</title>
<script language="javascript">
function check()
{
if(myform.user.value.length == 0 ||myform.password.value.length == 0 )
{ alert("存在空"); }
else
{
myform.submit()
}
}
</script>
</head>
<body>
<%
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@10.194.168.200:1526:npasy1","sfis1","sfis1");
%>
<%
Statement stmt=conn.createStatement();
ResultSet rs=null;
//out.println(con);
%>
<form method="post" name="myform" action="login.jsp">
<%
try{
String user=request.getParameter("user");
if(user==null)
{
%>
<br>
<br>
<br>
<br>
<br>
<br>
<center> <h2>SMT機台配置修改</h2>
<br>
<br>
<br>
</center>
<table align="center" width="400">
<tr>
<td width=180 align="center">工號</td>
<td><input type="text" name="user" ></td></tr>
<tr><td width=180 align="center">密碼</td><td><input type="password" name="password" ></td></tr>
<tr><td width=180 align="center"><input type="submit" name="button" value="登錄" onClick="check();"></td>
<td><input type="reset" name="other" value="重置" onClick="javascript:window.close();"></td></tr>
</table>
</form>
<%
}
else
{
String password=request.getParameter("password");
String sql="select * from sfis1.c_user_t where emp_no='"+user+"' and pass_word='"+password+"' and dep_name='ASSYKITTING'";
out.println(sql);
rs=stmt.executeQuery(sql);
if(rs.next())
{
response.sendRedirect("main.jsp?user="+user);
}
else
{
%>
<script language="javascript">
alert("登錄失敗");
self.location.href="login.jsp";
</script>
<%
}
}
}catch(Exception e){
}finally{
if(rs!=null){
rs.close();
rs=null;
}
if(stmt!=null){
stmt.close();
stmt=null;
}
}
%>
這個報錯http500 老師幫忙看看咋整啊...