TYUT太原理工大学2022javaweb程序填空题

程序填空题主要考察各种类方法,要记忆的太多,我浅总结一些,考试肯定会有,但并不能全部压中

1、获取“A”输入的“A属性值”

String A属性值 =request.getParameter("A属性值");

2、防止获取/接受的字符编码为乱码

request/response .setCharacterEncoding("utf-8");

3、把A的某属性添加到request范围

request.setAttribute("A属性",A属性值);

4、以请求转发方式跳转到页面A.jsp

request.getRequestDispatcher("A.jsp").forward(request,response);

     以请求包含方式跳转到页面A.jsp

request.getRequestDispatcher("A.jsp").include(request,response);

5、从request范围获取A某属性并输出

out.print(request.getAttribute("A属性"));

6、在page指令中导入类A

import="A"

7、静态包含文件A.html

<%@ include file="A.html" %>

8、动态包含文件A.html

<jsp:include page="A.html"/>

9、以表达式输出当前时间

<%=new Date() %>

10、加载驱动A

Class.forName(A)

11、创建数据库连接

Connection con= DriverManager.getConnection(url,username,password);

12、创建A接口对象(常见接口Statement,CallableStatement 和 PreparedStatement )

A     A的前几个小写字符=con.createA(  );

13、执行insert、update、delete语句返回int类型

int  A=stat.executeUpdate(sql);

14、执行select语句返回ResultSet对象

Resultset  A=stat.executeQuery(sql);

16、写if语句(设最近的变量A)

如果分析不出来,就拿A与0比较if(A>0)

17、写while语句输出数据(设最近的变量A)

while(A.next( )){

        System.out.println(A.getInt( "  ") )

}

18、实现防盗链

request.getHeader("请求头来源");

19、创建cookie

Cookie cookie = new Cookie(键, 值);

20、设置路径:访问A资源时回送cookie

cookie.setPath("/A");

21、发送cookie

response.addCookie(cookie);

22、创建或者获得用户的Session对象

HttpSession session = req.getSession();

先且背这么多,后续遇到我再补充完整

e4f65101de6b473fb9fe3612111a8ddb.png

 aabd2c09367b479599a4b592e01912b1.png

9f148725eec544a3885fa54ad0d2b56a.png

答案:

d246754622044ba4ab04511e09f5e741.png

d0c73a1ccde44c8cb57d6798430f1109.png

猜你喜欢

转载自blog.csdn.net/m0_55298718/article/details/125163673
今日推荐