int stuNo = Integer.parseInt(properties.getProperty("student.stuNo"));什么意思
时间: 2024-05-24 11:15:22 浏览: 12
这行代码是从 Java Properties 对象中获取名为 "student.stuNo" 的属性值,然后将其解析为整数类型并赋值给变量 stuNo。通常情况下,Properties 对象是用来存储配置信息的,所以这行代码的作用是获取名为 "student.stuNo" 的配置项的值,并将其转换为整数类型以便后续使用。如果属性不存在或无法解析为整数,则会抛出 NumberFormatException 异常。
相关问题
String stuNo = properties.getProperty("stuNo");什么意思
这行代码是从一个 Properties 对象中获取名为 "stuNo" 的属性值,并将其赋值给 String 类型的变量 stuNo。Properties 对象通常用于存储配置信息或者其他类型的键值对数据。getProperty 方法是 Properties 类提供的获取属性值的方法。如果找不到指定的属性,则该方法将返回 null。
properties文件里student.stuNo = 01什么意思
这是一个 Java properties 文件中的一行配置,表示一个名为 `student` 的属性(或键),其对应的值为 `01`。可能是用来存储学生的学号信息,可以通过读取此配置文件来获取学号信息,例如在 Java 代码中可以使用 `Properties` 类读取该文件并获取 `student` 属性的值。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
帮我找到代码中的错误 ReStu.connect(); //判断请求参数的合法性 String stuno = new String(request.getParameter("StuNo").trim().getBytes("iso8859_1")); String stuname = new String(request.getParameter("StuName").trim().getBytes("iso8859_1")); String password = new String(request.getParameter("Pswd").trim().getBytes("iso8859_1")); ResultSet rs = ReStu.QueryStu(stuno); //获取rs里查到的学号,和姓名,准备进行匹配 while (rs.next()){ String str1 = rs.getString(1); String str2 = rs.getString(2); if (str1.equals(stuno)&str2.equals(stuname)){ int i = ReStu.UpdPw(password,stuno); if(i>0){ out.println("注册成功");}%> 注册成功 <% }}%> 去登录 <% ReStu.close_all();%>
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
下列代码: <% ReStu.connect(); String stuno=new String(request.getParameter("StuNo").trim().getBytes("iso8859_1")); String password=new String(request.getParameter("Pswd").trim().getBytes("iso8859_1")); if(stuno==null || password==null || stuno.equals("") || password.equals("")){ out.println("信息不完整,请重新输入"); %> 返回登录 <%} else{ ResultSet rs=ReStu.QueryStuLog(stuno,password); if(rs.next()){ String stuname=rs.getString("StuName"); //这句要注意,session的还没看!! // session.setAttribute("StuName",stuname); out.println("succeess"); //response.sendRedirect("index.html"); }} ReStu.close_all();%>,运行后抛出异常:org.apache.jasper.JasperException: java.lang.NullPointerException org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:500) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:428) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.java:717,找出错误原因
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)