Wednesday, August 25. 2010

Tomcat中appBase和docBase的配置误区

Java

其实我是清楚这两个属性的区别的,但是我的服务器上一般每个host只有一个context,所以我习惯把host的appBase和context的docBase指向同一个位置,今天让我遇到问题了。我在看tomcat的日志的时候已经看到里面写着

Deploying web application directory images
Deploying web application directory templates
之类的,但是还是没往深了想,折腾了个把小时才搞定,大意啊。

网上一个兄弟已经把这个问题描述的很清楚了,不懂的人请入内看。

更多内容…

web.xml中servlet-mapping的url-pattern的配置(zt)

Java
在配置web.xml的servlet-mapping 的 url-pattern 碰到问题, 上网查, 查到servelt2_2-spec.pdf才得到答案.

结论:
'/XXX/*'
'*.html'
'/'
其他都是精确映射
      例: '/XXX/Y*.html' 只能映射/XXX/Y*.html 的URL请求.注:某些版本项目启动会抛出异常.
      例: '/XXX' 只可以映射/XXX的URL请求.

引用

10.2 Specification of Mappings
In the web application deployment descriptor, the following syntax is used to define mappings:
• A string beginning with a '/' character and ending with a '/*' postfix is used as a path
mapping.
• A string beginning with a '*.' prefix is used as an extension mapping.
• All other strings are used as exact matches only
• A string containing only the '/' character indicates that servlet specified by the mapping becomes the "default" servlet of the application.


翻译如下:
1.    在web应用的部署描述中(web.xml)中, 以下语法结构用于定义映射:
2.    以'/'开头 并以'/*'结尾的字符串用于做路径的映射.
3.    以'*.'开头 用于做扩展的映射.
4.    一个只是'/'的字符串 将当前这个servlet明确为应用的默认servlet.

参考:
下载servelt2_2-spec.pdf
http://java.sun.com/products/servlet/2.2/
Wednesday, August 15. 2007

Velocity模板中的几个怪异问题

Java

1、向模板中传递了一个变量page,值为整数1,使用#set($nextPage=$page+1),$nextPage可以正确得到2,使用#set($prevPage=$page-1)则错误的得到了“-1.0”,使用#set($prevPage=-1+$page)则可以正确得到0

2、在directive调用中使用Map作为参数,如果最后一个元素的值是通过变量传递的,velocity会报错。如,使用#directiveName({'count':3,'page':$page})会报错,使用#directiveName({'page':$page,'count':3})则没有错误。

Thursday, July 19. 2007

JAVA中类名字包括$符号,求高手赐教一下,这具有什么意义呢? (zt)

Java

举个例子,在springframework里面有个类叫
SimpleNamingContext$AbstractNamingEnumeration

答:AbstractNamingEnumeration是SimpleNamingContext的内部类。内部类在编译的时候会生成独立的class文件,命名方式就是:主类$内部类。

Wednesday, July 11. 2007

关于Tomcat与MySQL连接池问题的详解(zt)

Java
更多内容…

(Page 1 of 2, totalling 9 entries) » next page

Categories

All categories

Calendar

« 2010 年 September »
Mon Tue Wed Thu Fri Sat Sun
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      

Archives

Quicksearch

友情链接

Syndicate This Blog

XML RSS 1.0 feed
XML RSS 2.0 feed

Blog Administration

Open login screen

访问统计

Locations of visitors to this page
The articles in this sites are copyrighted, except those marked as reshipped
MII Record: 05029638