Alex刺客

Dancing fingers, damage world. -- 舞动手指,破坏世界.

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  57 随笔 :: 0 文章 :: 76 评论 :: 0 Trackbacks

2009年7月2日 #

Linux下的播放器.

还记得N年前,本本装个Linux能发出声都是万幸的事.现在 Linux 平台越来越强大.驱动也更完善 . 像咱们这些喜欢音乐的 fans 也开始追逐 Linux 上的音质表现.
大多数Linux发行版本默认都不带音/视频解码器.只要你配置了第3方yum 比如(http://rpmfusion.org/). 然后打开系统自带的 totem 播放器随意打开个视频就会自动下载相关的解码器(建议尝试播放你机子上所有不同的视/音频格式.这种你就获得了最全面的解码器).
目前常见的格式 flac ape wav ogg mp3 aac m4a wma 只要你的系统安装了对应解码器都可获得支持.至少在我过的播放器中没碰见那种格式不能解释的.(前提你系统安装了解码器)
音乐播放器.
    1.Rhythmbox gnome 默认带的大多数格式都支持(前提你系统安装了解码器). 音质还算一般. 样子有点像 iTunes.均衡要装插件,调节后会有一点点的改善.但不突出.

    2.Audacious (有自己的解码器) 跟win 下的千千静听差不多.个人不太喜欢它的均衡没法调.
         安装方法: # yum install audacious audacious-plugins*

    3.Exaile 比较小 Python 语言写的. tags编辑功能是一大亮点,分类是我最喜欢的方式.均衡相对来说比以上两个要好一些.是我比较喜欢的一个player.
         安装方法: # yum install exaile

    4.Mplayer + smplayer 虽说是Linux下最牛的视频播放(全视频格式都支持,我机子上740p, 1080p都能跑就是CPU高了点.),用来播放音乐不合适.但是Linux下的音乐播放器(只说音质的话)我认为没一个音乐播放器的音质比mplyer强.不信你自己用无损的音乐仔细试听一下.总感觉有层次感一些.(调一点点均衡"V型"更容易突出这种效果.)
         安装方法: # yum install smplayer

刚捉的图欣赏一下. 每个播放器都带均衡调节喔.我的均衡方案说不定不适合你喔(理论上来说增强了低音跟高音,降低了中音频)合适听R&B,Hip-Hop,Rap,Rock.风格.
图: http://www.flickr.com/photos/56749281@N05/

Tips:
 推荐一个桌面歌词 Osd-lyrics 感觉还不错
os: feodra 14
Downlaod: http://code.google.com/p/osd-lyrics/

posted @ 2010-12-06 23:49 Alex刺客 阅读(6963) | 评论 (0)编辑 收藏

     摘要: linux 安装 Tomcat6
linux 安装 apache-tomcat-6.0.29
Tomcat 配置成 Linux 服务
Linux install Tomcat
Configured Linux installation services tomcat6  阅读全文
posted @ 2010-10-27 19:08 Alex刺客 阅读(1716) | 评论 (0)编辑 收藏

     摘要: WebQQ 无法登录 没有登录按钮  阅读全文
posted @ 2010-10-17 22:23 Alex刺客 阅读(1742) | 评论 (3)编辑 收藏

     摘要: Linux 下安装 牛津高阶英语词典 第8版 英英 支持 英音 美音 真人发音  阅读全文
posted @ 2010-10-13 02:19 Alex刺客 阅读(5944) | 评论 (3)编辑 收藏

     摘要:   阅读全文
posted @ 2010-10-13 01:53 Alex刺客 阅读(3898) | 评论 (2)编辑 收藏

     摘要:   阅读全文
posted @ 2010-09-09 04:13 Alex刺客 阅读(415) | 评论 (0)编辑 收藏

     摘要:   阅读全文
posted @ 2010-09-04 09:28 Alex刺客 阅读(48171) | 评论 (6)编辑 收藏

     摘要:   阅读全文
posted @ 2010-08-29 23:17 Alex刺客 阅读(1922) | 评论 (0)编辑 收藏

     摘要:   阅读全文
posted @ 2010-08-29 22:38 Alex刺客 阅读(494) | 评论 (0)编辑 收藏


 1     <!-- Proxool 连接池配置 -->
 2     <bean id="datasource" class="org.logicalcobwebs.proxool.ProxoolDataSource">
 3         <property name="alias" value="pfms-proxool" />
 4         <property name="driverUrl" value="jdbc:mysql:///pfmsdb" />
 5         <property name="driver" value="com.mysql.jdbc.Driver" />
 6         <property name="user" value="root" />
 7         <property name="password" value="123456" />
 8         <property name="maximumConnectionCount" value="10" />
 9         <property name="houseKeepingTestSql" value="select CURRENT_DATE" />
10     </bean>

posted @ 2010-08-24 22:15 Alex刺客 阅读(720) | 评论 (0)编辑 收藏

     摘要:   阅读全文
posted @ 2010-08-24 22:11 Alex刺客 阅读(2789) | 评论 (1)编辑 收藏

     摘要:   阅读全文
posted @ 2010-08-23 04:53 Alex刺客 阅读(285) | 评论 (0)编辑 收藏

     摘要:   阅读全文
posted @ 2010-08-14 04:21 Alex刺客 阅读(3132) | 评论 (0)编辑 收藏

     摘要:   阅读全文
posted @ 2010-08-14 04:02 Alex刺客 阅读(5532) | 评论 (0)编辑 收藏

     摘要:   阅读全文
posted @ 2010-08-10 08:04 Alex刺客 阅读(307) | 评论 (0)编辑 收藏

     摘要:   阅读全文
posted @ 2010-08-10 07:55 Alex刺客 阅读(302) | 评论 (0)编辑 收藏

     摘要: 看来ExtJS 3 border 布局 又增加了新的属性
collapseMode: 'mini',
minSize: 80, //最小高/宽度
maxSize: 400, //最大高/宽度
看看这些属性带来了什么功能  阅读全文
posted @ 2010-08-03 09:08 Alex刺客 阅读(1521) | 评论 (0)编辑 收藏

     摘要:   阅读全文
posted @ 2010-08-03 07:28 Alex刺客 阅读(984) | 评论 (1)编辑 收藏

     摘要:   阅读全文
posted @ 2010-08-03 06:40 Alex刺客 阅读(384) | 评论 (0)编辑 收藏

     摘要:   阅读全文
posted @ 2010-07-30 09:07 Alex刺客 阅读(308) | 评论 (0)编辑 收藏

Tomcat服务器.在使用 Ajax get方法的时候中文参数提交到了服务器变成了乱码.
这是因为 Tomcat 默认的 URL 编码为 ISO-8859-1 导致的.以下有两种解决方案.

1.java转换编码方式
 1     /**
 2      * 转换字符串编码
 3      * @param str 要进行转换的字符串
 4      * @param oldCode 指定str的编码
 5      * @param newCode 目标字符串编码
 6      * @return 目标字符串
 7      * @throws UnsupportedEncodingException
 8      */
 9     public static String transcoding(String str,String oldCode, String newCode) throws UnsupportedEncodingException{
10         byte[] bytes = str.getBytes(oldCode);
11         String newStr = new String(bytes, newCode);
12         return newStr;
13     }

1 String name = request.getParameter("name");
2 String resultStr = transcoding(name, "ISO-8859-1""UTF-8");
3 System.out.println(resultStr);

2.指定Tomcat URL编码
1 <Connector port="80" protocol="HTTP/1.1" 
2                connectionTimeout="20000" 
3                redirectPort="8444"
4                URIEncoding="UTF-8"/>
在配置http端口的地址添上URIEncoding="UTF-8".

这样就可这直接获取 URL 的属性
1 String name = request.getParameter("name");
2System.out.println(name);

posted @ 2010-07-14 23:33 Alex刺客 阅读(290) | 评论 (0)编辑 收藏

     摘要: 刚刚看了一下struts2/docs/json-plugin.html文档,正好前几天研究一下jQuery的API今天就试着练练jQuery做个 Study_Notes.IDE: eclipse-jee-galileo-SR2-linux-gtk例子完整的源代码,日志最下面有下载.1.注解方式Code highlighting produced by Actipro CodeHighlighter...  阅读全文
posted @ 2010-07-13 10:32 Alex刺客 阅读(5224) | 评论 (2)编辑 收藏

     摘要:   阅读全文
posted @ 2010-07-02 23:10 Alex刺客 阅读(421) | 评论 (0)编辑 收藏

     摘要: 省市县三级连动SQL语句  阅读全文
posted @ 2010-07-02 09:50 Alex刺客 阅读(1991) | 评论 (0)编辑 收藏

     摘要: 前言:
一.fedora 下载地址 跟 oracle database 11gr2
二.查看自己机子的信息
三.安装oracle database11gr2依赖包
四.配置系统文件
五.安装Oracle Database 11GR2
六. 成功安装完成后再接着配置。
问题1 解决方案
问题2 : 重启系统后oracle服务不会自动启动  阅读全文
posted @ 2010-06-22 22:29 Alex刺客 阅读(7365) | 评论 (3)编辑 收藏

1.首先找到my.cnf(MySQL配置文件)
     一般情况下在/etc/my.cnf 或者/etc/mysql/my.cnf 这个路径.如果你都找不到请用 "find /etc -name my.cnf" 命令搜索.

用vim打开 更改相应的属性值

 1 [mysqld]
 2 
 3 # MySQL 字符集
 4 default-character-set=utf8
 5 
 6 # MySQL 连接字符集
 7 init_connect='SET NAMES utf8'
 8 
 9 # 默认使用innoDB引擎
10 default-storage-engine=INNODB
11 
12 # 指定Mysql不区分大小写表名
13 lower_case_table_names=1
14 
15 [client]
16 
17 # 客户端字符集
18 default-character-set=utf8
19 


参考MySQL5.1官方中文手册
http://dev.mysql.com/doc/refman/5.1/zh/index.html

posted @ 2010-06-21 23:54 Alex刺客 阅读(466) | 评论 (0)编辑 收藏

     摘要: /**
* Project Name : Oracle_Database_11g_Study_Notes
* File Name : 2.User_Management.sql
* Author : Alex刺客
* Date : June 21,2010
*/  阅读全文
posted @ 2010-06-21 04:10 Alex刺客 阅读(507) | 评论 (0)编辑 收藏

     摘要: /**
* Project Name : Oracle_Database_11g_Study_Notes
* File Name : 1.Start_Login.sql
* Author : Alex刺客
* Date : June 21,2010
*/  阅读全文
posted @ 2010-06-21 04:03 Alex刺客 阅读(540) | 评论 (0)编辑 收藏

初次安装Oracle11G时EM服务已经启动但是关机后(或者IP时间过期后)EM无法启动

1.在系统环境变量设置ORACLE_SID = oracle (数据库sid),

2.在DOS中执行“emca -config dbcontrol db -repos recreate”命令重建EM.

3.如果还是无法解决请禁止网卡后再试(如果这种方案通过以后在启动EM时先禁止网卡)。

提示:
如果你的IP总是在更换比如在公司回来又在家(EM肯定在一个地方无法启动),
如查你的IP是DCHP非静态IP。

以上情况最好在安装前Oracle把网卡禁止掉,再安装Oracle,安装完成后再开启网卡。以后在启动EM时先禁止网卡启动EM后。再开启网卡。(我只有这个办法不知道哪位还有更好的方法)


安装好Oracle后 在Windwos服务当中把Oracle相关的3个设置成手动启动,这样加快计算机启动时的速度,要用Oracle的时候,再去XP的服务当中开启Oracle 的服务。

EM启动停止命令

emctl start dbconsole
emctl stop dbconsole
posted @ 2010-06-16 08:13 Alex刺客 阅读(875) | 评论 (0)编辑 收藏

     摘要: 1.确定oracle Listener 监听服务已经启动。
2.如果你的oracle数据库不是安装在本机那么请把oracle所在主机防火墙给关掉(哪怕你的防火墙开放1521端口,因为当有一个连接请求 1521端口时oracle会随机分配另一个端口给它.这是个人见解!望高手指点)
3.确定你连接的IP地址正确。

如果以上问题你都核实过那么请继续往下看。  阅读全文
posted @ 2010-06-16 07:53 Alex刺客 阅读(56196) | 评论 (4)编辑 收藏

     摘要: MyEclipse 8.5.0
MyEclipse Blue 8.5.0
MyEclipse for Spring 8.5.0
Windows 32、linux-gtk-x86、linux-gtk-x86_64、macosx
官方下载地址!  阅读全文
posted @ 2010-05-14 19:15 Alex刺客 阅读(116320) | 评论 (36)编辑 收藏

     摘要: 123.456 转 IEEE754 单精度浮点数二进制为:
符号位 阶码 尾数
0 10000101 11101101110100101111000

说明:
符号位
因为此数为正数所以为0。
阶码
IEEE 754 标准 把小数点移至最高有效位后,即指数为 6 ,再加上 指数偏移量 127 (等于 133) 那么阶码(移码)的二进制为 10000101 。
尾数
单精度浮点数只保留23位尾数即多余的尾数去掉,即原码 11101101110100101111000  阅读全文
posted @ 2010-04-18 08:04 Alex刺客 阅读(3690) | 评论 (0)编辑 收藏

     摘要: 原码

数值 X 的原码记为 [X]原,如果机器字长为 n (即采用 n 个二进制位表示数据),则最高位是符号位,0 表示正号,1 表示负号,基余的 n~1 位表示数值的绝对值。数值零的原码表示有两种形式:[+0]原=00000000,[-0]原=10000000。

例:
[+4]原 = 00000100
[-4]原 = 10000100
[+127]原 = 01111111
[-127]原 = 11111111   阅读全文
posted @ 2010-04-15 07:36 Alex刺客 阅读(731) | 评论 (0)编辑 收藏

     摘要: 如果只用 r 个基本符号表示数值,则称其为 r 进制。 r 称为该数制的基数。
比如:在二进制计数制中,r = 2 ,基本符号为 0 和 1 。二进制数中的一个 0 或 1 称为 1 位(bit)。

二进制转十进制
将二进制数的每一位数乘以它的权,然后相加,即可求得对应的十进制数值。

例: 1010110.011
= 1*2^6 + 0*2^5 + 1*2^4 + 0*2^3 + 1*2^2 + 1*2^1 + 0*2^0 + 0*2^-1 + 1*2^-2 + 1*2^-3
= 64 + 16 + 4 + 2 + 0.25 + 0.125
86.375  阅读全文
posted @ 2010-04-14 06:36 Alex刺客 阅读(851) | 评论 (0)编辑 收藏

     摘要:
解决方法:xulrunner 软件中有一个libxul.so
在自己的系统中找到一个xulrunner所在的路径
比如我的/usr/lib/xulrunner-1.9.1/.
用文本编辑器打开spket目录下的spket.ini在最后增加以下内容:
-Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib/xulrunner-1.9.1/  阅读全文
posted @ 2010-03-18 00:32 Alex刺客 阅读(327) | 评论 (0)编辑 收藏

     摘要: 1.检查系统是否有open-jdk

[root@localhost Alex] rpm -qa | grep java
tzdata-java-2010c-1.fc12.noarch
java_cup-0.11a-1.fc12.noarch
java-1.5.0-gcj-1.5.0.0-29.fc12.i686
java-1.6.0-openjdk-1.6.0.0-33.b16.fc12.i686
java-1.6.0-openjdk-plugin-1.6.0.0-33.b16.fc12.i686  阅读全文
posted @ 2010-03-18 00:19 Alex刺客 阅读(2282) | 评论 (0)编辑 收藏

1.安装smplayer

[root@localhost Alex]# yum install smplayer

2. 去http://www.mplayerhq.hu/MPlayer/releases/codecs/下载解码器

all-20100303.tar.bz2
windows-all-20071007.zip

3.解压解码器

[root@localhost 下载]# tar jxvf all-20100303.tar.bz2
[root@localhost 下载]# unzip windows-all-20071007.zip

[root@localhost 下载]# mkdir /usr/lib/codecs/
[root@localhost 下载]# mkdir /usr/lib/win32/

[root@localhost 下载]# mv all-20100303/* /usr/lib/codecs/
[root@localhost 下载]# mv windows-all-20071007/* /usr/lib/win32/


4.解决Smplayer没有画面
启动Smplayer -> 选项 -> 首选项 -> 常规 -> 视频 -> 输出设备 (更改为:gl2)


posted @ 2010-03-18 00:18 Alex刺客 阅读(536) | 评论 (0)编辑 收藏

1.安装ATI HD 3200 3D驱动
[root@localhost /]# yum install mesa-dri-drivers-experimental

2.重启计算机
[root@localhost /]# reboot

3.检查是否安装了渲染引擎
[root@localhost /]# glxinfo | grep direct
direct rendering: Yes

4.安装compiz-fusion
[root@localhost /]# yum install ccsm emerald-themes compizconfig-backend-gconf fusion-icon-gtk emerald compiz-fusion compiz-fusion-gnome libcompizconfig compiz-gnome compiz-bcop compiz compizconfig-python compiz-fusion-extras compiz-fusion-extras-gnome

5.安装cairo-dock工具栏
[root@localhost /]# yum install cairo-dock cairo-dock-devel cairo-dock-plug-ins cairo-dock-plug-ins-webkit cairo-dock-plug-ins-xfce





posted @ 2010-03-18 00:15 Alex刺客 阅读(356) | 评论 (0)编辑 收藏

方法:
1. 用VIM编辑/usr/bin/qq 启动器

[root@localhost bin]# vim /usr/bin/qq

2. 在cd前面增加 export GDK_NATIVE_WINDOWS=true 这行代码

#!/bin/sh
export GDK_NATIVE_WINDOWS=true
cd /usr/share/tencent/qq/
./qq

3. 保存退出完成
posted @ 2010-03-18 00:14 Alex刺客 阅读(372) | 评论 (0)编辑 收藏

1.安装主菜单编辑器
yun install alacarte

2.显示菜单跟按钮图标
gconftool-2 --type boolean --set /desktop/gnome/interface/buttons_have_icons true
gconftool-2 --type boolean --set /desktop/gnome/interface/menus_have_icons true

3.安装RAR压缩工具
yum install unrar

4.安装p7zip(7z压缩)
yum install p7zip
yum install p7zip-plugins

6.安装CHM阅读器
yum install gnochm

7.安装Adobe flash 插件
yum install flash-plugin

8.安装腾讯QQ
yum --nogpgcheck localinstall linuxqq-v1.0.2-beta1.i386.rpm

9.安装AdobeReader阅读器
yum install AdobeReader_enu
posted @ 2010-03-18 00:13 Alex刺客 阅读(397) | 评论 (0)编辑 收藏

fedora12 少数文档已经出来中文,可以支官方下载资料
http://docs.fedoraproject.org/

注意以下命令全部都是在Root用户下执行,请你使用su命令切换至root用户.
[alex@localhost ~]$ su

1.安装第三方软件包仓库
[root@localhost alex]# rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

2.安装自己挑选快速源镜像
[root@localhost alex]# yum install yum-fastestmirror

3.安装ibus五笔输入法
[root@localhost alex]# yum install ibus-table ibus-table-wubi

4.安装Adobe软件包仓库
[root@localhost alex]# rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm

5.安装yum多线程下载工具Axel

[root@localhost ~]# yum install axel

配置 axelget yum 插件
[root@localhost ~]# svn co http://cnfreesoft.googlecode.com/svn/trunk/axelget/ ~/axelget
A    /root/axelget/axelget.py
A    /root/axelget/axelget.conf
取出版本 622。
[root@localhost ~]# cd /etc/yum/pluginconf.d/
[root@localhost pluginconf.d]# ln -s ~/axelget/axelget.conf
[root@localhost pluginconf.d]# cd /usr/lib/yum-plugins/
[root@localhost yum-plugins]# ln -s ~/axelget/axelget.py

6.修改源配置文件

修改/etc/yum.repos.d/*.repo文件,此步主要是为了获取较快的站点,如果你不修改,你的/var/cache/yum下每个文件夹的 mirrorlist.txt中就会有大量的的日本,台湾的服务器站点,这些站点速度非常慢
       修改方法:
[root@localhost /]# gedit /etc/yum.repos.d/*.repo
       在每个文件的mirrorlist那行(一般是第5行,每个文件里有3处地方)的最后面加上“&country=us”.即选择美国的服务器,因为美国的服务器最多,同时速度基本上是最快的(其他自己增加源的不须要更改。

7.更新系统包包
[root@localhost alex]# yum -y update
posted @ 2010-03-18 00:12 Alex刺客 阅读(723) | 评论 (0)编辑 收藏

     摘要: 刚学ExtJS 所完成的一个小项目

所使用的技术:javaEE Servlet + JSON + ExtJS

开发平台 linux

操作系统: fedora 10 64位版
JDK版本: sun 1.6.0_17 for linux 64
IDE工具: eclipse-jee-galileo-SR1-linux-gtk-x86_64
spket插件: spket-1.6.18
ExtJS: ext-3.0.3
Server: apache-tomcat-6.0.20
MySQL: mysql-5.0.84 for linux 64
FireFox: 3.0.14 for linux  阅读全文
posted @ 2009-12-24 21:46 Alex刺客 阅读(1701) | 评论 (4)编辑 收藏

 1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2<html xmlns="http://www.w3.org/1999/xhtml">
 3    <head>
 4        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5        <title>原型链方式</title>
 6        <script type="text/javascript">
 7            /*
 8            *    项目: book -> Javascript高级程序设计.pdf -> 第四章 -> 4.2.1 继承的方式
 9            *    说明:使用prototype属性
10            *    练习者: Alex刺客
11            *    日期: 2009-12-13
12            */

13            
14            /*
15                原型链方式
16                原型链的神奇之处在于突出显示的代码,这里把ClassB的prototype属性设置成ClassA的实例。
17                这很有意义,因为想要ClassA的所有属性和方法。所以把ClassB的全部属性设置成ClassA的实例。
18                因为这种继承方式使用了prototype属性,所以instanceof运算符可以正确运行。
19            */

20            function ClassA () {}
21            
22            ClassA.prototype.color = 'red';
23            ClassA.prototype.sayColor = function () {
24                alert(this.color);
25            }

26            
27            function ClassB () {}
28            ClassB.prototype = new ClassA();
29            //添加新方法
30            ClassB.prototype.name = "ClassB";
31            ClassB.prototype.sayName = function () {
32                alert(this.name);
33            }

34            
35            /*
36                混合方式 对象冒充+原型链
37                跟建造类一样的问题也出现在继承当中,所以也就产生了这种方式。
38                用对象冒充继承构造函数,用原型链继承prototype对象的方法。
39            */

40            
41            function ClassD ( sColor) {
42                this.color = sColor;
43                if(typeof ClassD._initMethod == "undefined"{
44                    ClassD.prototype.sayColor = function () {
45                        alert(this.color);
46                    }

47                    alert('ClassD我只生成一次!');
48                    ClassD._initMethod = true;
49                }

50            }

51            var cd = new ClassD();
52            function ClassE (sColor, sName) {
53                ClassD.call(this,sColor);
54                this.name = sName;
55                if(typeof ClassE._initMethod == "undefined"{
56                    ClassE.prototype.sayName =function () {
57                        alert(this.name);
58                    }

59                    alert('ClassE我只生成一次!');
60                    ClassE._initMethod = true;
61                }

62            }

63            ClassE.prototype = new ClassD();
64            /*
65                继承机制不能采用动态化的原因是,prototype对象的唯一性。如果放入 if 区域 
66                在代码运行前,对象已被实例化了,并与原始的prototype对象联系在一起。虽然用极
67                晚绑定可使对原型对象的修改正确地返映出来,但是替换prototype对象却不会对该对象
68                产生任何影响。只有未来的对象实例才会反映出这种改变,这就使第一个实例变得不正确。
69                
70            */

71            
72            var ce1 = new ClassE("red","blueBoy");
73            var ce2 = new ClassE("blue","redBoy");
74            ce1.sayColor();
75            ce1.sayName();
76            ce2.sayColor();
77            ce2.sayName();
78            
79            
80        </script>
81    </head>
82    <body>
83    </body>
84</html>
posted @ 2009-12-13 23:11 Alex刺客 阅读(276) | 评论 (0)编辑 收藏

 1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2<html xmlns="http://www.w3.org/1999/xhtml">
 3    <head>
 4        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5        <title>对象冒充方式</title>
 6        <script type="text/javascript">
 7            /*
 8            *    项目: book -> Javascript高级程序设计.pdf -> 第四章 -> 4.2.1 继承的方式
 9            *    练习者: Alex刺客
10            *    日期: 2009-12-13
11            */

12            
13            /*
14                1.对象冒充
15            */

16            //ClassA类
17            function ClassA (sColor) {
18                this.color = sColor;
19                this.sayColor = function () {
20                        alert(this.color);
21                    }

22            }

23            
24            //ClassB类
25            function ClassB(sColor,sName){
26                //当前对象的属性是ClassA函数的指针
27                this.newMethod = ClassA;
28                //把参数传递给它
29                this.newMethod(sColor);
30                //删除当前对象的ClassA函数的指针
31                delete this.newMethod;
32                
33                //新增属性和方法
34                this.name = sName;
35                this.sayName = function () {
36                    alert(this.name);
37                }

38            }

39            
40            //var cb = new ClassB("blue!","Redboy");
41            //cb.sayColor();
42            //cb.sayName();
43            
44            /*
45                call()方法
46                call()方法与对象冒充方法最相似。它的第一个参数用作this的对象。
47                其他参数都直接传递给函数自身。
48            */

49            //ClassC类
50            function ClassC(sColor,sName){
51                //this.newMethod = ClassA;
52                //this.newMethod(sColor);
53                //delete this.newMethod;
54                ClassA.call(this,sColor); //以上三行代码由这行替代
55                
56                //新增属性和方法
57                this.name = sName;
58                this.sayName = function () {
59                    alert(this.name);
60                }

61            }

62            
63            //var cc = new ClassC("blue","c");
64            //cc.sayColor();
65            //cc.sayName();
66            
67            /*
68                apply()方法
69                apply()方法有两个参数,跟call()方法相似,只是第二个参数变成了数组。
70            */

71            //ClassD类
72            function ClassD(sColor,sName){
73                //this.newMethod = ClassA;
74                //this.newMethod(sColor);
75                //delete this.newMethod;
76                ClassA.apply(this,new Array(sColor)); //以上三行代码由这行替代
77                
78                //新增属性和方法
79                this.name = sName;
80                this.sayName = function () {
81                    alert(this.name);
82                }

83            }

84            
85            //var dt = new ClassD("red","blueBoy");
86            //dt.sayColor();
87            //dt.sayName();
88            
89        </script>
90    </head>
91    <body>
92    </body>
93</html>
posted @ 2009-12-13 23:10 Alex刺客 阅读(247) | 评论 (0)编辑 收藏

 1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2<html xmlns="http://www.w3.org/1999/xhtml">
 3    <head>
 4        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5        <title>修改对象:创建新方法</title>
 6        <script type="text/javascript">
 7            /*
 8            *    项目: book -> Javascript高级程序设计.pdf -> 第3章 -> 3.6 修改对象
 9            *
10            *    说明:每个构造函数都有一个prototype属性,可用于定义方法,而在ECMAScript中,每个本地对象也有一个用法完全相同的prototype属性。
11            *            
12            *    练习者: Alex刺客
13            *
14            *    日期: 2009-12-13
15            */

16            
17            /*
18                可用prototype属性为任何已有的类定义新方法,就像处理自己的类一样。
19                例如以下为Number类新增一个toHexString()方法。
20            */

21            Number.prototype.toHexString = function(){
22                return this.toString(16);
23            }

24            
25            var iNumber = 11;
26            
27            alert(iNumber.toHexString());
28            
29            /*
30                Array类新增一个检索匹配数组的值
31            */

32            
33            Array.prototype.indexOf = function (vItem){
34                for (var i=0; i<this.length; i++{
35                    if(this[i] == vItem) {
36                        return i;
37                    }

38                }

39                return -1;
40            }

41            
42            var aColors = new Array("red","green","yellow");
43            alert(aColors.indexOf("green"));
44        </script>
45    </head>
46    <body>
47    </body>
48</html>
posted @ 2009-12-13 23:00 Alex刺客 阅读(196) | 评论 (0)编辑 收藏

 1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2<html xmlns="http://www.w3.org/1999/xhtml">
 3    <head>
 4        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5        <title>实例</title>
 6        <script type="text/javascript">
 7            /*
 8            *    项目: book -> Javascript高级程序设计.pdf -> 第3章 -> 3.5.8实例
 9            *
10            *    说明:自定义对象的使用
11            *
12            *    练习者: Alex刺客
13            *
14            *    日期: 2009-12-13
15            */

16
17            /*
18                定义一个一次合并当前对象所有字符串的StringBuffer类
19            */

20            
21            function StringBuffer () {
22                this._strings_ = new Array;
23                if (typeof StringBuffer._initialized == "undefined"{
24                    StringBuffer.prototype.append = function (str){
25                        this._strings_.push(str);
26                    }

27                    StringBuffer.prototype.toString = function(){
28                        return this._strings_.join("");
29                    }

30                }

31            }

32            
33            var stringBufferTest = new StringBuffer();
34            var string2 = new StringBuffer();
35            stringBufferTest.append("Hello ");
36            stringBufferTest.append("World! ");
37            stringBufferTest.append("Welcome");
38            stringBufferTest.append("to ");
39            stringBufferTest.append("JavaScript! ");
40            string2.append("Alex ");
41            string2.append("刺客!");
42            var result = stringBufferTest.toString();
43            var test = string2.toString();
44            alert(result);
45            alert(test);
46        </script>
47    </head>
48    <body>
49    </body>
50</html>
posted @ 2009-12-13 22:54 Alex刺客 阅读(183) | 评论 (0)编辑 收藏

     摘要:   1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   2<html&n...  阅读全文
posted @ 2009-12-13 22:52 Alex刺客 阅读(206) | 评论 (0)编辑 收藏

 1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2<html xmlns="http://www.w3.org/1999/xhtml">
 3    <head>
 4        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5        <title>类型转换</title>
 6        <script type="text/javascript">
 7            /*
 8            *    项目: book -> Javascript高级程序设计.pdf -> 第2章 -> 2.6 原始类型
 9            *
10            *    练习者: Alex刺客
11            *
12            *    日期: 2009-12-13
13            */

14            
15            /*
16                转换成字符串
17                ECMAScript 的 Boolean、Number、String这此原始类型有趣在于它们都是伪对象
18                这意味着它们实际上具有属性和方法。例如获得字符串的长度,可以用length属性。
19            */

20            var sColor = "red";
21            alert(sColor+"的长度是:"+sColor.length);
22            //outputs "3"
23            
24            /*
25                3种主要的原始类型值Boolean、Nnmber、String 都有 toString()方法。不要感到奇怪
26                String还有toString()方法。这是因为ECMAScript定义所有对象都有toString()方法无论它
27                是伪对象,还是真的对象。因为String类型属于伪对象,所以它一定有toString()方法。
28            */

29            var str = "Alex刺客";
30            alert("String类型:'"+str+"'调用toString方法:虽然这是多余的:但我还是会给你:"+str.toString());
31            
32            /*
33                Number类型的toString()方法分为默认模式和基本模式。
34                采用基本模式时在调用toString()方法时传递一个参数比如:2 代表 二进制, 8 代表八进制, 16代表十六进制
35            */

36            
37            var n8Number = 017;
38            alert("八进制Number类型转换为String:"+n8Number.toString());
39            //如果以上不调用toString()方法,也会执行toString()方法
40            alert("以二进制转换成String:"+n8Number.toString(2));
41            
42            /*
43                转换成数字
44                ECMAScript提供两种把非数字类型转换成数字类型的方法,即parseInt()和parseFloat()。
45                注意: 这两个方法只转换无效字符之前的字符串。 比如: "4.3zefef" 跟 '4.3.3' 结果都是  4.3
46            */

47                
48                var iNumber = parseInt('1234');
49                var fNumber = parseFloat('0.88');
50                alert("字符串转换成数字整型:"+iNumber);
51                alert("字符串转换成数字浮点型:"+fNumber);
52                
53                /*
54                    parseInt()方法还有基本模式,可以把二进制、八进制、十六进制或其他任何进制的字符
55                    转换成整数.是由parseInt()方法的第二个参数指定的。
56                    parseFloat()方法不支技基本模式
57                */

58                
59                //转换为16进制
60                var i16 = parseInt("af"16);
61                
62                
63                
64                /*
65                    强制类型转换
66                    Boolean(value) ——把给定的值转换成Boolean型
67                    Number(value)——把给定的值转换成Number型
68                    String(value)——把给定的值转换成String型
69                */

70                
71                var b1 = Boolean("");            //false
72                var b2 = Boolean('hi');        //true
73                var b3 = boolean(100);        //true
74                var b4 = boolean(null);        //false
75                var b5 = boolean(0);            //false
76                var b6 = boolean(new Object());    //true
77                
78                
79                /*
80                    最后一种强制类型转换方法String();可把任何值转换成字符串。
81                */

82                
83        </script>
84    </head>
85    <body>
86    </body>
87</html>
posted @ 2009-12-13 22:50 Alex刺客 阅读(408) | 评论 (0)编辑 收藏

 1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2<html xmlns="http://www.w3.org/1999/xhtml">
 3    <head>
 4        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5        <title>String类型</title>
 6        <script type="text/javascript">
 7            /*
 8            *    项目: book -> Javascript高级程序设计.pdf -> 第2章 -> 2.6 原始类型
 9            *
10            *    说明:    String类型是没有固定大小的原始类型。可以用双引号( " )单引号( ' )声明。
11            *            String类型还包过几种字符字面量,比如: \n 换行 \t 制表符
12            *    练习者: Alex刺客
13            *
14            *    日期: 2009-12-13
15            */

16            var sColor1 = "blue";
17            var SColor2 = 'blue';
18        </script>
19    </head>
20    <body>
21    </body>
22</html>
posted @ 2009-12-13 22:49 Alex刺客 阅读(161) | 评论 (0)编辑 收藏

 1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2<html xmlns="http://www.w3.org/1999/xhtml">
 3    <head>
 4        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5        <title>Number类型</title>
 6        <script type="text/javascript">
 7            /*
 8            *    项目: book -> Javascript高级程序设计.pdf -> 第2章 -> 2.6 原始类型
 9            *
10            *    说明:    Number类型可以表示32位的整数,还可以表示64的浮点数。任何数字都被看作Number类型
11            *            
12            *    练习者: Alex刺客
13            *
14            *    日期: 2009-12-13
15            */

16            //整数
17            var iNumber = 55;
18            //八进制。以0开头
19            var iNumber8 = 070;
20            //十六进制。以0x开头
21            var iNumber16 = 0xAf;
22            
23            /*
24            注意:尽管Number类型可以表示为八进制或十六进制的字面量,
25            但所有的数学运算都是返回十进制结果。
26            */

27            alert(iNumber8+iNumber16);
28            //定义浮点值
29            var fNumber = 5.0;
30            //定义非常大的数,可用科学记数法
31            var fNumberMax = 3.889e7;
32            /*
33            也可用64位IEEE754形式存储浮点值,这意味着十进制最多可以有17个十
34            进制位。17位之后的值将被截去,从而造成一些小的数学误差。
35            
36            几个特殊值也被定义为Number 类型。前两两个是Number.MAX_VALUE
37            和Number.MIN_VALUE.它们定义了Number值集合的外边界。
38            所有的ECMAScript数都必须在这两个值之间。不过计算生成的数值结果可
39            以不落在这两个数之间。当计算生成的数大于Number.MAX_VALUE时,它
40            将被赋予Number.POSITIVE_INFINITY,意味着不再有数字值。同样,生成
41            的数值小于Number.MIN_VALUE的计算也会被赋予值Number.NEGATIVE_INFINITY,
42            也意味着不再有数字值。如果计算返回的是无穷大值,那么生成的结果不能再用于其它计算。
43            */

44            
45            /*
46                由于无穷大数可以是正数也可以是负数,所以可用一个方法判断一个数是否是有穷的。
47                IsFinite(Number value)方法! value要判数的值
48            */

49            
50            /*
51                最后一个特殊值是NaN,表示非数(Not a Number)。NaN是个奇怪的特殊值。一般来说
52                这种情况发生在类型转换失败时。与无穷大值一样,NaN也不能用于算术计算。NaN另一个
53                奇怪之处在于,它与自身不相等!
54            */

55            
56            alert( NaN == NaN);
57            //false
58            //出于这种原因,不推荐使用NaN值本身。函数isNaN()会做得相当好。
59            
60            alert("字符串'blue'不能转为数字类型"+isNaN("blue"));
61            //true
62            alert("字符串'123'不能转为数字类型"+isNaN("123"));
63            //false
64        </script>
65    </head>
66    <body>
67    </body>
68</html>
posted @ 2009-12-13 22:47 Alex刺客 阅读(421) | 评论 (0)编辑 收藏

 1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2<html xmlns="http://www.w3.org/1999/xhtml">
 3    <head>
 4        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5        <title>Boolean类型</title>
 6        <script type="text/javascript">
 7            /*
 8            *    项目: book -> Javascript高级程序设计.pdf -> 第2章 -> 2.6 原始类型
 9            *
10            *    说明:    Boolean类型它有两个值true和false(即两个Beoolean字面量)。即使false不等于0,0也可以在必要时被转换成false,这样在Boolean语句中使用两者都是安全的。
11            *            
12            *    练习者: Alex刺客
13            *
14            *    日期: 2009-12-13
15            */

16            
17            var bFalse = false;
18            var bTrue = true;
19            alert(bFalse);
20            alert(bTrue);
21        </script>
22    </head>
23    <body>
24    </body>
25</html>
posted @ 2009-12-13 22:46 Alex刺客 阅读(190) | 评论 (0)编辑 收藏

 1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2<html xmlns="http://www.w3.org/1999/xhtml">
 3    <head>
 4        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5        <title>Null类型</title>
 6        <script type="text/javascript">
 7            /*
 8            *    项目: book -> Javascript高级程序设计.pdf -> 第2章 -> 2.6 原始类型
 9            *
10            *    说明:    Null类型也只有一个值,即null它的字面量。undefined类型实际上是从null类型的子类,因此ECMAScript把它们定义为相等。
11            *            
12            *    练习者: Alex刺客
13            *
14            *    日期: 2009-12-13
15            */

16            
17            alert (null == undefined);
18            //true
19        </script>
20    </head>
21    <body>
22    </body>
23</html>
posted @ 2009-12-13 22:45 Alex刺客 阅读(176) | 评论 (0)编辑 收藏

 1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2<html xmlns="http://www.w3.org/1999/xhtml">
 3    <head>
 4        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5        <title>Undefined类型</title>
 6        <script type="text/javascript">
 7            /*
 8            *    项目: book -> Javascript高级程序设计.pdf -> 第2章 -> 2.6.2  2.6 原始类型
 9            *
10            *    说明:    Undefined类型只有一个值,即undefined。当声明的变量未初始时,该变量的默认值是undefined。
11            *            
12            *
13            *    练习者: Alex刺客
14            *
15            *    日期: 2009-12-13
16            */

17            var oTemp;
18            //判断此变量类型的字面量是否等于undefined
19            alert(oTemp == undefined);
20            //true
21            
22            //弹出此此变量的类型
23            alert("未初始化的变量 oTemp="+typeof oTemp);
24            //undefined
25            
26            //注意: Alex变量未声明此时弹出的也是undefined
27            alert("未声明的变量 Alex="+typeof Alex);
28            
29            //函数无明确返回值时,返回的也是undefined
30            function textMethod(){
31            
32            }

33            alert("函数的返回值 textMethod()="+ textMethod());
34            
35        </script>
36    </head>
37    <body>
38    </body>
39</html>
posted @ 2009-12-13 22:43 Alex刺客 阅读(209) | 评论 (0)编辑 收藏

 

 1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2<html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5  <title>2.1原始类型</title>
 6  <script type="text/javascript">
 7   /*
 8   * 项目: book -> Javascript高级程序设计.pdf -> 第2章 -> 2.6 原始类型
 9   *
10   * 说明: ECMAScript有5种原始类型(primitive type),即 Undefined、Null、
11   *   Boolean、Number 和 String。可用 typeof 运算符来判断一个值
12   *   属于哪种类型。如果它是原始类型,返回类型信息。
13   *
14   * 练习者: Alex刺客
15   *
16   * 日期: 2009-12-13
17   */

18   
19   // 定义变量
20   var nuTemp;
21   var uTemp = null;
22   var bTemp = true;
23   var nTemp = 20;
24   var sTemp = "this javaScript!";
25   
26   //定义弹出窗变量类型信息
27   alert(typeof nuTemp);
28   alert(typeof uTemp);
29   alert(typeof bTemp);
30   alert(typeof nTemp);
31   alert(typeof sTemp);
32  </script>
33 </head>
34 <body>
35 </body>
36</html>
posted @ 2009-12-13 22:40 Alex刺客 阅读(182) | 评论 (0)编辑 收藏

  1 <?xml version="1.0" encoding="UTF-8"?>
  2 <!DOCTYPE struts PUBLIC
  3     "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
  4     "http://struts.apache.org/dtds/struts-2.1.dtd">
  5 <struts>
  6     <!-- 下面元素可以出现0次,也可以无限多次 -->
  7     <!-- 配置struts.properties的key 跟 value -->
  8     <constant name="" value=""/>
  9     
 10     <!-- 下面元素可以出现0次,也可以无限多次 -->
 11     <bean class="" name="" type="" scope="" static="" optional=""/>
 12     
 13     <!-- 下面元素可以出现0次,也可以无限多次 -->
 14     <include file=""/>
 15     
 16     <!-- package元素是Struts配置文件的核心,该元素可以出现0次,或者无限多次 -->
 17     <package name="必填的包名" extends="" namespace="" abstract="" externalReferenceResolver="">
 18         <!-- 该元素可以出现,也可以不出现,最多出现一次 -->
 19         <result-types>
 20         
 21             <!-- 该元素必须出现,可以出现无限多次 -->
 22             <result-type name="" class="" default="true|false">
 23             
 24                 <!-- 下面元素可以出现0次,也可以无限多次 -->
 25                 <param name="参数名">参数值</param>
 26                 
 27             </result-type>
 28             
 29         </result-types>
 30         
 31         <interceptors>
 32             <!-- 该元素的 interceptors元素和interceptors-stack至少出现其中之一,也可以二者都出现-->
 33             <!-- 下面元素可以出现0次,也可以无限多次 -->
 34             <interceptor name="" class="">
 35             
 36                 <!-- 下面元素可以出现0次,也可以无限多次 -->
 37                 <param name="参数名">参数值</param>
 38                 
 39             </interceptor>
 40             
 41             <!-- 下面元素可以出现0次,也可以无限多次 -->
 42             <interceptor-stack name="">
 43                 <!-- 该元素必须出现,可以出现无限多次 -->
 44                 <interceptor-ref name="">
 45                     <!-- 下面元素可以出现0次,也可以无限多次 -->
 46                     <param name="参数名">参数值</param>
 47                 </interceptor-ref>
 48             </interceptor-stack>
 49         </interceptors>
 50         
 51         
 52         <!-- 下面元素可以出现0次,也可以无限多次 -->
 53         <default-interceptor-ref name="">
 54             <!-- 下面元素可以出现0次,也可以无限多次 -->
 55             <param name="参数名">参数值</param>
 56         </default-interceptor-ref>
 57         
 58         <default-action-ref name="">
 59             <!-- 下面元素可以出现0次,也可以无限多次 -->
 60             <param name="参数名">参数值</param>
 61         </default-action-ref>
 62         
 63         <global-results>
 64             <!-- 该元素必须出现,可以出现无限多次 -->
 65             <result name="" type="">
 66                 <!-- 该字符串内容可以出现0次或多次 -->
 67                 映射资源
 68                 <!-- 下面元素可以出现0次,也可以无限多次 -->
 69                 <param name="参数名">参数值</param>
 70             </result>
 71         </global-results>
 72         
 73         <!-- 下面元素可以出现0次,也可以无限多次 -->
 74         <global-exception-mappings>
 75             <!-- 该元素必须出现,可以出现无限多次 -->
 76             <exception-mapping result="" exception="" name="">
 77                 异常处理资源
 78                 <!-- 下面元素可以出现0次,也可以无限多次 -->
 79                 <param name="参数名">参数值</param>
 80             </exception-mapping>
 81         </global-exception-mappings>
 82         
 83         <action name="" class="" method="" converter="">
 84             <!-- 下面元素可以出现0次,也可以无限多次 -->
 85             <param name="参数名">参数值</param>
 86             <!-- 下面元素可以出现0次,也可以无限多次 -->
 87             <result name="" type="">
 88                 映射资源
 89                 <!-- 下面元素可以出现0次,也可以无限多次 -->
 90                 <param name="参数名">参数值</param>
 91             </result>
 92             
 93             <interceptor-ref name="">
 94             <!-- 下面元素可以出现0次,也可以无限多次 -->
 95                 <param name="参数名">参数值</param>
 96             </interceptor-ref>
 97             
 98             <!-- 下面元素可以出现0次,也可以无限多次 -->
 99             <exception-mapping result="" exception="" name="">
100                 异常处理资源
101                 <!-- 下面元素可以出现0次,也可以无限多次 -->
102                 <param name="参数名">参数值</param>
103             </exception-mapping>
104         </action>
105     </package>
106 </struts>
posted @ 2009-07-03 23:01 Alex刺客 阅读(614) | 评论 (0)编辑 收藏

  1 ### struts.properties这是一个标准的Properties文件,'='前面字符串是key
  2 ### 每个key就是一个Struts2属性,'='后面对应的value就是一个Struts2属性值
  3 ### struts.properties文件通常放在项目里的WEB-INF/classes路径下。
  4 ### 也可也放在CLASSPATH路径下,Struts2框架就可以加载该文件
  5 ### 以下这些元素同样可以在Struts2的struts.xml中通过constant配置
  6 
  7 ### 指定加载Struts 2配置文件的配置文件管理器
  8 ### 该属性的默认值是org.apache.Struts2.config.DefaultConfiguration,
  9 ### 这是Struts 2默认的配置文件管理器。如果需要实现自己的配置管理器,
 10 ### 开发者则可以实现一个实现Configuration接口的
 11 ### 类,该类可以自己加载Struts 2配置文件。
 12 #struts.configuration = org.apache.struts2.config.DefaultConfiguration
 13 
 14 ### 指定Web应用的默认Locale
 15 #struts.locale=en_US
 16 
 17 ### 指定Web应用的默认编码集。该属性对于处理中文请求参数非常有用,对于获取
 18 ### 中文请求参数值,应该将该属性值设置为GBK或者GB2312
 19 struts.i18n.encoding=UTF-8
 20 
 21 ### 指定Struts 2默认的ObjectFactory Bean
 22 ### 另外,你也可以提供一个com.opensymphony.xwork2.ObjectFactory子类名称
 23 ### 默认指定spring
 24 struts.objectFactory=spring
 25 
 26 ### 指定Spring框架的自动装配模式,该属性的默认值是name,即默认根据Bean的
 27 ### name属性自动装配 。有效值为:name, type, auto, constructor
 28 struts.objectFactory.spring.autoWire = name
 29 
 30 ### 指定整合Spring框架时,是否缓存Bean实例
 31 ### 有效值为:truefalse (默认值是true) 通常不建议修改该属性值。
 32 struts.objectFactory.spring.useClassCache = true
 33 
 34 ### 确保spring的自动装配策略总是被考虑的
 35 ### 有效值为:truefalse (黑认值是false)
 36 struts.objectFactory.spring.autoWire.alwaysRespect = false
 37 
 38 ### struts.objectTypeDeterminer指定Struts2的类型检测机制,通常支持
 39 ### tiger和notiger两个值
 40 # struts.objectTypeDeterminer =tiger
 41 # struts.objectTypeDeterminer = notiger 
 42 
 43 ### 指定处理multipart/form-data的MIME类型(文件上传)请求的框架,该属性
 44 ### 支持cos、pell和jakarta等属性值,即分别对应使用cos的文件上传框架、
 45 ### pell上传及common-fileupload文件上传框架。该属性的默认值为jakarta。
 46 # struts.multipart.parser=cos
 47 # struts.multipart.parser=pell
 48 struts.multipart.parser=jakarta
 49 
 50 ### struts.multipart.saveDir该属性指定上传文件的临时保存路
 51 ### 径,默认值是javax.servlet.context.tempdir
 52 struts.multipart.saveDir=
 53 
 54 ##指定文件上传中整个请求内容允许的最大字节数( 默认2097152)
 55 struts.multipart.maxSize=2097152
 56 
 57 ### 加载自定义属性文件(不会覆盖struts.properties)加载多个以E文逗号隔开
 58 # struts.custom.properties=application,org/apache/struts2/extension/custom
 59 
 60 ### 指定将HTTP请求映射到指定Action的映射器,默认映射器根据请求的前缀与
 61 ### Action的name属性完成映射
 62 #struts.mapper.class=org.apache.struts2.dispatcher.mapper.DefaultActionMapper
 63 
 64 ### 指定需要处理的请求后缀,默认是action,
 65 ### 即所有匹配*.action的请求都由Struts2处理。需要指定多个后缀以E文逗号隔开
 66 struts.action.extension=action,,
 67 
 68 ### 设置是否通过JAR文件提供静态内容服务
 69 struts.serve.static=true
 70 
 71 ### 设置浏览器是否缓存静态容,当应用处于开发阶段时,
 72 ### 我们希望每次请求都获得服务器的最新响应,则可以设置为false
 73 struts.serve.static.browserCache=true
 74 
 75 ### 设置是否支持动态方法调用,如果需要关闭动态方法调用,则可以设置为false
 76 struts.enable.DynamicMethodInvocation = true
 77 
 78 ### 该属性设置是否允许在Action名中使用斜线,默认不使用
 79 struts.enable.SlashesInActionNames = false
 80 
 81 ### 设置是否允许在标签中使用表达语法
 82 struts.tag.altSyntax=true
 83 
 84 ### 设置Struts2应用是否使用开发模式。如果设置该属性为true,
 85 ### 则可以在应用出错时显示更多详细的错误信息
 86 struts.devMode = false
 87 
 88 ### 设置是否每次HTTP请求到达时,系统都重新加载资源文件。在开发阶段设置
 89 ### true更有得于开发 产品发布时为false
 90 struts.i18n.reload=false
 91 
 92 ### 指定视图标签的视图主题
 93 struts.ui.theme=xhtml
 94 
 95 ### 指定视图主题所需要模板文件的位置,默认值为template 即默认加载
 96 ### template路经下的模板文件
 97 struts.ui.templateDir=template
 98 
 99 ### 指定模板文件的后缀,允许使用ftl, vm 或 jsp 
100 ###(分别对应FreeMarker, Velocity, JSP)默认值为ftl
101 struts.ui.templateSuffix=ftl
102 
103 ### 设置当struts.xml文件改变后,系统是否自动重新加载该文件
104 struts.configuration.xml.reload=false
105 
106 ### 指定Velocite框架所需的velocity.properties文件的位置
107 struts.velocity.configfile = velocity.properties
108 
109 ### 指定Velocity框架的Context位置,如果该框架有多个Context,则以E文逗号隔开
110 struts.velocity.contexts =
111 
112 ### 指定Velocity框架的toolbox位置。
113 struts.velocity.toolboxlocation=
114 
115 ### 指定web应用所在的监听端口。通常没有太大的用户,只是当Struts2需要生成
116 ### URL时(例如Url标签)该属性才提供web应用的默认端口
117 struts.url.http.port = 80
118 
119 ### 类似于struts.url.http.port 属性,区别是该属性指定是web应用的加密服务端口
120 struts.url.https.port = 443
121 
122 ### 指定Struts2生成URL时是否包含请求参数。none, get, all 
123 ###(不包含,仅包含GET类型请求参数,包含全部请求参数)
124 struts.url.includeParams = get
125 
126 ### 指定应用所需要的国际化资源文件,多个文件以E文 逗号隔开
127 # struts.custom.i18n.resources=testmessages,testmessages2
128 
129 ### 对于某些JavaEE服务器,不支持HttpServletRequest调用getParameterMap()方法,
130 ### 此时可以设置属性值为true来解决该问题对于 WebLogic, Orion, 和 OC4J 通常应该
131 ### 设置该属性为true
132 struts.dispatcher.parametersWorkaround = false
133 
134 ### 指定Struts 2使用的FreeMarker管理器。该属性的默认
135 ### 值是 org.apache.struts2.views.freemarker.FreemarkerManager,
136 ### 这是Struts 2内建的FreeMarker管理器
137 #struts.freemarker.manager.classname=org.apache.struts2.views.freemarker.FreemarkerManager
138 
139 ### 指定是否启用缓存FreeMarker模板
140 ### 具有相同的效果复制的模板下WEB_APP /模板
141 struts.freemarker.templatesCache=false
142 
143 ### 是否使用缓存模型BeanWrapper
144 struts.freemarker.beanwrapperCache=false
145 
146 ### StrutsBeanWrapper javadocs以获取更多信息
147 struts.freemarker.wrapper.altMap=true
148 
149 ### maxStrongSize for MruCacheStorage for freemarker
150 struts.freemarker.mru.max.strong.size=100
151 
152 ### 指定XSLT Result 是否使用样式表缓存。当应用处于开发阶段时,通常被置为true,当应用处于产品时为false
153 struts.xslt.nocache=false
154 
155 ### 是否总是选择的名称将之前的所有最后的斜线
156 struts.mapper.alwaysSelectFullNamespace=false
157 
158 ### 是否允许静态方法访问OGNL表达式
159 struts.ognl.allowStaticMethodAccess=false
posted @ 2009-07-03 22:59 Alex刺客 阅读(566) | 评论 (0)编辑 收藏

     摘要: struts2.1.6HelloWorld
一、在下载的struts2.1.6-all.zip找到以下包放入项目中WEB-INF/lib/下;

1.commons-fileupload-1.2.1.jar <--文件上传
2.commons-logging-1.0.4.jar <--日志
3.freemarker-2.3.13.jar <--模板引擎
4.ognl-2.6.11.jar <--Object-Graph Navigation Language
5.struts2-core-2.1.6.jar <--struts2核心
6.xwork-2.1.2.jar <--xwork核心
  阅读全文
posted @ 2009-07-01 21:16 Alex刺客 阅读(475) | 评论 (0)编辑 收藏