为什么我的servlet程序在tomcat4.0下运行正常,而转到tomcat5.5.4下就报No database selected

NC 2005-02-20 09:19:43
如题,出错的代码段如下:
...
try {
System.out.println("select max(clear_date) from "+ tablename);
rs =stmt.executeQuery("select max(clear_date) from "+ tablename );//这一句在tomcat5.5.4下报错,而在tomcat4.0下正常
rs.next();
max_clear_date = rs.getInt(1);

//currtime = sdf.format(new Long (System.currentTimeMillis() ) );
starttime = sdf.format(new Long(System.currentTimeMillis()-refreshtimeinterval) );
currtime = sdf.format(new Long(System.currentTimeMillis()) );
//System.out.println("starttime="+starttime);
//System.out.println("currtime="+currtime);

rs = stmt.executeQuery( "select count(*) from "+tablename + " where clear_date="+max_clear_date+" and local_time>="+starttime+" and local_time<="+currtime);
rs.next();
total_rows = rs.getInt(1);
rs.close();
rs = stmt.executeQuery( "select * from "+tablename + " where clear_date="+max_clear_date+" and local_time>="+starttime+" and local_time<="+currtime );
}
...全文
132 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
以梦为马 2005-02-21
  • 打赏
  • 举报
回复
up
java_augur 2005-02-21
  • 打赏
  • 举报
回复
贴server.xml
NC 2005-02-21
  • 打赏
  • 举报
回复
replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
* Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.
* Synchronous means that the thread that executes the request, is also the
thread the replicates the data to the other nodes, and will not return until all
nodes have received the information.
* Asynchronous means that there is a specific 'sender' thread for each cluster node,
so the request thread will queue the replication request into a "smart" queue,
and then return to the client.
The "smart" queue is a queue where when a session is added to the queue, and the same session
already exists in the queue from a previous request, that session will be replaced
in the queue instead of replicating two requests. This almost never happens, unless there is a
large network delay.
-->
<!--
When configuring for clustering, you also add in a valve to catch all the requests
coming in, at the end of the request, the session may or may not be replicated.
A session is replicated if and only if all the conditions are met:
1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
2. a session exists (has been created)
3. the request is not trapped by the "filter" attribute

The filter attribute is to filter out requests that could not modify the session,
hence we don't replicate the session after the end of this request.
The filter is negative, ie, anything you put in the filter, you mean to filter out,
ie, no replication will be done on requests that match one of the filters.
The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.

filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI
ending with .gif and .js are intercepted.

The deployer element can be used to deploy apps cluster wide.
Currently the deployment only deploys/undeploys to working members in the cluster
so no WARs are copied upons startup of a broken node.
The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"
When a new war file is added the war gets deployed to the local instance,
and then deployed to the other instances in the cluster.
When a war file is deleted from the watchDir the war is undeployed locally
and cluster wide
-->

<!--
<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
expireSessionsOnShutdown="false"
useDirtyFlag="true"
notifyListenersOnReplication="true">

<Membership
className="org.apache.catalina.cluster.mcast.McastService"
mcastAddr="228.0.0.4"
mcastPort="45564"
mcastFrequency="500"
mcastDropTime="3000"/>

<Receiver
className="org.apache.catalina.cluster.tcp.ReplicationListener"
tcpListenAddress="auto"
tcpListenPort="4001"
tcpSelectorTimeout="100"
tcpThreadCount="6"/>

<Sender
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
replicationMode="pooled"
ackTimeout="15000"/>

<Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>

<Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
</Cluster>
-->



<!-- Normally, users must authenticate themselves to each web app
individually. Uncomment the following entry if you would like
a user to be authenticated the first time they encounter a
resource protected by a security constraint, and then have that
user identity maintained across *all* web applications contained
in this virtual host. -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->

