学生管理系统html js,学生信息管理系统JS版(Eclipse).docx

学生信息管理系统JS版(Eclipse)

学生信息管理系统JSP版(Eclipse)

新建new->Dynamic Web Project->名字为StudentJSP。

准备工作

编写JSP测试文件,名称为hello.jsp

修改hello.jsp的charset为UTF-8

加入代码:

Hello!

代码:

pageEncoding=" UTF-8"%>

Insert title here

Hello!

附:修改默认字符集步骤:

Windows->Preference->Web->JSPfiles->将Encoding改为UTF-8

右击项目->Properties->Resurce->修改字符集为UTF-8.

右击项目->Properties->Java Build Path改为如图(需先在WEB-INF下新建classes)

将MySQL中一个jar包复制到/WEB-INF/lib下,如图:

在/WebContent下new一个JSPfile,名字为display0.jsp

代码如下:

pageEncoding="UTF-8"%>

//(注意要引入sql的包)

Insert title here

String connStr = "jdbc:mysql://localhost:3306/yStudent?characterEncoding=utf8";

Connection conn = null;

Statement stmt = null;

ResultSet rs;

try {

Class.forName("com.mysql.jdbc.Driver");

conn = DriverManager.getConnection(connStr, "root", "123456");

stmt = conn.createStatement();

} catch (Exception ex) {

ex.printStackTrace();

System.out.println("exception in getConnection");

}

String sql = "select * from studentinfo"; //表明为studentinfo

try {

rs = stmt.executeQuery(sql);

%>

编号姓名年龄

conn.close();

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值