//配置web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>HeadFirstJspServletChap02</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>

<servlet>
<servlet-name>init</servlet-name>
<jsp-file>/sysInit.jsp</jsp-file>
<init-param>
<param-name>jdbcName</param-name>
<param-value>com.mysql.jdbc.Driver</param-value>
</init-param>
<init-param>
<param-name>dbUrl</param-name>
<param-value>jdbc:mysql://localhost:3306/db_xx</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>init</servlet-name>
<url-pattern>/init</url-pattern>
</servlet-mapping>
</web-app>

跳转页面sysInit

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<%
String jdbcName=config.getInitParameter("jdbcName");
String dbUrl=config.getInitParameter("dbUrl");
%>
<h1>驱动名称:<%=jdbcName %></h1>
<h1>连接地址:<%=dbUrl %></h1>
</body>
</html>

jsp另外五大内置对象之config的更多相关文章

  1. jsp另外五大内置对象之-exception

    //有异常的页面 <%@ page language="java" contentType="text/html; charset=utf-8" page ...

  2. jsp另外五大内置对象之-out获取缓冲区大小

    <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding= ...

  3. jsp另外五大内置对象之out输出

    <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding= ...

  4. jsp另外五大内置对象之response-操作cookie

    responseo3.jsp <%@ page language="java" contentType="text/html; charset=utf-8" ...

  5. jsp另外五大内置对象之response-操作重定向

    <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding= ...

  6. jsp另外五大内置对象之response-设置头信息

    <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding= ...

  7. 今天我们来认识一下JSP的九大内置对象

    虽然现在基本上我们都是使用SpringMVC+AJAX进行开发了Java Web了,但是还是很有必要了解一下JSP的九大内置对象的.像request.response.session这些对象,即便使用 ...

  8. JSP的9大内置对象

    1.概述 JSP的这9个内置对象,都是servlet API实例,即在JSP页面内部,可以直接使用; ps:顺便说下JSP的4大范围: JSP的四种范围,分别为page.request.session ...

  9. 牛客网Java刷题知识点之什么是JSP、JSP有哪些优点、JSP的9大内置对象、JSP的四大域对象、JSP的四种范围

    不多说,直接上干货! https://www.nowcoder.com/ta/review-java/review?tpId=31&tqId=21175&query=&asc= ...

随机推荐

  1. 【238】◀▶IEW-Unit03

    Unit 3 Media 柱状图 1.图片及model1分析 The graph below contains information about the average science test s ...

  2. Redux API之combineReducers

    combineReducers(reducers) 随着应用变得复杂,需要对 reducer 函数 进行拆分,拆分后的每一块独立负责管理 state 的一部分. combineReducers 辅助函 ...

  3. submatrix

    given a 2-d matrix with 0 or 1 values largest square of all 1's dynamic programming, dp[i][j] = 1 + ...

  4. installshield 6109错误解决方案

    电脑重装了一下过后,运行打包程序就一直报6109错误,网上也没有查找出相关答案,真是急死了,后来无意发现输出项目的发布路径和当前自己setup的路径不一致,由于移动了文件夹位置,这个路径没有跟随修改, ...

  5. Openjudge2729 Blah数集(单调队列)

    2729:Blah数集 总时间限制:  3000ms 内存限制:  65536kB 描述 大数学家高斯小时候偶然间发现一种有趣的自然数集合Blah,对于以a为基的集合Ba定义如下:(1) a是集合Ba ...

  6. css中vw和vh的知识点

    引用文档:http://caibaojian.com/vw-vh.html: http://www.zhangxinxu.com/wordpress/2012/09/new-viewport-rela ...

  7. SPA单页应用前后分离微信授权

    项目基于微信公众号开发,业务完全依赖微信授权,也就是用户进入页面已经完成授权获取到用户的OpenId. 需要有一个授权中间页:author.vue 基本实现思路: 无论使用哪个url进入页面都会先触发 ...

  8. linux 之基本命令学习总结

    前言:从今天开始写这系列linux博客了(是学习刘遄老师的<linux就该这么学>),视频学习的资源可以在b站上找到:https://www.bilibili.com/video/av45 ...

  9. 实验一 用户界面与Shell命令

    一.实验课时:2学时 二.实验目的 v  熟悉redhat_linux的用户界面,会进行常用的系统设置. v  掌握常用的shell命令. 三.实验环境 v  运行Windows xp\2000\20 ...

  10. STP-7-RSTP的BPDU格式和处理方式的改变

    RSTP只使用一种BPDU,协议版本字段为2(STP为0). STP标志字段8位只使用了两位:TC(拓扑变化)和TCA(拓扑变化确认). RSTP也使用了其余6位:提议位,端口角色位,学习位,转发位, ...