<!-- Access log processes all requests for this virtual host. By
default, log files are created in the "logs" directory relative to
$CATALINA_HOME. If you wish, you can specify a different
directory with the "directory" attribute. Specify either a relative
(to $CATALINA_HOME) or absolute path to the desired directory.
-->
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->

<!-- Access log processes all requests for this virtual host. By
default, log files are created in the "logs" directory relative to
$CATALINA_HOME. If you wish, you can specify a different
directory with the "directory" attribute. Specify either a relative
(to $CATALINA_HOME) or absolute path to the desired directory.
This access log implementation is optimized for maximum performance,
but is hardcoded to support only the "common" and "combined" patterns.
-->
<!--
<Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->

</Host>

</Engine>

</Service>

</Server>
NC 2005-02-21
  • 打赏
  • 举报
回复
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
-->

<!-- Define the top level container in our container hierarchy -->
<Engine name="Catalina" defaultHost="localhost">

<!-- The request dumper valve dumps useful debugging information about
the request headers and cookies that were received, and the response
headers and cookies that were sent, for all requests received by
this instance of Tomcat. If you care only about requests to a
particular virtual host, or a particular application, nest this
element inside the corresponding <Host> or <Context> entry instead.

For a similar mechanism that is portable to all Servlet 2.4
containers, check out the "RequestDumperFilter" Filter in the
example application (the source for this filter may be found in
"$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").

Request dumping is disabled by default. Uncomment the following
element to enable it. -->
<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-->

<!-- Because this Realm is here, an instance will be shared globally -->

<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>

<!-- Comment out the old realm but leave here for now in case we
need to go back quickly -->
<!--
<Realm className="org.apache.catalina.realm.MemoryRealm" />
-->

<!-- Replace the above Realm with one of the following to get a Realm
stored in a database and accessed via JDBC -->

<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost/authority"
connectionName="test" connectionPassword="test"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->

<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
connectionName="scott" connectionPassword="tiger"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->

<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:CATALINA"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->

<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

<!-- Defines a cluster for this node,
By defining this element, means that every manager will be changed.
So when running a cluster, only make sure that you have webapps in there
that need to be clustered and remove the other ones.
A cluster has the following parameters:

className = the fully qualified name of the cluster class

name = a descriptive name for your cluster, can be anything

mcastAddr = the multicast address, has to be the same for all the nodes

mcastPort = the multicast port, has to be the same for all the nodes

mcastBindAddr = bind the multicast socket to a specific address

mcastTTL = the multicast TTL if you want to limit your broadcast

mcastSoTimeout = the multicast readtimeout

mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat

mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received

tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes

tcpListenAddress = the listen address (bind address) for TCP cluster request on this host,
in case of multiple ethernet cards.
auto means that address becomes
InetAddress.getLocalHost().getHostAddress()

tcpListenPort = the tcp listen port

tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS
has a wakup bug in java.nio. Set to 0 for no timeout

printToScreen = true means that managers will also print to std.out

expireSessionsOnShutdown = true means that

useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.
false means to replicate the session after each request.
false means that replication would work for the following piece of code: (only for SimpleTcpReplicationManager)
<%
HashMap map = (HashMap)session.getAttribute("map");
map.put("key","value");
%>
NC 2005-02-21
  • 打赏
  • 举报
回复
我的server.xml没有修改,就是安装完成后默认的
<!-- Example Server Configuration File -->
<!-- Note that component elements are nested corresponding to their
parent-child relationships with each other -->

<!-- A "Server" is a singleton element that represents the entire JVM,
which may contain one or more "Service" instances. The Server
listens for a shutdown command on the indicated port.

Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->

<Server port="8005" shutdown="SHUTDOWN">

<!-- Comment these entries out to disable JMX MBeans support used for the
administration web application -->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

<!-- Global JNDI resources -->
<GlobalNamingResources>

<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>

<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />

</GlobalNamingResources>

<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" (and therefore the web applications visible
within that Container). Normally, that Container is an "Engine",
but this is not required.

