- 浏览: 22398 次
- 性别:
- 来自: 无锡
最新评论
文章列表
Exception:
从连接池中获取数据库连接发生异常 : Cannot create PoolableConnectionFactory (Illegal connection port value '3306:DB)
Solution:
1.在Tomcat中server.xml的<GlobalNamingResources> 节点里面添加如下代码: <Resource name="jdbc/mbss" auth="Container" type="javax.sql.DataSource" ...
Servlets & JSP Series 9 - Custom tags are powerful
Using the c:out tag to render the text of users prevents cross-site hacking of this form by displaying the <script> tags and the JS code in other user’s web browser, this prevents the JS code from being interpreted by the browser, ...
Servlets & JSP Series 8 - Script-free pages
Standard action is related to JavaBean; Standard actions contains- 1.jsp:useBean; 2.jsp:getProperty; 3.jsp:setProperty; 4.jsp:include; 5.jsp:forward.
Declare and initialize a bean attribute with <jsp:useBean>; Get a bean attribute’s propert ...
Servlets & JSP Series 7 - Being a JSP
A JSP becomes a servlet: a sevlet that you do not create, the container looks at your JSP, translates it into Java source code, and compiles it into a full-fledged Java servlet class.
The Container takes what you have written in your JSP, translates i ...
Servlets & JSP Series 6 - Conversational state
An HttpSession object can hold conversational state across multiple requests from the same client, in orther words it persists for an entire session with a specific client, we can use it to store everything we get back from the client in all th ...
Servlets & JSP Series 5 - Being a Web App
Every servlet inherits a getServletConfig() method, the getServletConfig method returns a ServletConfig, and one of its methods is getInitParameter(), we cannot use servlet init parameters until the servlet is initialized.
When the container in ...
Servlets & JSP Series 4 - Being a Servlet
Container’s overall role in one servlet’s life: 1.User clicks a link that has a URL to a servlet to generate a request; 2.The Container “sees” that the request is for a servlet, so the container creates two objects: a.HttpServletResponse b.HttpSer ...
Servlets & JSP Series 3 - One Mini MVC Tutorial
Construct the file and directory structure of a web application that may contain: 1.static content; 2.JSP pages; 3.servlet classes; 4.the deployment descriptor; 5.tag libraries; 6.JAR files; 7.Java class files.
The Steps to build a real we ...
Servlets & JSP Series 2 - Web APP Architecture
Servlets do not have a main() method, they are under the control of another Java application called a Container. Tomcat is an example of a container, when web server application gets a request for a servlet the server hands the request no ...
Servlets & JSP Series 1 - Why do we use JSP
Web由数以亿计的客户(浏览器)和服务器(Apache应用服务器)组成,这些客户和服务器之间通过有线和无线网络连接,Web服务器接收客户请求,然后向客户返回一些结果。
客户的请 ...
Java编程思想之七-复用类
复用代码是Java众多引人注目的功能之一,但Java要乡成为极具革命性的语言,仅能够复制代码并对之加以改变还不够,还必须能够做更多的事情。
为了使用类而不破坏现有代码,方法之一只需在新的类中产生现有类的对象,由于新的类是由现有类的对象组成,所以这种方法称为组合,此法只复用现有程序代码的功能,而非它的形式。
为了使用类而不破坏现有代码,方法之二是按照现有类来创建新类,无需改变现有形式,采用现有类的形式并在其中添加代码,此法称为继承,继承是面向对象基石之一。
编译器不是简单地为每一个引用都创建默认对象,如果想初始化这 ...
Java编程思想之六-访问权限控制
访问控制(或隐藏具体实现)与“最初的实现并不恰当”有关,访问权限机制解决的问题是:如何把变动的事物与保持不变的事物区分开来。
为了解决类库的开发者有权限对类库进行修改和改进并且能够确保客户代码不会因为这些改动而受到影响,Java提供了权限修饰符,权限由大到小依次为:public, protected, default和private。
类库设计员会尽可能将一切方法都定为private,而仅向客户端程序员公开他所愿意让他们使用的方法,这样的做法完全正确,但是对于那些经常使用别的语言编程并在访问事物时不受任何限制的人而言,这就于他们的直觉相违