jsp课程设计题目及源代码(jsp程序设计课本例题代码)

本文目录一览:

jsp的两个选择题,不会做

第一个,选(d)

(1,2)好像jsp:getgetParam name=”” jsp:getParameter name=””

不存在样的,

(3)它是得session里面的值,所以不行的,

第二个,选(b)

(1)因为A 它是包含结果,首先它会执行两次,当他执行第二个时,它是得不到值的, 那样得到只是一个null

(2)第二个是,代码包含,它会把第个页面的代码copy近来,那样就能得到了值了

(3,4)页面跳转,也不会得到值的,

在JSP中怎么实现多项选择题,可以给以下源代码,

你说的多项选择题,我是不是可以理解成多选??

多选的实现是这样的:

第一: 必须将多选框放到form里面。

第二: 然后name属性完全一样,value不相同。这样当你提交到Action中的时候,只需要使用request对象获取toselect的值就行了。

第三: 获取值:request.getParameterValues(“toselect”),就会将选中的多选框里面的value获取,并且返回一个String[]数组,这个数组里面就有你想要的值:即选中的值

html

body

form

input type = “checkbox” value = “A” name = “toselect”/A

input type = “checkbox” value = “B” name = “toselect”/B

input type = “checkbox” value = “C” name = “toselect”/C

input type = “checkbox” value = “D” name = “toselect”/D

/form

/body

/html

用jsp设计一个小的人事信息管理系统 (软件工程)(课程设计)

帮你做,那肯定是要收费的,这个系统如果拿设计到源码,如果开发的快,最少也要个2个星期!并且必须用SSH框架做,不然JSP写SQL语句,那还不搞死人

jsp登陆界面源代码

1、login.jsp文件

%@ page language=”java” contentType=”text/html; charset=GB18030″

pageEncoding=”GB18030″%

%@ page import=”java.util.*” %

!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 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

tdinput 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=GB18030″

pageEncoding=”GB18030″%

%@ page import=”java.util.*” %

!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”

html

head

title身份验证/title

/head

body

%

request.setCharacterEncoding(“GB18030”);

String name = request.getParameter(“userName”);

String password = request.getParameter(“password”);

if(name.equals(“abc”) password.equals(“123”)) {

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=GB18030″

pageEncoding=”GB18030″%

!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”

html

head

title登录成功/title

/head

body

%

request.setCharacterEncoding(“GB18030”);

String name = request.getParameter(“userName”);

out.println(“欢迎你:” + name);

%

/body

/html

扩展资料:

java web登录界面源代码:

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://127.0.0.1:1433;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.01 Transitional//EN” “”

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”, “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.01 Transitional//EN” “”

html

head

meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″

titleInsert title here/title

/head

body

hr size=”10″ width=”26%” align=”left” color=”green”

font size=”6″ color=”red” 登录成功 /font

hr size=”10″ width=”26%” 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.01 Transitional//EN” “”

html

head

meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″

title登录界面/title

/head

body  background=”C:\Users\win8\workspace\Login\image\9dcbdc339e72a5663b5c289fb5573c13_10.jpg”

center

brbrbrbrbrbr

h1 style=”color:yellow”Login/h1

br

form name=”loginForm” action=”login_check.jsp” method=”post” 

table Border=”0″

tr

td账号/td

tdinput type=”text” name=”username”/td

/tr

tr

td密码/td

tdinput type=”password” name=”password”

/td

/tr

/table

br

input type=”submit” value=”登录” style=”color:#BC8F8F”

/form

/center

/body

/html

原创文章,作者:简单一点,如若转载,请注明出处:https://www.506064.com/n/129053.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
简单一点简单一点
上一篇 2024-10-03 23:26
下一篇 2024-10-03 23:26

相关推荐

  • g3log源代码学习

    g3log是一个高性能C++日志库,其代码十分精简和可读性强,本文将从3个方面详细介绍g3log源代码学习。 一、g3log源代码整体架构 g3log的整体架构十分清晰,其中有3个…

    编程 2025-04-29
  • Python计算机语言程序设计用法介绍

    Python是一种高级编程语言,其设计目的是让程序员能够在编写代码时更加关注算法的设计,而不必过多地考虑语言细节。Python被广泛应用于网站开发、数据科学、人工智能、机器学习等各…

    编程 2025-04-28
  • 使用面向对象程序设计方法改写猜数字游戏Python程序

    本文将从以下多个方面对猜数字游戏程序功能要求,使用面向对象程序设计方法改写该程序Python做详细的阐述。 一、游戏规则 1、游戏开始时,程序随机生成一个 1 到 100 之间的整…

    编程 2025-04-28
  • 数字孪生源代码的介绍

    数字孪生源代码是一种用于模拟现实世界的技术。它将现实世界的实体或场景进行数字化,使得我们可以通过计算机程序对其进行模拟,以便进行分析和预测。数字孪生源代码包含了许多组件和算法,下面…

    编程 2025-04-28
  • 汇率兑换程序和温度转换程序设计

    这篇文章将从多个方面详细阐述如何设计汇率兑换程序和温度转换程序。这些程序可以帮助人们更方便地计算货币汇率和温度转换,对于需要频繁出差或者经常进行气象预报的人来说,这些程序将非常有用…

    编程 2025-04-27
  • 动态规划例题用法介绍

    本文将以动态规划(Dynamic Programming, DP)例题为中心,深入阐述动态规划的原理和应用。 一、最长公共子序列问题 最长公共子序列问题(Longest Commo…

    编程 2025-04-27
  • Python程序设计题库博客园

    Python程序设计题库博客园是一个开发者可以通过该平台进行学习和检测自身能力的编程题目练习平台。其提供了一些Python的基础编程技能练习,对于想要学习Python编程,提高编程…

    编程 2025-04-27
  • CCF中学生计算机程序设计全面解析

    CCF(中国计算机学会)中学生计算机程序设计是一个旨在培养中学生计算思维和编程能力的活动。自2000年开始,每年举办一次,分为入门篇、基础篇、提高篇、专业篇四个阶段,以及最新版和答…

    编程 2025-04-23
  • Javascript高级程序设计PDF的探讨

    一、Javascript语言基础 Javascript作为一门编程语言,具有独特的特点和语法结构。在学习Javascript时,我们需要掌握它的语言基础,如变量、数据类型、运算符等…

    编程 2025-04-12
  • 如何查看exe文件的源代码

    一、使用反汇编工具检查 反汇编工具是一种将机器语言转发成汇编语言的软件工具,也可以将目标文件(例如exe)文件转化为可读性较好的汇编代码。 下面是一个使用IDA反汇编工具对exe文…

    编程 2025-02-25

发表回复

登录后才能评论