Note: A "Service" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->

<!-- Define the Tomcat Stand-Alone Service -->
<Service name="Catalina">

<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Each Connector passes requests on to the
associated "Container" (normally an Engine) for processing.

By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
You can also enable an SSL HTTP/1.1 Connector on port 8443 by
following the instructions below and uncommenting the second Connector
entry. SSL support requires the following steps (see the SSL Config
HOWTO in the Tomcat 5 documentation bundle for more detailed
instructions):
* If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
* Execute:
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
with a password value of "changeit" for both the certificate and
the keystore itself.

By default, DNS lookups are enabled when a web application calls
request.getRemoteHost(). This can have an adverse impact on
performance, so you can disable it by setting the
"enableLookups" attribute to "false". When DNS lookups are disabled,
request.getRemoteHost() will return the String version of the
IP address of the remote client.
-->

<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector
port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
<!-- Note : To disable connection timeouts, set connectionTimeout value
to 0 -->

<!-- Note : To use gzip compression you could set the following properties :

compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
-->

<!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
<!--
<Connector port="8443"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

<!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
<!-- See proxy documentation for more information about using this. -->
<!--
<Connector port="8082"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" acceptCount="100" connectionTimeout="20000"
proxyPort="80" disableUploadTimeout="true" />
-->

<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host). -->

《深入剖析Tomcat(中文版+英文版)》.rar 《深入剖析Tomcat》深入剖析Tomcat 4和Tomcat 5中的每个组件(如果TOMCAT版本有点老,不过现在的Tomcat6和7同样可以借鉴参考),并揭示其内部工作原理。通过学习《深入剖析Tomcat》,你将可以自行开发Tomcat组件,或者扩展已有的组件。 Tomcat是目前比较流行的Web服务器之一。作为一个开源和小型的轻量级应用服务器,Tomcat 易于使用,便于部署,但Tomcat本身是一个非常复杂的系统,包含了很多功能模块。这些功能模块构成了Tomcat的核心结构。《深入剖析Tomcat》从最基本的HTTP请求开始,直至使用JMX技术管理Tomcat中的应用程序,逐一剖析Tomcat的基本功能模块,并配以示例代码,使读者可以逐步实现自己的Web服务器。 目录 第1章 一个简单的web服务器 1.1 http 1.1.1 http请求 1.1.2 http响应 1.2 socket类 1.3 应用程序 1.3.1 httpserver类 1.3.2 request类 1.3.3 response类 1.3.4 运行应用程序 1.4 小结 第2章 一个简单的servlet容器 2.1 javax.servlet.servlet接口 2.2 应用程序 2.2.1 httpserver1类 2.2.2 request类 2.2.3 response类 2.2.4 staticresourceprocessor类 2.2.5 servletprocessor1类 2.2.6 运行应用程序 2.3 应用程序 2.4 小结 第3章 连接器 3.1 stringmanager类 3.2 应用程序 3.2.1 启动应用程序 3.2.2 httpconnector类 3.2.3 创建httprequest对象 3.2.4 创建httpresponse对象 3.2.5 静态资源处理器和servlet处理器 3.2.6 运行应用程序 3.3 小结 第4章 tomcat的默认连接器 4.1 http 1.1的新特性 4.1.1 持久连接 4.1.2 块编码 4.1.3 状态码100的使用 4.2 connector接口 4.3 httpconnector类 4.3.1 创建服务器套接字 4.3.2 维护httpprocessor实例 4.3.3 提供http请求服务 4.4 httpprocessor类 4.5 request对象 4.6 response对象 4.7 处理请求 4.7.1 解析连接 4.7.2 解析请求 4.7.3 解析请求头 4.8 简单的container应用程序 4.9 小结 第5章 servlet容器 5.1 container接口 5.2 管道任务 5.2.1 pipeline接口 5.2.2 valve接口 5.2.3 valvecontext接口 5.2.4 contained接口 5.3 wrapper接口 5.4 context接口 5.5 wrapper应用程序 5.5.1 ex05.pyrmont.core.simpleloader类 5.5.2 ex05.pyrmont.core.simplepipeline类 5.5.3 ex05.pyrmont.core.simplewrapper类 5.5.4 ex05.pyrmont.core.simplewrappervalve类 5.5.5 ex05.pyrmont.valves.clientiploggervalve类 5.5.6 ex05.pyrmont.valves.headerloggervalve类 5.5.7 ex05.pyrmont.startup.bootstrap1 5.5.8 运行应用程序 5.6 context应用程序 5.6.1 ex05.pyrmont.core.simplecontextvalve类 5.6.2 ex05.pyrmont.core.simplecontextmapper类 5.6.3 ex05.pyrmont.core.simplecontext类 5.6.4 ex05.pyrmont.startup.bootstrap 5.6.5 运行应用程序 5.7 小结 第6章 生命周期 第7章 日志记录器 第8章 载入器 第9章 session管理 第10章 安全性 第11章 standardwrapper 第12章 standardcontext类 第13章 host和engine 第14章 服务器组件和服务组件 第15章 digester库 第16章 关闭钩子 第17章 启动tomcat 第18章 部署器 第19章 manager应用程序servlet
全书一共被压缩为5个rar,这是第二个!!!! 其他的请看ID:ljtt123(本人分享) 本博客提供的所有教程的资源原稿均来自于互联网,仅供学习交流之用,切勿进行商业传播。同时,转载时不要移除本申明。如产生任何纠纷,均与本博客所有人、发表该文献之人无任何关系。谢谢合作 本书共分4部分,从xml、servlet、jsp和应用的角度向读者展示了java web开发中各种技术的应用,循序渐进地引导读者快速掌握java web开发。.   本书内容全面,涵盖了从事java web开发所应掌握的所有知识。在知识的讲解上,本书采用理论与实践相结合的方式,从程序运行的内部机制进行分析讲解,并通过大量的实例和实验来验证并运用本书的知识。.. 本书语言生动、通俗易懂、讲解细致,大部分章节都提供了多个例子,而且很多例子都是目前web开发中经常使用的功能,具有相当的实用价值。本书不仅可以作为java web开发的学习用书,还可以作为从事java web开发的程序员的参考用书和必备手册。此外,本书的配套光盘还免费提供了价值人民币330元的java教学视频,对java语言进行了全面讲解,帮助一些不会java语言的读者快速地从java基础知识的学习中过渡到java web的学习与开发上. 第1部分 xml篇. 第1章 xml与dtd 2 1.1 xml的产生 2 1.2 w3c介绍 2 1.3 关于xml的几个问题 3 1.4 xml与html的比较 4 1.4.1 xml将数据与显示分开 5 1.4.2 xml对文档的格式要求更加严格 6 1.4.3 xml有且只能有一个根元素 6 1.5 xml的编辑工具 7 1.6 xml文档 8 1.6.1 xml声明 9 1.6.2 文档类型声明 10 1.6.3 元素 11 1.6.4 注释 15 1.6.5 处理指令 15 1.6.6 空白处理 16 1.6.7 行尾处理 16 1.6.8 语言标识 16 1.7 格式良好的xml 17 .1.8 dtd 18 1.8.1 在xml文档中引入dtd 18 1.8.2 dtd的结构 21 1.9 有效的xml 35 1.10 xml处理器/解析器 35 1.11 小结 36 第2章 xml名称空间 38 2.1 声明名称空间 38 2.2 名称空间在元素和属性中的运用 39 2.2.1 名称空间在元素中的运用 39 2.2.2 默认名称空间 41 2.2.3 名称空间在属性中的运用 42 2.3 名称空间和dtd 43 2.4 小结 45 第3章 对xml文档进行分析 46 3.1 dom、sax和jaxp 46 3.2 使用dom解析xml文档 47 3.2.1 dom结构模型 47 3.2.2 dom解析器工厂 50 3.2.3 jaxp的错误类和异常类 52 3.2.4 用dom解析xml文档实例 53 3.3 使用sax解析xml文档 65 3.3.1 sax的处理机制 66 3.3.2 配置sax解析器 69 3.3.3 sax解析器工厂 70 3.3.4 sax的异常类 71 3.3.5 errorhandler接口 73 3.3.6 使用sax解析xml文档实例 74 3.4 jdom 83 3.4.1 下载并配置jdom 83 3.4.2 jdom api介绍 84 3.5 dom4j 88 3.5.1 下载并配置dom4j 88 3.5.2 dom4j api介绍 88 3.5.3 第一个实例 92 3.5.4 第二个实例 94 3.6 解析名称空间 96 3.6.1 dom和名称空间 96 3.6.2 sax和名称空间 97 3.6.3 jdom和名称空间 98 3.6.4 dom4j和名称空间 98 3.7 小结 99 第4章 xsl转换 101 4.1 xslt概述 101 4.2 xalan处理器 105 4.3 模板规则 106 4.4 [xsl:apply-templates]元素 107 4.5 [xsl:value-of]元素 108 4.6 [xsl:for-each]元素 110 4.7 匹配节点的模式 111 4.8 mode属性 113 4.9 内置的模板规则 114 4.10 对空白的处理 115 4.11 xpath语言 116 4.11.1 xpath上下文 116 4.11.2 位置路径 117 4.11.3 表达式 121 4.11.4 核心函数库 123 4.12 创建结果树 126 4.12.1 创建元素和属性 127 4.12.2 创建文本 131 4.12.3 创建处理指令 133 4.12.4 创建注释 133 4.12.5 复制节点 134 4.12.6 输出格式化的数字 135 4.13 条件处理 144 4.13.1 [xsl:if] 144 4.13.2 [xsl:choose] 145 4.14 排序 146 4.15 变量和参数 150 4.15.1 变量 150 4.15.2 参数 152 4.16 命名模板 153 4.17 合并样式表 154 4.17.1 导入样式表 154 4.17.2 包含样式表 155 4.18 模板规则冲突的解决 156 4.19 [xsl:output]元素 157 4.19.1 指定输出文档的格式 158 4.19.2 输出xml声明 158 4.19.3 输出文档类型定义 159 4.19.4 输出cdata段 160 4.19.5 指定文档缩进 161 4.19.6 指定媒体类型 161 4.20 xslt中的函数 162 4.21 数字格式化 162 4.22 查询和分组 164 4.23 处理多个输入文档 172 4.24 jaxp中的xslt api 175 4.24.1 转换器工厂 175 4.24.2 transformer和templates 176 4.24.3 一个例子 178 4.25 小结 179 第2部分 servlet篇 第5章 servlettomcat 182 5.1 servletservlet容器 182 5.2 servlet容器的分类 183 5.3 servlet和其他技术的比较 183 5.4 tomcat介绍 183 5.5 tomcat的安装与配置 184 5.5.1 安装tomcat 185 5.5.2 运行tomcat 186 5.5.3 tomcat启动分析 189 5.5.4 tomcat的体系结构 191 5.6 tomcat的管理程序 193 5.6.1 admin web应用程序 193 5.6.2 manager web应用程序 194 5.7 小结 195 第6章 servlet技术 196 6.1 servlet api 196 6.1.1 servlet接口 196 6.1.2 servlet相关接口与实现类 197 6.2 几个实例 205 6.2.1 实例一:simplehello 205 6.2.2 实例二:welcomeyou 210 6.2.3 实例三:outputinfo 216 6.2.4 实例四:loginservlet 220 6.3 servlet异常 223 6.3.1 servletexception类 224 6.3.2 unavailableexception类 224 6.4 servlet生命周期 224 6.5 servlet上下文 226 6.5.1 servletcontext接口 226 6.5.2 页面访问量统计实例 228 6.6 请求转发 231 6.6.1 requestdispatcher接口 232 6.6.2 得到requestdispatcher对象 232 6.6.3 请求转发的实例 233 6.6.4 sendredirect()和forward()方法的区别 238 6.7 小结 239 第7章 web应用程序的部署 240 7.1 配置任意目录下的web应用程序 240 7.2 war文件 242 7.3 tomcatservlet的另一种运行方式 244 7.4 与servlet配置相关的元素 247 7.4.1 [servlet]元素及其子元素 247 7.4.2 [servlet-mapping]元素及其子元素 249 7.5 一个实例 250 7.6 小结 253 第8章 数据库访问 254 8.1 驱动程序的类型 254 8.1.1 jdbc-odbc桥 254 8.1.2 部分本地api java驱动程序 255 8.1.3 jdbc网络纯java驱动程序 255 8.1.4 本地协议的纯java驱动程序 256 8.2 安装数据库 256 8.3 jdbc api 260 8.3.1 加载并注册数据库驱动 261 8.3.2 建立到数据库的连接 263 8.3.3 访问数据库 264 8.3.4 事务处理 289 8.3.5 可滚动和可更新的结果集 296 8.4 jdbc数据源和连接池 299 8.5 mysql对中文的处理 302 8.6 小结 302 第9章 会话跟踪 303 9.1 用于会话跟踪的技术 303 9.1.1 ssl会话 304 9.1.2 cookies 304 9.1.3 url重写 305 9.2 java servlet api的会话跟踪 306 9.2.1 httpsession接口 306 9.2.2 session的生命周期 307 9.2.3 cookie的应用 319 9.2.4 httpsessionbindinglistener接口 328 9.2.5 在线人数统计程序 329 9.3 小结 335 第10章 servlet的异常处理机制 337 10.1 声明式异常处理 338 10.1.1 http错误代码的处理 338 10.1.2 java异常的处理 341 10.2 程序式异常处理 343 10.2.1 在try-catch语句中处理异常 343 10.2.2 使用requestdispatcher来处理异常 346 10.3 小结 349 第11章 开发线程安全的servlet 350 11.1 多线程的servlet模型 350 11.2 线程安全的servlet 351 11.2.1 变量的线程安全 351 11.2.2 属性的线程安全 360 11.3 singlethreadmodel接口 362 11.4 小结 363 11.5 思考题 363 第3部分 jsp篇 第12章 jsp技术 366 12.1 jsp简介 366 12.2 jsp的运行机制 366 12.3 jsp的语法 371 12.3.1 指令元素(directive elements) 371 12.3.2 脚本元素(scripting elements) 374 12.3.3 动作元素(action elements) 376 12.3.4 注释 383 12.4 jsp的隐含对象 383 12.4.1 pagecontext 384 12.4.2 out 385 12.4.3 page 385 12.4.4 exception 386 12.5 对象和范围 387 12.6 留言板程序 389 12.7 留言板管理程序 397 12.8 jsp文档 402 12.8.1 jsp文档的标识 404 12.8.2 jsp文档中的元素语法 404 12.9 小结 407 第13章 jsp与javabean 409 13.1 javabean简介 409 13.1.1 属性的命名 409 13.1.2 属性的类型 411 13.2 在jsp中使用javabean 412 13.2.1 [jsp:usebean] 412 13.2.2 [jsp:setproperty] 413 13.2.3 [jsp:getproperty] 414 13.2.4 示例 414 13.3 网上书店程序 418 13.4 小结 440 第14章 jsp开发的两种模型 441 14.1 模型1 441 14.2 模型2 445 14.3 小结 449 第15章 标签库(tag library) 450 15.1 标签库api 450 15.1.1 标签的形式 451 15.1.2 tag接口 451 15.1.3 iterationtag接口 453 15.1.4 bodytag接口 454 15.2 标签库描述符 455 15.2.1 [taglib]元素 456 15.2.2 [validator]元素 457 15.2.3 [listener]元素 457 15.2.4 [tag]元素 458 15.2.5 [tag-file]元素 460 15.2.6 [function]元素 461 15.3 传统标签的开发 462 15.3.1 实例一:[hello]标签 462 15.3.2 实例二:[max]标签 465 15.3.3 实例三:[greet]标签 467 15.3.4 实例四:[switch]标签 469 15.3.5 实例五:[iterate]标签 473 15.4 简单标签的开发 479 15.4.1 simpletag接口 479 15.4.2 实例一:[welcome]标签 480 15.4.3 实例二:[max_ex]标签 481 15.5 小结 483 第16章 表达式语言(el) 484 16.1 语法 484 16.1.1 “[ ]”和“.”操作符 484 16.1.2 算术操作符 484 16.1.3 关系操作符 485 16.1.4 逻辑操作符 485 16.1.5 empty操作符 485 16.1.6 条件操作符 485 16.1.7 圆括号 486 16.1.8 操作符的优先级 486 16.2 隐含对象 486 16.3 命名变量 487 16.4 保留的关键字 488 16.5 函数 488 16.6 小结 489 第17章 jsp标准标签库(jstl) 490 17.1 jstl简介 490 17.2 配置jstl 491 17.3 core标签库 491 17.3.1 一般用途的标签 492 17.3.2 条件标签 496 17.3.3 迭代标签 498 17.3.4 url相关的标签 501 17.4 i18n标签库 506 17.4.1 国际化标签 506 17.4.2 格式化标签 511 17.5 sql标签库 520 17.5.1 [sql:setdatasource] 520 17.5.2 [sql:query] 521 17.5.3 [sql:param] 524 17.5.4 [sql:dateparam] 525 17.5.5 [sql:update] 526 17.5.6 [sql:transaction] 527 17.6 xml标签库 529 17.6.1 核心操作 529 17.6.2 流程控制 532 17.6.3 转换操作 536 17.7 functions标签库 539 17.7.1 fn:contains 539 17.7.2 fn:containsignorecase 539 17.7.3 fn:startswith 540 17.7.4 fn:endswith 541 17.7.5 fn:indexof 541 17.7.6 fn:replace 542 17.7.7 fn:substring 543 17.7.8 fn:substringbefore 544 17.7.9 fn:substringafter 544 17.7.10 fn:split 545 17.7.11 fn:join 546 17.7.12 fn:tolowercase 547 17.7.13 fn:touppercase 547 17.7.14 fn:trim 548 17.7.15 fn:escapexml 548 17.7.16 fn:length 549 17.8 小结 549 第18章 标签文件(tag files) 551 18.1 标签文件的语法 551 18.2 一个简单的标签文件 551 18.3 标签文件的隐含对象 554 18.4 标签文件的指令 555 18.4.1 tag指令 555 18.4.2 attribute指令 556 18.4.3 variable指令 557 18.5 标签文件实例讲解 558 18.5.1 实例一:[welcome]标签 558 18.5.2 实例二:[tohtml]标签 559 18.6 [jsp:invoke]动作元素 561 18.7 [jsp:dobody]动作元素 562 18.8 小结 562 第4部分 应用篇 第19章 使用log4j进行日志操作 564 19.1 log4j介绍 564 19.1.1 logger组件 564 19.1.2 appender组件 566 19.1.3 layout组件 567 19.2 使用log4j 568 19.3 log4j使用实例 572 19.4 ndc和mdc 585 19.5 小结 587 第20章 filter在web开发中的应用 588 20.1 过滤器概述 588 20.2 filter api 589 20.2.1 filter接口 589 20.2.2 filterconfig接口 590 20.2.3 filterchain接口 590 20.3 过滤器的部署 591 20.4 过滤器的开发 592 20.5 对用户进行统一验证的过滤器 594 20.6 对请求和响应数据进行替换的 20.6 过滤器 600 20.7 小结 609 第21章 中文乱码问题与国际化 610 21.1 中文乱码问题产生的由来 610 21.1.1 常用字符集 610 21.1.2 对乱码产生过程的分析 612 21.2 中文乱码问题的解决方案 614 21.3 使用过滤器解决中文问题 616 21.4 让tomcat支持中文文件名 620 21.5 国际化与本地化 621 21.5.1 locale 621.. 21.5.2 资源包 623 21.5.3 编写国际化的web应用程序 625 21.6 小结 629 第22章 使用jbuilder2005开发web 第22章 应用程序 630 22.1 jbuilder2005简介 630 22.2 集成开发环境介绍 631 22.2.1 菜单栏 631 22.2.2 主工具栏 632 22.2.3 工程工具栏和工程窗口 632 22.2.4 结构窗口 633 22.2.5 文件标签和内容窗口 634 22.2.6 文件视图标签 634 22.2.7 消息窗口 637 22.3 jbuilder2005的基本配置 638 22.3.1 配置jdk 638 22.3.2 配置web服务器 640 22.4 文件的上传和下载 642 22.4.1 基于表单的文件上传 642 22.4.2 文件上传格式分析 643 22.4.3 commons-fileupload组件 644 22.4.4 文件上传实例 646 22.4.5 文件下载实例 656 22.5 给图片添加水印和文字 664 22.6 小结 667 第23章 开发安全的web应用程序 668 23.1 概述 668 23.2 理解验证机制 669 23.2.1 http basic authentication 669 23.2.2 http digest authentication 670 23.2.3 https client authentication 670 23.2.4 form based authentication 671 23.3 声明式安全 671 23.3.1 [security-constraint]元素 671 23.3.2 [login-config]元素 673 23.3.3 基本验证的实现 674 23.3.4 基于表单验证的实现 676 23.3.5 使用数据库保存用户名和密码 678 23.4 程序式安全 682 23.5 sql注入攻击的防范 685 23.6 小结 687 第24章 web应用程序开发实例 688 24.1 图像的缩放 688 24.2 如何动态生成验证码 692 24.3 如何避免表单的重复提交 696 24.3.1 在客户端避免表单的重复提交 697 24.3.2 在服务器端避免表单的重复 24.3.2 提交 700 24.4 小结 706 第25章 使用ant辅助web应用程序 第25章 开发 707 25.1 ant介绍 707 25.2 安装并配置ant 708 25.2.1 下载并安装ant 708 25.2.2 设置ant的运行环境 708 25.3 编写ant的构建文件 709 25.3.1 准备工作 709 25.3.2 工程([project]) 712 25.3.3 目标([target]) 713 25.3.4 任务 714 25.3.5 path-like structures 728 25.3.6 引用(references) 729 25.4 部署到tomcat 730 25.5 运行ant 732 25.6 小结 732 第26章 xml和xslt在web开发中的 第26章 应用 733 26.1 功能概述 733 26.2 程序设计 733 26.2.1 软件架构 733 26.2.2 页面设计 735 26.2.3 数据库设计 747 26.3 程序实现 749 26.3.1 org.sunxin.guestbook 749 26.3.2 org.sunxin.guestbook.beans 750 26.3.3 org.sunxin.guestbook.util 758 26.3.4 org.sunxin.guestbook.parser 762 26.3.5 org.sunxin.guestbook.controller 765 26.3.6 org.sunxin.guestbook.view 787 26.3.7 page.xsl 791 26.3.8 web.xml 797 26.3.9 context.xml 798 26.4 小结 798 附录a 快速掌握html 799 附录b 解析http 820 附录c server.xml文件 833 附录d web.xml文件 840 索引 852...

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