帮助中心管理系统

来源:互联网 发布:岛国大片搜索软件 编辑:程序博客网 时间:2024/04/29 14:59

转载自sogui http://blog.csdn.net/sogui/archive/2006/09/06/1184532.aspx

一、项目背景

      为实现方便用户使用系统的要求,开发后台帮助中心管理系统,实现帮助系统的动态增加,类似于FAQ系统。

二、系统概述

        本系统架构使用Webwork+Freemarker+Lunene+dom4j.前台搜索使用Lunene-2.0,数据存储使用XML文件存储。实现类似于FAQ系统的快速寻找帮助所需信息。系统可以按类别将问题分类,而且分类可以动态在后台进行添加,可以方便用户进行分类查找,后台同时提供对问题进行增加,删除,编辑操作,提供前台搜索功能的重建索引文件功能

三、系统要求

       开发环境 JDK1.5   Tomcat5.5.9   Jbuilder2006  WindowXP

      第三方类库:dom4j-1.6.1     webwork-2.2.2     log4j-1.2.8   securityFilter2.0   FCKeditor2.3  lucene-2.0.0

四、系统预览

         1、按类别查询,点击类别导航栏的类别,查询该类别的所有问题内容

 

2、按关键字查询,多个关键字以空格分开,对关键字进行加亮显示,如下图所示

3、后台登陆

3、修改密码

4、问题类别管理,全部类别数据以 XML文件Catalog.xml进行数据存储

5、问题列表,按问题类别进行查询,可以对问题进行增加、删除,编辑操作,属于同一类别的问题数据存于一个XML文件,XML文件名由类别管理功能指定,如上“订购方式”-SpeakFor.xml

6、问题编辑,用Fckeditor作编辑器,方便数据录入

7、索引管理,对前台搜索索引文件重建索引,保正搜索数据与XML存储的数据一致性

五、需求分析

帮助中心管理系统分为两部分:

前台部分,主要是提供对问题查询的快速操作,搜索功能的实现采用Lunene2.0进行全文搜索

 后台部分,分为修改个人密码、问题类别管理-》可以对问题进行分类,每一个分类用一个XML文件进行数据存储,即同属一个类别的问题内容存储于同一个XML文件内,用户可以对问题类别名进行修改,但文件名不提供修改功能,因为文件名定下来就不用怎么变动。问题管理,用户可以对问题进行增加、删除、编辑操作,同时具备同步更新索引文件的功能

六、模块分析

七、详细设计

1、HelpConfig.properties
#helpPath is the home directory installed of Help.
#Warning: Don't add '/' at the end
helpPath=F:/NewJProjects/Help/Help
 
#The directory of the lucene default: %Help_home%/index
indexPath=F:/NewJProjects/Help/Help/index
 
#The color of keyword which is specificed by user
keyWordColor=#FF7101
 
2、freemarker.properties
locale=zh_CN
default_encoding=UTF-8
3、log4j.properties
log4j.rootLogger=INFO,stdout
#DEBUG,CONSOLE,FILE,ROLLING_FILE,MAIL,DATABASE,im,HTML,LF5_APPENDER
log4j.addivity.org.apache=true
#level:是日记记录的优先级,优先级由高到低分为 OFF ,FATAL ,ERROR ,WARN ,INFO ,DEBUG ,ALL。
#Log4j建议只使用FATAL ,ERROR ,WARN ,INFO ,DEBUG这四个级别。
 
###################
# stdout
###################
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
 
log4j.logger.com.mxca = DEBUG
###################
#DEBUG
##################
log4j.appender.DEBUG=org.apache.log4j.ConsoleAppender
log4j.appender.DEBUG.layout=org.apache.log4j.PatternLayout
log4j.appender.DEBUG.layout.ConversionPattern=%5p [%t] - %m%n
###################
 
###################
#ERROR
##################
log4j.appender.ERROR=org.apache.log4j.ConsoleAppender
log4j.appender.ERROR.layout=org.apache.log4j.PatternLayout
log4j.appender.ERROR.layout.ConversionPattern=%5p [%t] - %m%n
###################
 
###################
#INFO
##################
log4j.appender.INFO=org.apache.log4j.ConsoleAppender
log4j.appender.INFO.layout=org.apache.log4j.PatternLayout
log4j.appender.INFO.layout.ConversionPattern=%5p [%t] - %m%n
 
4、webwork.properties
### Webwork default properties
###(can be overridden by a webwork.properties file in the root of the classpath)
###
 
### Specifies the Configuration used to configure webwork
### one could extend com.opensymphony.webwork.config.Configuration
### to build one's customize way of getting the configurations parameters into webwork
# webwork.configuration=com.opensymphony.webwork.config.DefaultConfiguration
 
### This can be used to set your default locale and encoding scheme
webwork.locale=zh_CN
webwork.i18n.encoding=UTF-8
 
### if specified, the default object factory can be overridden here
### Note: short-hand notation is supported in some cases, such as "spring"
###       Alternatively, you can provide a com.opensymphony.xwork.ObjectFactory subclass name here
webwork.objectFactory = spring
 
### specifies the autoWiring logic when using the SpringObjectFactory.
### valid values are: name, type, auto, and constructor (name is the default)
webwork.objectFactory.spring.autoWire = name
 
### if specified, the default object type determiner can be overridden here
### Note: short-hand notation is supported in some cases, such as "tiger" or "notiger"
###       Alternatively, you can provide a com.opensymphony.xwork.util.ObjectTypeDeterminer implementation name here
### Note: if you have the xwork-tiger.jar within your classpath, GenericsObjectTypeDeterminer is used by default
###       To disable tiger support use the "notiger" property value here.
#webwork.objectTypeDeterminer = tiger
#webwork.objectTypeDeterminer = notiger
 
### Parser to handle HTTP POST requests, encoded using the MIME-type multipart/form-data
# webwork.multipart.parser=cos
# webwork.multipart.parser=pell
webwork.multipart.parser=jakarta
# uses javax.servlet.context.tempdir by default
#webwork.multipart.saveDir=F://FilesUpload
webwork.multipart.maxSize=2097152
 
### Load custom property files (does not override webwork.properties!)
# webwork.custom.properties=application,com/webwork/extension/custom
 
### How request URLs are mapped to and from actions
webwork.mapper.class=com.opensymphony.webwork.dispatcher.mapper.DefaultActionMapper
 
### Used by the DefaultActionMapper
webwork.action.extension=jspx
 
### use alternative syntax that requires %{} in most places
### to evaluate expressions for String attributes for tags
webwork.tag.altSyntax=true
 
### when set to true, WebWork will act much more friendly for developers. This
### includes:
### - webwork.i18n.reload = true
### - webwork.configuration.xml.reload = true
### - raising various debug or ignorable problems to errors
###   For example: normally a request to foo.action?someUnknownField=true should
###                be ignored (given that any value can come from the web and it
###                should not be trusted). However, during development, it may be
###                useful to know when these errors are happening and be told of
###                them right away.
webwork.devMode = false
 
### when set to true, resource bundles will be reloaded on _every_ request.
### this is good during development, but should never be used in production
webwork.i18n.reload=true
 
### Standard UI theme
### Change this to reflect which path should be used for JSP control tag templates by default
webwork.ui.theme=xhtml
webwork.ui.templateDir=template
#sets the default template type. Either ftl, vm, or jsp
webwork.ui.templateSuffix=ftl
 
### Configuration reloading
### This will cause the configuration to reload xwork.xml when it is changed
webwork.configuration.xml.reload=true
 
### Location of velocity.properties file. defaults to velocity.properties
# webwork.velocity.configfile = velocity.properties
 
### Comma separated list of VelocityContext classnames to chain to the WebWorkVelocityContext
# webwork.velocity.contexts =
 
### used to build URLs, such as the UrlTag
webwork.url.http.port = 80
webwork.url.https.port = 443
 
### Load custom default resource bundles
webwork.custom.i18n.resources=ApplicationResources_en,ApplicationResources_zh_CN
 
### workaround for some app servers that don't handle HttpServletRequest.getParameterMap()
### often used for WebLogic, Orion, and OC4J
webwork.dispatcher.parametersWorkaround = false
 
### configure the Freemarker Manager class to be used
### Allows user to plug-in customised Freemarker Manager if necessary
### MUST extends off com.opensymphony.webwork.views.freemarker.FreemarkerManager
#webwork.freemarker.manager.classname=com.opensymphony.webwork.views.freemarker.FreemarkerManager
 
### See the WebWorkBeanWrapper javadocs for more information
webwork.freemarker.wrapper.altMap=true
 
5、ApplicationResources.properties    ApplicationResources_zh_CN.properties
html.common.title.operate=操作
html.common.title.delete=删除
html.common.title.edit=编辑
html.common.title.save=保存
html.common.title.search=查询
html.common.title.catalog=问题类别
html.common.title.add=增加
html.common.title.question.title=问题主题
html.common.title.question.content=内容
html.common.title.return=返回
html.common.title.delete.confirm=你确定删除此条记录吗?
 
 
 
html.Login.msg.not.input.username=请输入用户名
html.Login.msg.not.input.password=请输入密码
html.Login.title.username=用户名
html.Login.title.passowrd=密 码
html.Login.title.submit=登陆
html.Login.title.system=系统登陆
 
html.Top.help.title.manager=管理
html.Top.help.title.help.search=帮助搜索
html.Menu.admin.title.menu=系统菜单
html.Menu.admin.item.user.manager=修改密码
html.Menu.admin.item.catalog.manager=类别管理
html.Menu.admin.item.index.manager=搜索管理
html.Menu.admin.item.question.manager=问题管理
html.Top.admin.title.current.user=当前用户
html.Top.admin.title.logout=退出
html.Main.title.help.center=帮助中心后台管理系统
html.Help.title=帮助中心
html.Help.title.search.tip=请输入关键字,多个关键字之间使用空格分隔
html.ChangePwd.title=修改密码
html.ChangePwd.title.username=用户名
html.ChangePwd.title.old.password=旧密码
html.ChangePwd.title.new.password=新密码
html.ChangePwd.title.new.passowrd.again=重 复
html.ChangePwd.title.change=修改
html.ChangePwd.error.new.and.old.password.not.the.same=旧密码和新密码不一致
html.ChangePwd.msg.pls.input.old.password=请输入旧密码
html.ChangePwd.msg.pls.input.new.password=请输入新密码
html.ChangePwd.msg.pls.input.new.password.again=请再次输入新密码
html.Catalog.title=类别管理
html.Catalog.title.catalog.id=类别ID
 
html.Catalog.title.question.file.name=文件名称
html.Catalog.title.list=类别列表
html.Catalog.title.add=增加类别
html.Catalog.msg.pls.input.catalog.name=请输入类别名称
html.Catalog.msg.pls.input.catalog.src=请输入文件名称
html.Catalog.msg.input.catalog.src.error=你输入的文件名后缀有误,文件后缀必须是.xml
html.Catalog.msg.delete.confirm=你确定删除该类别吗?
html.Question.title=问题管理
html.Question.title.list=问题列表
html.Question.title.quesion.id=问题ID
html.Question.title.not.set.catalog=你还没有设置问题类别,请在[类别管理]增加类别
html.Question.title.reply.status=回复状态
html.Question.title.reply.status.pls.select=请选择
html.Question.title.reply.status.has.replied=已回复
html.Question.title.reply.status.has.not.replied=未回复
html.QuestionAdd.title=增加问题
html.QuestionAdd.msg.pls.input.subject=请输入问题主题
html.QuestionUpdate.title=编辑问题
html.Help.not.input.keyword=请输入搜索关键字!
html.IndexFileList.title=索引文件列表
html.IndexFileList.title.file.name=文件名
html.IndexFileList.title.file.size=大小
html.IndexFileList.title.file.modify.date=创建时间
html.IndexFileList.reindex=重做索引
 
msg.help.change.password=密码更改成功
msg.help.delete.catalog.success=删除类别成功
msg.help.update.catalog.success=更新类别成功
msg.help.add.catalog.success=增加类别成功
msg.help.list.question.not.result=没有符合条件的记录
msg.help.add.question.success=增加问题成功
msg.help.update.question.success=更新问题成功
msg.help.delete.question.success=删除问题成功
msg.help.add.question.index.success=增加索引成功
msg.help.update.question.index.success=更新索引成功
msg.help.delete.question.index.success=删除索引成功
msg.help.search.by.keyword=查询结果导航
msg.help.search.by.keyword.no.result=没有匹配关键字[{0}]帮助记录,请重新输入其它关键字进行搜索!
msg.help.search.by.catalog.no.result=问题类别 [{0}] 没有任何记录!
msg.help.delete.index.file.success=索引文件名: [{0}] 大小:[{1}] 删除成功!
 
 
 
error.help.change.password=密码更改失败
error.help.login.userId.or.password.not.right=用户或密码不正确,请重新输入!
error.help.delete.catalog.fail=删除类别失败
error.help.update.catalog.fail=更新类别失败
error.help.add.catalog.fail=增加类别失败
error.help.add.question.fail=增加问题失败
error.help.update.question.fail=更新问题失败
error.help.delete.question.fail=删除问题失败
error.help.add.question.index.fail=删除索引失败
error.help.update.question.index.fail=更新索引失败
error.help.delete.question.index.fail=删除索引失败
msg.help.delete.index.file.fail=索引文件名: [{0}] 大小:[{1}] 删除失败!
 
6、xwork.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.1.1//EN" "http://www.opensymphony.com/xwork/xwork-1.1.1.dtd">
<xwork>
<include file="webwork-default.xml"/>
 
<package name="default" extends="webwork-default">
 
   <action name="help" class="com.mxca.shop4i.Help.action.BaseAction" method="doDefault">
      <result name="success" type="freemarker">
        <param name="location">/templates/help/Help.html</param>
      </result>
    </action>
 
    <action name="search" class="com.mxca.shop4i.Help.action.help.HelpAction" method="doSearch">
      <result name="success" type="freemarker">
        <param name="location">/templates/help/Help.html</param>
      </result>
       <interceptor-ref name="params"/>
    </action>
 
    <action name="login" class="com.mxca.shop4i.Help.action.BaseAction" method="doLogin">
     <result name="success" type="freemarker">
       <param name="location">/templates/admin/Login.html</param>
      </result>
    </action>
 
    <action name="logError" class="com.mxca.shop4i.Help.action.BaseAction" method="doLogError">
     <result name="error" type="freemarker">
       <param name="location">/templates/admin/Login.html</param>
      </result>
    </action>
 
    <action name="logout" class="com.mxca.shop4i.Help.action.BaseAction" method="doLogout">
       <result name="success" type="chain">
         <param name="actionName">help</param>
       </result>
    </action>
 
</package>
 
<package name="Admin" extends="default" namespace="/Admin">
 
    <action name="main" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doDefault">
     <result name="success" type="freemarker">
       <param name="location">/templates/admin/Main.html</param>
     </result>
      <interceptor-ref name="params"/>
    </action>
 
<action name="top" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doDefault">
     <result name="success" type="freemarker">
       <param name="location">/templates/admin/Top.html</param>
     </result>
    </action>
 
    <action name="menu" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doDefault">
     <result name="success" type="freemarker">
       <param name="location">/templates/admin/Menu.html</param>
     </result>
    </action>
 
    <action name="logSuccess" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doDefault">
      <result name="success" type="freemarker">
        <param name="location">/templates/admin/LogSuccess.html</param>
      </result>
    </action>
 
    <action name="changePwdInput" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doChangePwdInput">
      <result name="input" type="freemarker">
        <param name="location">/templates/admin/ChangePwd.html</param>
      </result>
      <interceptor-ref name="params"/>
    </action>
 
    <action name="changePwd" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doChangePwd">
      <result name="success" type="freemarker">
         <param name="location">/templates/admin/ChangePwd.html</param>
       </result>
       <interceptor-ref name="params"/>
    </action>
 
    <action name="catalogList" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doCatalogList">
      <result name="success" type="freemarker">
         <param name="location">/templates/admin/Catalog.html</param>
       </result>
       <interceptor-ref name="params"/>
    </action>
 
    <action name="delCatalog" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doDelCatalog">
      <result name="success" type="freemarker">
      <!--
       <param name="actionName">catalogList</param>
      -->
         <param name="location">/templates/admin/Catalog.html</param>
 
       </result>
       <interceptor-ref name="params"/>
    </action>
 
    <action name="updateCatalog" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doUpdateCatalog">
      <result name="success" type="freemarker">
      <!--
       <param name="actionName">catalogList</param>
       -->
         <param name="location">/templates/admin/Catalog.html</param>
 
       </result>
       <interceptor-ref name="params"/>
    </action>
 
    <action name="addCatalog" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doAddCatalog">
      <result name="success" type="freemarker">
      <!--
       <param name="actionName">catalogList</param>
      -->
         <param name="location">/templates/admin/Catalog.html</param>
       </result>
       <interceptor-ref name="params"/>
    </action>
 
    <action name="questionListInput" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doInput">
      <result name="input" type="freemarker">
        <param name="location">/templates/admin/Question.html</param>
      </result>
    </action>
 
    <action name="questionList" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doQuestionList">
      <result name="success" type="freemarker">
        <param name="location">/templates/admin/Question.html</param>
      </result>
       <interceptor-ref name="params"/>
       <interceptor-ref name="servlet-config"/>
    </action>
 
    <action name="questionAddInput" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doInput">
      <result name="input" type="freemarker">
        <param name="location">/templates/admin/QuestionAdd.html</param>
      </result>
      <interceptor-ref name="params"/>
    </action>
 
    <action name="questionAdd" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doQuestionAdd">
      <result name="success" type="freemarker">
        <param name="location">/templates/admin/QuestionAdd.html</param>
      </result>
       <interceptor-ref name="params"/>
    </action>
 
    <action name="questionEditInput" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doQuestionEditInput">
      <result name="input" type="freemarker">
        <param name="location">/templates/admin/QuestionEdit.html</param>
      </result>
      <interceptor-ref name="params"/>
    </action>
 
    <action name="questionEdit" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doQuestionEdit">
      <result name="success" type="chain">
        <param name="actionName">questionEditInput</param>
      </result>
      <interceptor-ref name="params"/>
    </action>
 
    <action name="questionDelete" class="com.mxca.shop4i.Help.action.admin.AdminAction" method="doDeleteQuestion">
      <result name="success" type="freemarker">
        <param name="location">/templates/admin/Question.html</param>
      </result>
      <interceptor-ref name="params"/>
    </action>
 
    <action name="indexList" class="com.mxca.shop4i.Help.action.admin.IndexAction" method="doIndexList">
      <result name="success" type="freemarker">
        <param name="location">/templates/admin/IndexFileList.html</param>
      </result>
      <interceptor-ref name="params"/>
    </action>
 
    <action name="reIndex" class="com.mxca.shop4i.Help.action.admin.IndexAction" method="doReIndex">
      <result name="success" type="freemarker">
        <param name="location">/templates/admin/IndexFileList.html</param>
      </result>
      <interceptor-ref name="params"/>
    </action>
 
</package>
 
</xwork>
 
7、web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
 <display-name>Help</display-name>
 <filter>
    <filter-name>Security Filter</filter-name>
    <filter-class>org.securityfilter.filter.SecurityFilter</filter-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/securityfilter-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>validate</param-name>
      <param-value>true</param-value>
    </init-param>
 </filter>
 <filter-mapping>
    <filter-name>Security Filter</filter-name>
    <url-pattern>/*</url-pattern>
 </filter-mapping>
 <filter>
    <filter-name>webwork</filter-name>
    <filter-class>com.opensymphony.webwork.dispatcher.FilterDispatcher</filter-class>
 </filter>
 <filter-mapping>
    <filter-name>webwork</filter-name>
    <url-pattern>/*</url-pattern>
 </filter-mapping>
 <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
 </listener>
 <servlet>
    <servlet-name>JspSupportServlet</servlet-name>
    <servlet-class>com.opensymphony.webwork.views.JspSupportServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
 </servlet>
 <servlet>
    <description>FCKEditor</description>
    <servlet-name>Connector</servlet-name>
    <servlet-class>com.fredck.FCKeditor.connector.ConnectorServlet</servlet-class>
    <init-param>
      <param-name>baseDir</param-name>
      <param-value>/UserFiles/</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>true</param-value>
   </init-param>
    <load-on-startup>1</load-on-startup>
 </servlet>
 <servlet-mapping>
    <servlet-name>Connector</servlet-name>
    <url-pattern>/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern>
 </servlet-mapping>
 <servlet>
    <description>FCKEditor</description>
    <servlet-name>SimpleUploader</servlet-name>
    <servlet-class>com.fredck.FCKeditor.uploader.SimpleUploaderServlet</servlet-class>
    <init-param>
      <param-name>baseDir</param-name>
      <param-value>/UserFiles/</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>
      <param-name>enabled</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>
      <param-name>AllowedExtensionsFile</param-name>
      <param-value />
    </init-param>
    <init-param>
      <param-name>DeniedExtensionsFile</param-name>
      <param-value>php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi</param-value>
    </init-param>
    <init-param>
      <param-name>AllowedExtensionsImage</param-name>
      <param-value>jpg|gif|jpeg|png|bmp</param-value>
    </init-param>
    <init-param>
      <param-name>DeniedExtensionsImage</param-name>
      <param-value />
    </init-param>
    <init-param>
      <param-name>AllowedExtensionsFlash</param-name>
      <param-value>swf|fla</param-value>
    </init-param>
    <init-param>
      <param-name>DeniedExtensionsFlash</param-name>
      <param-value />
    </init-param>
    <load-on-startup>1</load-on-startup>
 </servlet>
 <servlet-mapping>
    <servlet-name>SimpleUploader</servlet-name>
    <url-pattern>/FCKeditor/editor/filemanager/upload/simpleuploader</url-pattern>
 </servlet-mapping>
 <jsp-config>
    <taglib>
      <taglib-uri>WebWork</taglib-uri>
      <taglib-location>/WEB-INF/webwork.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
      <taglib-location>/WEB-INF/c.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>http://fckeditor.net/tags-fckeditor</taglib-uri>
      <taglib-location>/WEB-INF/FCKeditor.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>Page</taglib-uri>
      <taglib-location>/WEB-INF/page.tld</taglib-location>
    </taglib>
 </jsp-config>
</web-app>
 
8、securityfilter-config.xml
 
<?xml version="1.0" encoding="UTF-8"?>
 
<!DOCTYPE securityfilter-config PUBLIC
    "-//SecurityFilter.org//DTD Security Filter Configuration 2.0//EN"
    "http://www.securityfilter.org/dtd/securityfilter-config_2_0.dtd">
    <securityfilter-config>
 
   <security-constraint>
      <web-resource-collection>
         <web-resource-name>Secure Page</web-resource-name>
         <url-pattern>*/Admin/*</url-pattern>
      </web-resource-collection>
      <auth-constraint>
         <role-name>Admin</role-name>
      </auth-constraint>
   </security-constraint>
 
     <login-config>
      <auth-method>FORM</auth-method>
      <form-login-config>
         <form-login-page>/login.jspx</form-login-page>
         <form-error-page>/LogError.jsp</form-error-page>
         <form-default-page>/Admin/main.jspx</form-default-page>
         <form-logout-page>/logout.jspx</form-logout-page>
      </form-login-config>
    </login-config>
    <realm className="com.mxca.shop4i.Help.security.HelpSecurityRealm" />
 </securityfilter-config>
 
9、HelpConfig.java
package com.mxca.shop4i.Help.util;
 
import java.util.Properties;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
import java.io.*;
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class HelpConfig {
 private static final Log log = LogFactory.getLog(HelpConfig.class);
 private static final String CONFIG_FILE = "HelpConfig.properties";
 private static final String HELP_PATH_KEY = "helpPath";
 private static final String INDEX_PATH="indexPath";
 private static final String KEYWORD_COLOR_KEY="keyWordColor";
 private static HelpConfig helpConfig;
 private Properties properties;
 private HelpConfig() {
    init();
 }
 
 public synchronized static HelpConfig getInstance() {
    if(helpConfig==null){
      helpConfig= new HelpConfig();
    }
    return helpConfig;
 }
 
 private void init() {
    try {
      properties = Resources.getResourceAsProperties(CONFIG_FILE);
      if (log.isDebugEnabled()) {
        log.debug(
            CONFIG_FILE + " is loaded successfully.");
      }
    }
    catch (IOException ex) {
      log.error(ex.toString());
    }
 }
 
 public String getHelpPath() {
    return properties.getProperty(this.HELP_PATH_KEY, "");
 }
 
 public String getIndexPath(){
    return properties.getProperty(this.INDEX_PATH,"/index");
 }
 public String getKeyWordColor(){
    return properties.getProperty(this.KEYWORD_COLOR_KEY,"RED");
 }
 public static void main(String[] args){
    System.out.println(HelpConfig.getInstance().getHelpPath());
 }
}
 
 
 
10、MD5Coding.java
package com.mxca.shop4i.Help.util;
 
import java.security.MessageDigest;
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class MD5Coding {
    public MD5Coding() {
    }
 
    public final static String encode(String s) {
        char hexDigits[] = {
                           '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
                           'a', 'b', 'c', 'd',
                           'e', 'f'};
        try {
            byte[] strTemp = s.getBytes();
            MessageDigest mdTemp = MessageDigest.getInstance("MD5");
            mdTemp.update(strTemp);
            byte[] md = mdTemp.digest();
            int j = md.length;
            char str[] = new char[j * 2];
            int k = 0;
            for (int i = 0; i < j; i++) {
                byte byte0 = md[i];
                str[k++] = hexDigits[byte0 >>> 4 & 0xf];
                str[k++] = hexDigits[byte0 & 0xf];
            }
            return new String(str);
        } catch (Exception e) {
            return null;
        }
 
    }
}
 
11、RandomGID.java
package com.mxca.shop4i.Help.util;
 
import java.util.Date;
import java.util.Random;
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class RandomGID {
    public RandomGID() {
    }
 
    private final static int intMax = 24;
    private static char[] ch = {'A', 'B', 'C', 'E', 'F', 'K', 'M', 'P', 'Q',
                               'R', 'T', 'U', 'W', 'Z', '1', '2', '3', '4', '5',
                               '6', '7', '8', '9', '0'};
    private static long seed = (new Date()).getTime();
 
    private static long tm = System.currentTimeMillis();
    private static Random random = new java.util.Random();
 
   private static int getNum(char schar) {
        switch (schar) {
        case 'A':
            return 1;
        case 'B':
            return 2;
        case 'C':
            return 3;
        case 'D':
            return 4;
        case 'E':
            return 5;
        case 'F':
            return 6;
        case 'K':
            return 7;
        case 'M':
            return 8;
        case 'P':
            return 9;
        case 'Q':
            return 0;
        case 'R':
            return 10;
        case 'T':
            return 11;
        case 'U':
            return 12;
        case 'W':
            return 13;
        case 'Z':
            return 14;
        case '1':
            return 15;
        case '2':
            return 16;
        case '3':
            return 17;
        case '4':
            return 18;
        case '5':
            return 19;
        case '6':
            return 20;
        case '7':
            return 21;
        case '8':
            return 22;
        case '9':
            return 23;
        case '0':
            return 24;
        default:
            return 1;
        }
    }
 
//得到前N-1位随机数
    private static String getRanstr(int intLength) {
        Random rd = new Random();
        rd.setSeed(++seed);
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < intLength; i++) {
            if (i == 0) {
                sb.append(ch[rd.nextInt(14)]);
            } else {
                sb.append(ch[rd.nextInt(intMax)]);
            }
        }
        return sb.toString();
    }
 
//得到最后一位数
    private static String getLast(String strs) {
        int sum = 0;
        for (int i = 0; i < strs.length(); i++) {
            int nums = getNum(strs.charAt(i));
            sum += nums * i;
        }
        int k = sum % 11;
        if (k == 0) {
            return String.valueOf(0);
        }
        if (k == 10) {
            return String.valueOf('X');
        }
        return String.valueOf(k);
    }
 
    //校验最后一位
    private static boolean isLast(String str) {
        String lastc = str.substring(str.length() - 1);
        String strs = str.substring(0, str.length() - 1);
        String lc = getLast(strs);
        if (lastc.equals(lc)) {
            return true;
        }
        return false;
    }
 
    //校验正确性
    public static boolean checkOut(String str) {
        /*if(str.length()!=18){
                return false;
                         }*/
        return isLast(str);
    }
 
 
//取得随机数
    public static String get18() {
        String strg = getRanstr(17);
        strg = strg.concat(getLast(strg));
        return strg;
    }
 
//取得随机数
    public static String get15() {
        String strg = getRanstr(14);
        strg = strg.concat(getLast(strg));
        return strg;
    }
 
//取得随机数
    public static String get12() {
        String strg = getRanstr(11);
        strg = strg.concat(getLast(strg));
        return strg;
    }
 
//取得随机数
    public static String get10() {
        String strg = getRanstr(9);
        strg = strg.concat(getLast(strg));
        return strg;
    }
 
//取得随机数
    public static String get7() {
        String strg = getRanstr(6);
        strg = strg.concat(getLast(strg));
        return strg;
    }
 
    //取得随机数(纯数字)
    public synchronized static String getRam() {
        StringBuffer result = new StringBuffer();
        result.append(++tm);
        //for (int i = 0; i < 5; i++) {
        //    result.append(random.nextInt(10));
        //}
        return result.toString();
    }
 
}
 
12、BaseXML.java
package com.mxca.shop4i.Help.xml;
 
import com.mxca.shop4i.Help.util.*;
import org.dom4j.*;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
import org.dom4j.io.*;
import java.io.*;
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class BaseXML {
 private static final Log log = LogFactory.getLog(BaseXML.class);
 public static final String RESOURCE_PATH =HelpConfig.getInstance().getHelpPath()+"/resources";
  //public static final String RESOURCE_PATH ="resources";
 protected static final String CATALOG_KEY = "catalog";
 protected static final String ID_KEY = "id";
 protected static final String TITLE_KEY = "title";
 protected static final String SRC_KEY = "src";
 protected static final String CATALOG_FILE = "Catalog.xml";
 protected static final String QUESTION_KEY = "question";
 protected static final String SUBJECT_KEY = "subject";
 protected static final String ANSWER_KEY = "answer";
 protected static final String IS_ANSWERED_KEY="isAnswered";
 protected static final String HELP_KEY="Help";
 protected static final String USER_FILE="User.xml";
 protected static final String USER_KEY="user";
 protected static final String PASSWORD_KEY="password";
 private static final long DELETE_THREAD_SLEEP = 500;
 private static final int DELETE_COUNT = 60;
 public BaseXML() {
 }
 
 public synchronized Document parseXML(String xmlFile) {
     Document document=null;
    try {
      SAXReader reader = new SAXReader();
      File file=new File(RESOURCE_PATH);
      if(!file.exists()){
        log.warn("The directory of "+RESOURCE_PATH +" do not exists ,so create folders");
        file.mkdirs();
      }
      file=new File(file,xmlFile);
      if(!file.exists()){
        try {
          document = DocumentHelper.createDocument();
          document.addElement(HELP_KEY);
          saveToFile(document,xmlFile);
          log.warn(xmlFile +" do not exists ,created it");
        }catch (Exception ex1) {
          log.error(ex1.toString());
        }
      }else{
        document = reader.read(file);
        if(log.isDebugEnabled()){
          log.debug(" Read file "+xmlFile+" in directory :"+RESOURCE_PATH);
        }
      }
      if(document!=null){
        document.normalize();
      }
    }
    catch (DocumentException ex) {
      log.error(ex.toString());
    }finally{
       return document;
    }
 }
 
 public synchronized void saveToFile(Document document, String xmlFile) {
    OutputFormat format = OutputFormat.createPrettyPrint();
    format.setEncoding("UTF-8");
    try {
      // XMLWriter xmlWriter = new XMLWriter(new FileWriter(Resources.
      //   getResourceAsFile(RESOURCE_PATH + "/" + xmlFile)),format);
      //XMLWriter xmlWriter = new XMLWriter(new FileOutputStream(Resources.
      //    getResourceAsFile(RESOURCE_PATH + "/" + xmlFile)));
     // XMLWriter xmlWriter = new XMLWriter(new FileWriter(RESOURCE_PATH + "/" + xmlFile));
      //XMLWriter xmlWriter = new XMLWriter(new DataOutputStream(new
     //FileOutputStream(RESOURCE_PATH + "/" + xmlFile)), format);
      XMLWriter xmlWriter =new XMLWriter(new FileOutputStream(RESOURCE_PATH + File.separator + xmlFile),format);
      //XMLWriter xmlWriter = new XMLWriter(new DataOutputStream(new FileOutputStream(Resources.getResourceAsFile(RESOURCE_PATH + "/" + xmlFile))),format);
      xmlWriter.write(document);
      xmlWriter.close();
      if(log.isDebugEnabled()){
        log.debug(xmlFile + " is saved successfully in directory :"+RESOURCE_PATH);
      }
    }
    catch (IOException ex) {
      ex.printStackTrace();
      log.error(ex.toString());
    }
 }
 
 protected boolean deleteFile(String xmlFile){
    if(xmlFile==null||xmlFile.length()<=0){
      return true;
    }
    File file=new File(RESOURCE_PATH+File.separator+xmlFile);
    if(!file.exists()){
      return true;
    }
    return deleteFile(file);
 }
 
 private boolean deleteFile(File file) {
       boolean isSuccess = false;
       int count = DELETE_COUNT;
       try {
           while (file.exists() && !file.delete() && count != 0) {
               count--;
               try {
                   Thread.sleep(DELETE_THREAD_SLEEP);
               } catch (InterruptedException ignore) {
               }
           }
       } catch (Exception ex) {
       }
       if (file.exists() && count == 0) {
           log.error("Unable to delete '" + file + "' . " +
                     DELETE_COUNT + " attempts at " + DELETE_THREAD_SLEEP +
                     " milliseconds intervals.");
       } else {
           isSuccess = true;
       }
       return isSuccess;
   }
 
}
 
13、CatalogXML.java
package com.mxca.shop4i.Help.xml;
 
import java.util.*;
import com.mxca.shop4i.Help.module.*;
import org.dom4j.*;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
 
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class CatalogXML
    extends BaseXML {
 private static final Log log = LogFactory.getLog(CatalogXML.class);
 //private static Map<String, Catalog> catalogMap = new HashMap<String, Catalog> ();
 private List<Catalog> catalogList = new ArrayList<Catalog> ();
 private static CatalogXML catalogXML;
 private CatalogXML() {
    init();
 }
 
 public synchronized static CatalogXML getInstance() {
    if(catalogXML==null){
      catalogXML= new CatalogXML();
    }
    return catalogXML;
 }
 
 private void init() {
    Document document = parseXML(CATALOG_FILE);
    Element root = document.getRootElement();
    for (Iterator it = root.elementIterator(this.CATALOG_KEY); it.hasNext(); ) {
      Element element = (Element) it.next();
      Catalog catalog = new Catalog();
      catalog.setId(element.attributeValue(this.ID_KEY));
      catalog.setTitle(element.elementTextTrim(this.TITLE_KEY));
      catalog.setSrc(element.elementTextTrim(this.SRC_KEY));
      //catalogMap.put(catalog.getId(), catalog);
      catalogList.add(catalog);
    }
 }
 
 public synchronized void reset() {
    //catalogMap=new HashMap<String,Catalog>();
    catalogList = new ArrayList<Catalog> ();
    init();
 }
 
 private int quickSearch(List<Element> elements, int first, int size,
      long target) {
    int middle;
    if (size <= 0) {//start if
      return -1;
    }else {
      middle = first + size/2;
      long id=Long.parseLong(elements.get(middle).attributeValue(this.ID_KEY));
      if (target == id) {//start if1
        return middle;
      }
      else if (target < id) {
        return quickSearch(elements, first, size / 2, target);
      }
      else {
        return quickSearch(elements, middle + 1, (size - 1) / 2, target);
      }//end if1
    }//end if
 }
 
 public synchronized List<Catalog> getCatalogList() {
   // return new ArrayList(catalogMap.values());
    return catalogList;
 }
 
 public synchronized Catalog getCatalogById(String catalogId) {
    for(Catalog catalog : catalogList){
      if(catalogId.equals(catalog.getId())){
        return catalog;
      }
    }
    //return catalogList.get(catalogId);
    return null;
 }
 
 public boolean addCatalog(String catalogName, String catalogSrc) {
    boolean isSuccess = false;
    try {
      Document document = parseXML(CATALOG_FILE);
      Element root = document.getRootElement();
 
      int size = root.elements(this.CATALOG_KEY).size();
      String id = null;
      if (size > 0) {//start if
        //last element
        Element last = (Element) (root.elements(this.CATALOG_KEY).get(size - 1));
        id = last.attributeValue(this.ID_KEY);
        id = String.valueOf(Integer.parseInt(id) + 1);
      }
      else {
        //not element
        id = "0";
      }//end if
      Element subElement = root.addElement(this.CATALOG_KEY)
          .addAttribute(this.ID_KEY, id);
      subElement.addElement(this.TITLE_KEY).addCDATA(catalogName);
      subElement.addElement(this.SRC_KEY).addCDATA(catalogSrc);
      this.saveToFile(document, this.CATALOG_FILE);
      //create sub resource file
      document = DocumentHelper.createDocument();
      document.addElement(HELP_KEY);
      this.saveToFile(document,catalogSrc);
      isSuccess = true;
    }catch (NumberFormatException ex) {
      log.error(ex.toString());
    }finally {
      if(isSuccess){this.reset();}
      return isSuccess;
    }
 }
 
 public boolean deleteCatalog(String catalogId) {
    boolean isSuccess = false;
    try {
      Document document = parseXML(this.CATALOG_FILE);
      if (document != null) { //start if1
        Element root = document.getRootElement();
        List<Element> elements = root.elements(this.CATALOG_KEY);
        int index = quickSearch(elements, 0, elements.size(),
                                Long.parseLong(catalogId));
        if (index != -1) { //start if
          Element catalogElement=elements.get(index);
          if(this.deleteFile(catalogElement.elementTextTrim(this.SRC_KEY))){
            root.remove(catalogElement);
            this.saveToFile(document, this.CATALOG_FILE);
            isSuccess = true;
          }
        } //end if
      } //end if1
    }
    catch (Exception ex) {
      log.error(ex.toString());
    }
    finally {
      if(isSuccess){
        this.reset();
      }
      return isSuccess;
    }
 
 }
 /**
   *
   * @param catalogId String
  * @param catalogName String
   * @return boolean
   */
 public boolean updateCatalog(String catalogId, String catalogName) {
    boolean isSuccess=false;
    try {
      Document document = parseXML(this.CATALOG_FILE);
      if (document != null) {//start if
        Element root = document.getRootElement();
        List<Element> elements = root.elements(this.CATALOG_KEY);
        int index = quickSearch(elements, 0, elements.size(),
                                     Long.parseLong(catalogId));
        if (index != -1) {//start if1
          Element element = elements.get(index);
          Element subElement = element.element(this.TITLE_KEY);
          element.remove(subElement);
          element.addElement(this.TITLE_KEY)
                 .addCDATA(catalogName);
          this.saveToFile(document, this.CATALOG_FILE);
          isSuccess = true;
        }//end if1
      }//end if
    }
    catch (NumberFormatException ex) {
      ex.printStackTrace();
      log.error(ex.toString());
    }finally{
      if(isSuccess){
        this.reset();
      }
      return isSuccess;
    }
 }
 
 private String getHelpAQFileName(String catalogId) {
    return getCatalogById(catalogId).getSrc();
 }
 
 public List<HelpAQ> getHelpAQList(String catalogId) {
    List<HelpAQ>
        helpAQList = new ArrayList<HelpAQ> ();
    Document document = parseXML(getHelpAQFileName(catalogId));
    Element root = document.getRootElement();
    for (Iterator it = root.elementIterator(this.QUESTION_KEY); it.hasNext(); ) {
     Element element = (Element) it.next();
     HelpAQ helpAQ = new HelpAQ();
     helpAQ.setId(element.attributeValue(this.ID_KEY));
     helpAQ.setIsAnswered(element.elementTextTrim(this.IS_ANSWERED_KEY));
     helpAQ.setSubject(element.elementTextTrim(this.SUBJECT_KEY));
     helpAQ.setAnswer(element.elementTextTrim(this.ANSWER_KEY));
     helpAQList.add(helpAQ);
   }
    return helpAQList;
 }
 
 public List<HelpAQ> getHelpAQList(String catalogId,String replyStatus){
    List<HelpAQ>
        helpAQList = new ArrayList<HelpAQ> ();
    Document document = parseXML(getHelpAQFileName(catalogId));
    Element root = document.getRootElement();
   for (Iterator it = root.elementIterator(this.QUESTION_KEY); it.hasNext(); ) {
    Element element = (Element) it.next();
    if(replyStatus.equals(element.elementTextTrim(this.IS_ANSWERED_KEY))){
      HelpAQ helpAQ = new HelpAQ();
      helpAQ.setId(element.attributeValue(this.ID_KEY));
      helpAQ.setIsAnswered(element.elementTextTrim(this.IS_ANSWERED_KEY));
      helpAQ.setSubject(element.elementTextTrim(this.SUBJECT_KEY));
      helpAQ.setAnswer(element.elementTextTrim(this.ANSWER_KEY));
      helpAQList.add(helpAQ);
    }
 }
    return helpAQList;
 }
 public Map<String, HelpAQ> getHelpAQMap(String catalogId) {
    Map<String, HelpAQ> map = new HashMap<String, HelpAQ> ();
    Document document = parseXML(getHelpAQFileName(catalogId));
    Element root = document.getRootElement();
    for (Iterator it = root.elementIterator(this.QUESTION_KEY); it.hasNext(); ) {
      Element element = (Element) it.next();
      HelpAQ helpAQ = new HelpAQ();
      helpAQ.setId(element.attributeValue(this.ID_KEY));
      helpAQ.setIsAnswered(element.elementTextTrim(this.IS_ANSWERED_KEY));
      helpAQ.setSubject(element.elementTextTrim(this.SUBJECT_KEY));
      helpAQ.setAnswer(element.elementTextTrim(this.ANSWER_KEY));
      map.put(helpAQ.getId(), helpAQ);
    }
    return map;
 }
 
 public HelpAQ getHelpAQ(String catalogId, String questionId) {
    return getHelpAQMap(catalogId).get(questionId);
 }
 
 public boolean addHelpAQ(String catalogId, HelpAQ helpAQ) {
    boolean isSuccess = false;
    String xmlFile = getHelpAQFileName(catalogId);
    Document document = parseXML(xmlFile);
    try {
      Element root = document.getRootElement();
      /*
      int size = root.elements(this.QUESTION_KEY).size();
      String id = null;
      if (size > 0) {
        //last element
        Element last = (Element) (root.elements(this.QUESTION_KEY).get(size - 1));
        id = last.attributeValue(this.ID_KEY);
        id = String.valueOf(Integer.parseInt(id) + 1);
      }else {
        //0
        id = "0";
      }
      */
      Element subElement = root.addElement(this.QUESTION_KEY)
          .addAttribute(this.ID_KEY, helpAQ.getId());
      subElement.addElement(this.IS_ANSWERED_KEY).addText(helpAQ.getIsAnswered());
      subElement.addElement(this.SUBJECT_KEY).addCDATA(helpAQ.getSubject());
      subElement.addElement(this.ANSWER_KEY).addCDATA(helpAQ.getAnswer());
      this.saveToFile(document, xmlFile);
      isSuccess = true;
    }catch (NumberFormatException ex) {
      log.error(ex.toString());
    }
    finally {
      return isSuccess;
    }
 }
 
 public boolean deleteHelpAQ(String catalogId, String questionId) {
    boolean isSuccess = false;
    String xmlFile = getHelpAQFileName(catalogId);
    Document document = parseXML(xmlFile);
    try {
      if (document != null) {
        Element root = document.getRootElement();
        List<Element> elements = root.elements(this.QUESTION_KEY);
        int index = quickSearch(elements, 0, elements.size(),
                                Long.parseLong(questionId));
        System.out.println("index="+index);
        if (index != -1) {
          root.remove(elements.get(index));
          isSuccess = true;
        }
      }
    }catch (Exception ex) {
      log.error(ex.toString());
    }finally {
      if(isSuccess){
        if(log.isDebugEnabled()){
           log.debug("Delete a question by catalogId:"+catalogId+" and questionId:"+questionId);
          }
        this.saveToFile(document, xmlFile);
      }
      return isSuccess;
    }
 }
 
 public boolean updateHelpAQ(String catalogId, HelpAQ helpAQ) {
    boolean isSuccess = false;
    String xmlFile = getHelpAQFileName(catalogId);
    Document document = parseXML(xmlFile);
    try {
      if (document != null) {//start if
        Element root = document.getRootElement();
        List<Element> elements = root.elements(this.QUESTION_KEY);
        int index = quickSearch(elements, 0, elements.size(),
                                Long.parseLong(helpAQ.getId()));
        if (index != -1) {
          Element element = elements.get(index);
          Element subElement=element.element(this.IS_ANSWERED_KEY);
          element.remove(subElement);
          element.addElement(this.IS_ANSWERED_KEY)
                 .addText(helpAQ.getIsAnswered());
          subElement = element.element(this.SUBJECT_KEY);
          element.remove(subElement);
          element.addElement(this.SUBJECT_KEY)
                 .addCDATA(helpAQ.getSubject());
          subElement = element.element(this.ANSWER_KEY);
          element.remove(subElement);
          element.addElement(this.ANSWER_KEY)
              .addCDATA(helpAQ.getAnswer());
          this.saveToFile(document, xmlFile);
          isSuccess = true;
        }
      }//end if
    }
    catch (Exception ex) {
      ex.printStackTrace();
      log.error(ex.toString());
    }
    finally {
      return isSuccess;
    }
 }
 
 public static void main(String[] args) {
    CatalogXML catalogxml = CatalogXML.getInstance();
    //List<Catalog> list = catalogxml.getCatalogList();
    //for (Catalog catalog : list) {
    // System.out.println(catalog.toString());
    // }
    //List<HelpAQ> helpAQList=catalogxml.getHelpAQListById(0);
    //for(HelpAQ helpAQ : helpAQList){
    // System.out.println(helpAQ.toString());
    // }
    //HelpAQ helpAQ = catalogxml.getHelpAQBy(0,0);
    //System.out.println(helpAQ.toString());
    // Document doc =parseXML(catalogxml.getCatalogById(0).getSrc());
    //Element root =doc.getRootElement();
    //int count=root.elements().size();
    // System.out.println("count="+count);
    //HelpAQ helpAQ = new HelpAQ();
    //helpAQ.setId("2");
    //helpAQ.setSubject("测试问题标题");
    //helpAQ.setAnswer("测试问题答案");
    //catalogxml.addHelpAQ("0", helpAQ);
    //catalogxml.updateHelpAQ("0", helpAQ);
    //catalogxml.addHelpAQ(0,helpAQ);
    //catalogxml.deleteHelpAQ("0","0");
    //System.out.println(Locale.getDefault().getLanguage());
    //System.out.println(Locale.getDefault().getCountry());
    //catalogxml.updateCatalog("2","用户管理没诺");
    //catalogxml.deleteCatalog("2");
    //HelpAQ helpAQ=new HelpAQ();
    //helpAQ.setSubject("这是一个增加测试");
    //helpAQ.setAnswer("这是一个增加测试的内容。。");
    //helpAQ.setIsAnswered("1");
    //catalogxml.addHelpAQ("0",helpAQ);
   // List<HelpAQ> list=catalogxml.getHelpAQList("0");
   // for(int i=0;i<list.size();i++){
   //   System.out.println(list.get(i).toString());
   // }
   //catalogxml.deleteHelpAQ("0","2");
   List<HelpAQ> list=catalogxml.getHelpAQList("7");
   for(HelpAQ helpAQ : list){
     System.out.println(helpAQ.toString());
   }
 }
 
 //System.out.println(document.);
}
 
14、UserXML.java
package com.mxca.shop4i.Help.xml;
 
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
import org.dom4j.*;
import java.util.*;
import com.mxca.shop4i.Help.module.*;
import com.mxca.shop4i.Help.util.MD5Coding;
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class UserXML extends BaseXML{
 private static final Log log = LogFactory.getLog(UserXML.class);
 private static UserXML userXML;
 private static Map<String,User> userMap=new HashMap<String,User>();
 private UserXML() {
    init();
 }
 
 private void init(){
    Document document=parseXML(this.USER_FILE);
    Element root = document.getRootElement();
    for(Iterator it=root.elementIterator(this.USER_KEY);it.hasNext();){
       Element element = (Element) it.next();
       User user=new User();
       user.setUserId(element.attributeValue(this.ID_KEY));
       user.setPassword(element.elementTextTrim(this.PASSWORD_KEY));
       userMap.put(user.getUserId(),user);
    }
 }
 
 public synchronized static UserXML getInstance(){
    if(userXML==null){
      userXML=new UserXML();
    }
    return userXML;
 }
 
 public synchronized void reset(){
    userMap=new HashMap<String,User>();
    init();
 }
 public synchronized List<User> getUserList(){
    return new ArrayList<User>(userMap.values());
 }
 
 public synchronized User getUser(String userId){
    return userMap.get(userId);
 }
 
 public synchronized User getUser(String userId,String password){
      User user=userMap.get(userId);
      if(user!=null&&user.getPassword().equals(MD5Coding.encode(password))){
        return user;
      }else{
        return null;
      }
 }
 
 public boolean addUser(User user){
    boolean isSuccess=false;
    try {
     // if (getUser(user.getUserId()) == null) {
           Document document =parseXML(USER_FILE);
           Element root=document.getRootElement();
           root.addElement(this.USER_KEY)
               .addAttribute(this.ID_KEY,user.getUserId())
               .addElement(this.PASSWORD_KEY).addText(MD5Coding.encode(user.getPassword()));
           this.saveToFile(document,this.USER_FILE);
           isSuccess=true;
     // }
    }
    finally{
      if(isSuccess){
          this.reset();
      }
      return isSuccess;
    }
 }
 
public boolean updatePassword(String userId,String password){
 boolean isSuccess=false;
 try {
    Document document = parseXML(this.USER_FILE);
    Element root = document.getRootElement();
    List<Element> elements = root.elements(this.USER_KEY);
    for (Element element : elements) {
      if (element.attributeValue(this.ID_KEY).equals(userId)) {
        element.remove(element.element(this.PASSWORD_KEY));
        element.addElement(this.PASSWORD_KEY)
               .addCDATA(MD5Coding.encode(password));
        this.saveToFile(document, this.USER_FILE);
        isSuccess = true;
        break;
      } //end if
    } //end for
 }finally{
    if(isSuccess){
       this.reset();
    }
    return isSuccess;
 }
}
 
public boolean deleteUser(String userId){
 boolean isSuccess=false;
 try {
    Document document = parseXML(this.USER_FILE);
    Element root = document.getRootElement();
    List<Element> elements = root.elements(this.USER_KEY);
    for (Element element : elements) {
      if (element.attributeValue(this.ID_KEY).equals(userId)) {
        root.remove(element);
        this.saveToFile(document, this.USER_FILE);
        isSuccess = true;
      }
    }
 }
 catch (Exception ex) {
    log.error(ex.toString());
 }finally{
    if(isSuccess){
      this.reset();
    }
    return isSuccess;
 }
 
}
 
 public static void main(String[] args){
    User u=new User();
    u.setUserId("admin");
    u.setPassword("admin");
    //UserXML.getInstance().updatePassword("guest0","thisisatest");
    // UserXML.getInstance().deleteUser("guest0");
    //UserXML.getInstance().addUser(u);
    //List<User> userList=UserXML.getInstance().getUserList();
    //for(User user : userList){
    // System.out.println(user.toString());
   // }
   UserXML.getInstance().addUser(u);
 }
}
 
15、HelpSecurityRealm.java
package com.mxca.shop4i.Help.security;
 
import org.securityfilter.realm.*;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
import com.mxca.shop4i.Help.xml.UserXML;
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class HelpSecurityRealm
    extends SimpleSecurityRealmBase {
 private static final Log log = LogFactory.getLog(HelpSecurityRealm.class);
 public HelpSecurityRealm() {
 }
 
 public boolean booleanAuthenticate(String username, String password) {
    if(UserXML.getInstance().getUser(username,password)!=null){
      if(log.isWarnEnabled()){
        log.warn("UserId :" + username + " logged in system at " +
                 new java.util.Date());
      }
      return true;
    }
    return false;
 }
 
 public boolean isUserInRole(String username, String rolename) {
    return true;
 }
 
}
 
16、Catalog.java
package com.mxca.shop4i.Help.module;
 
import java.io.*;
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class Catalog
    implements Serializable {
 private String id;
 private String title;
 private String src;
 public Catalog() {
 }
 
 public String toString() {
    return "{id:'" + id + "',title:'" + title + "',src:'" + src + "'}";
 }
 
 public void setId(String id) {
    this.id = id;
 }
 
 public void setTitle(String title) {
    this.title = title;
 }
 
 public void setSrc(String src) {
    this.src = src;
 }
 
 public String getId() {
    return id;
 }
 
 public String getTitle() {
    return title;
 }
 
 public String getSrc() {
    return src;
 }
 
}
 
17、HelpAQ.java
package com.mxca.shop4i.Help.module;
 
import java.io.*;
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class HelpAQ
    implements Serializable {
 private String id;
 private String subject;
 private String answer;
 private String isAnswered;
 public HelpAQ() {
 }
 
 public String toString() {
    return "{id:'" + id + "',subject:'" + subject + "',answer:'" + answer +
        "',isAnswered:'"+isAnswered+"'}";
 }
 
 public void setId(String id) {
    this.id = id;
 }
 
 public void setSubject(String subject) {
    this.subject = subject;
 }
 
 public void setAnswer(String answer) {
    this.answer = answer;
 }
 
 public void setIsAnswered(String isAnswered) {
    this.isAnswered = isAnswered;
 }
 
 public String getId() {
    return id;
 }
 
 public String getSubject() {
    return subject;
 }
 
 public String getAnswer() {
    return answer;
 }
 
 public String getIsAnswered() {
    return isAnswered;
 }
}
 
18、IndexFile.java
package com.mxca.shop4i.Help.module;
 
import java.io.*;
import java.util.*;
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class IndexFile
    implements Serializable {
 private String fileName;
 private Long size;
 private Date modifyDate;
 public IndexFile() {
 }
 
 public void setFileName(String fileName) {
    this.fileName = fileName;
 }
 
 public void setSize(Long size) {
 
    this.size = size;
 }
 
 public void setModifyDate(Date modifyDate) {
 
    this.modifyDate = modifyDate;
 }
 
 public String getFileName() {
    return fileName;
 }
 
 public Long getSize() {
 
    return size;
 }
 
 public Date getModifyDate() {
 
    return modifyDate;
 }
 
}
19、User.java
package com.mxca.shop4i.Help.module;
 
import java.io.*;
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class User implements Serializable {
 public User() {
 }
 private String userId;
 private String password;
 
 public String toString() {
    return "{userId:'" + userId + "',password:'" + password +
        "'}";
 }
 
 public String getUserId() {
 
    return userId;
 }
 
 public String getPassword() {
    return password;
 }
 
 public void setUserId(String userId) {
 
    this.userId = userId;
 }
 
 public void setPassword(String password) {
    this.password = password;
 }
 
}
 
20、LuceneHelper.java
package com.mxca.shop4i.Help.lucene;
 
import org.apache.lucene.analysis.*;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import com.mxca.shop4i.Help.util.*;
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class LuceneHelper {
 protected static final String INDEX_PATH = HelpConfig.getInstance().getIndexPath();
 protected static final Analyzer DEFAULT_ANALYZER = new StandardAnalyzer();
 protected static Object lock = new Object();
 protected static final String QUESTION_ID_KEY="questionId";
 protected static final String SUBJECT_KEY="subject";
 protected static final String ANSWER_KEY="answer";
 protected static final String CATALOG_ID_KEY="catalogId";
 protected static final String IS_ANSWERED_KEY="isAnswered";
 private Analyzer analyzer;
 public LuceneHelper() {
 }
 
 public Analyzer getAnalyzer() {
    if(analyzer==null){
      analyzer=DEFAULT_ANALYZER;
    }
    return analyzer;
 }
 
 public void setAnalyzer(Analyzer analyzer) {
    this.analyzer = analyzer;
 }
}
 
21、HelpIndexer.java
package com.mxca.shop4i.Help.lucene;
 
import java.io.*;
import java.util.*;
 
import org.apache.commons.logging.*;
import org.apache.lucene.analysis.*;
import org.apache.lucene.document.*;
import org.apache.lucene.index.*;
import com.mxca.shop4i.Help.module.*;
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class HelpIndexer
    extends LuceneHelper {
 private static final Log log = LogFactory.getLog(HelpIndexer.class);
 private static HelpIndexer helpIndexer;
 private HelpIndexer() {
 }
 
 public synchronized static HelpIndexer getInstance() {
    if (helpIndexer == null) {
      helpIndexer = new HelpIndexer();
    }
    return helpIndexer;
 }
 public static void reset(){
   helpIndexer=null;
   helpIndexer = new HelpIndexer();
 }
 public boolean createIndex(String catalogId, List<HelpAQ> helpAQList) {
    boolean isSuccess = false;
    IndexWriter indexWriter = null;
    try {
      synchronized (lock) {
       // Analyzer analyzer = getAnalyzer();
       // indexWriter = new IndexWriter(this.INDEX_PATH, analyzer, true);
        indexWriter=makeIndexWriter();
        for (HelpAQ helpAQ : helpAQList) {
          Document document = createDocument(catalogId, helpAQ);
          indexWriter.addDocument(document);
        }
        indexWriter.optimize();
        isSuccess = true;
 
      }
    }
    catch (IOException ex) {
      if (log.isErrorEnabled()) {
        log.error("A error occurs when index file", ex);
      }
    }
    finally {
      if (indexWriter != null) {
        try {
          indexWriter.close();
        }
        catch (IOException ex1) {
          if (log.isErrorEnabled()) {
            log.error("Occur an error when close IndexWriter", ex1);
          }
        }
      }
      return isSuccess;
    } //end finally
 
 }
 
 private Document createDocument(String catalogId, HelpAQ helpAQ) {
    Document document = new Document();
    document.add(new Field(this.QUESTION_ID_KEY, helpAQ.getId(),
                           Field.Store.YES, Field.Index.TOKENIZED));
    document.add(new Field(this.IS_ANSWERED_KEY, helpAQ.getIsAnswered(),
                           Field.Store.YES, Field.Index.UN_TOKENIZED));
    document.add(new Field(this.SUBJECT_KEY, helpAQ.getSubject(),
                           Field.Store.YES, Field.Index.TOKENIZED));
    document.add(new Field(this.ANSWER_KEY, helpAQ.getAnswer(), Field.Store.YES,
                           Field.Index.TOKENIZED));
    document.add(new Field(this.CATALOG_ID_KEY, catalogId, Field.Store.YES,
                           Field.Index.TOKENIZED));
    return document;
 }
 
 private IndexWriter makeIndexWriter() {
    IndexWriter indexWriter = null;
    try {
      Analyzer analyzer = getAnalyzer();
      if (IndexReader.indexExists(this.INDEX_PATH)) {
        indexWriter = new IndexWriter(this.INDEX_PATH, analyzer, false);
      }
      else {
        indexWriter = new IndexWriter(this.INDEX_PATH, analyzer, true);
      }
    }
    catch (IOException ex) {
    }
    return indexWriter;
 }
 
 public boolean addIndex(String catalogId, HelpAQ helpAQ) {
    boolean isSuccess = false;
    IndexWriter indexWriter = null;
    try {
      synchronized (lock) {
        indexWriter = makeIndexWriter();
        if (indexWriter != null) {
          Document document = createDocument(catalogId, helpAQ);
          indexWriter.addDocument(document);
          indexWriter.optimize();
          isSuccess = true;
        }
      } //end synchronized
    } //end try
    catch (IOException ex) {
      log.error("Occur an error when add a new HelpAQ object to index files",
                ex);
    }
    finally {
      if (indexWriter != null) {
        try {
          indexWriter.close();
        }
        catch (IOException ex1) {
          log.error("Occur an error when close the index writer", ex1);
        }
      }
      return isSuccess;
    }
 }
 
 public boolean deleteIndex(String questionId) {
    boolean isSuccess = false;
    IndexReader reader = null;
    try {
      synchronized (lock) {
        Term term = new Term(this.QUESTION_ID_KEY, questionId);
        reader = IndexReader.open(this.INDEX_PATH);
        reader.deleteDocuments(term);
      }
      isSuccess = true;
    }
    catch (IOException ex) {
      log.error("Occur an error when open index path " + this.INDEX_PATH, ex);
    }
    finally {
      if (reader != null) {
        try {
          reader.close();
        }
        catch (IOException ex1) {
          log.error("Occur an error when close index path", ex1);
        }
      }
      return isSuccess;
    }
 }
 
 public boolean updateIndex(String catalogId, HelpAQ helpAQ) {
    boolean isSuccess = false;
    try {
      this.deleteIndex(helpAQ.getId());
      this.addIndex(catalogId, helpAQ);
      isSuccess=true;
    }
    catch (Exception ex) {
      log.error("Occur an error when update index file", ex);
    }
    finally {
      return isSuccess;
    }
 
 }
 
}
 
22、HelpSearcher.java
package com.mxca.shop4i.Help.lucene;
 
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
import org.apache.lucene.document.*;
import org.apache.lucene.search.*;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.queryParser.*;
import com.mxca.shop4i.Help.module.*;
import com.mxca.shop4i.Help.util.*;
import java.util.*;
import java.io.*;
import org.apache.lucene.index.IndexReader;
 
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class HelpSearcher
    extends LuceneHelper {
 private static final Log log = LogFactory.getLog(HelpSearcher.class);
 private Searcher searcher;
 private static HelpSearcher helpSearcher;
 private static Occur[] occur = {
      Occur.SHOULD, Occur.SHOULD};
 private HelpSearcher() {
   // init();
 }
 
 public static synchronized HelpSearcher getInstance() {
    if (helpSearcher == null) {
      helpSearcher = new HelpSearcher();
    }
    return helpSearcher;
 }
/*
 private void init() {
    initSearcher();
 }
 */
 public static void reset(){
    helpSearcher = new HelpSearcher();
 }
 private void closeSearcher(){
   if(searcher!=null){
    try {
      //IndexReader.unlock(FSDirectory.getDirectory(INDEX_PATH,false));
      //helpSearcher=null;
      //IndexReader reader = IndexReader.open(INDEX_PATH);
      //reader.close();
      searcher.close();
    }
    catch (IOException ex) {
      ex.printStackTrace();
    }
   }
 }
 
 private void createSearcher(){
    try {
      ///IndexReader reader = IndexReader.open(INDEX_PATH);
      searcher = new IndexSearcher(INDEX_PATH);
    }
    catch (IOException ex) {
      ex.printStackTrace();
    }
 }
/*
 private void initSearcher() {
    try {
      if (log.isDebugEnabled()) {
        log.debug("init searcher");
      }
      IndexReader reader = IndexReader.open(INDEX_PATH);
      searcher = new IndexSearcher(reader);
     // searcher=new IndexSearcher(FSDirectory.getDirectory(INDEX_PATH,false));
      //searcher = new IndexSearcher(this.INDEX_PATH);
    }
    catch (IOException ex) {
      log.error("Occur an error when instance a Searcher ", ex);
    }
 }
*/
 private HelpAQ populateHelpAQ(Document doc, HelpAQ helpAQ) {
    helpAQ.setId(MD5Coding.encode(doc.get(this.QUESTION_ID_KEY)));
    helpAQ.setIsAnswered(doc.get(this.IS_ANSWERED_KEY));
    helpAQ.setSubject(doc.get(this.SUBJECT_KEY));
    helpAQ.setAnswer(doc.get(this.ANSWER_KEY));
    return helpAQ;
 }
 
 public List<HelpAQ> searchByCatalogId(String catalogId) {
    List<HelpAQ> helpAQList = new ArrayList<HelpAQ> ();
    try {
      synchronized (lock) {
      QueryParser parser = new QueryParser(this.CATALOG_ID_KEY,
                                           this.getAnalyzer());
      Query query = parser.parse(catalogId.trim());
      createSearcher();
      Hits hits = searcher.search(query);
      for (int i = 0; i < hits.length(); i++) {
        Document doc = hits.doc(i);
        HelpAQ helpAQ = new HelpAQ();
        populateHelpAQ(doc, helpAQ);
        /*
                   helpAQ.setId(doc.get(this.QUESTION_ID_KEY));
                   helpAQ.setIsAnswered(doc.get(this.IS_ANSWERED_KEY));
                   helpAQ.setSubject(doc.get(this.SUBJECT_KEY));
                   helpAQ.setAnswer(doc.get(this.ANSWER_KEY));
         */
        helpAQList.add(helpAQ);
      } //end for
       } //end synchronized
    } //end try
    catch (ParseException ex) {
      ex.printStackTrace();
      log.error("Query syntax is not ok. The query is [" + catalogId + "]", ex);
    }
    catch (IOException ex1) {
      ex1.printStackTrace();
      log.error("Can't read the index at path [" + INDEX_PATH
                + "]. It is really exists?", ex1);
   }finally{
      closeSearcher();
      return helpAQList;
    }
 
 }
 
 public List<HelpAQ> searchByKeyWord(String keyWord) {
    String[] fields = {
        this.SUBJECT_KEY, this.ANSWER_KEY};
    keyWord = escapeString(keyWord);
    return search(keyWord, fields);
 }
 
 private String escapeString(String originalStr) {
    replaceString(originalStr, "'", "&#39;");
    replaceString(originalStr, "/"", "&#34;");
    replaceString(originalStr, "//", "&#92;");
    replaceString(originalStr, "/r/n", "/n");
    replaceString(originalStr, "//n", "/n");
    replaceString(originalStr, "+", "//+");
    replaceString(originalStr, "/uFF0D", "-");
    replaceString(originalStr, "!", "//!");
    replaceString(originalStr, "!", "//!");
    replaceString(originalStr, "(", "//(");
    replaceString(originalStr, ")", "//)");
    replaceString(originalStr, ":", "//:");
    replaceString(originalStr, "^", "//^");
    replaceString(originalStr, "]", "//]");
    replaceString(originalStr, "{", "//{");
    replaceString(originalStr, "}", "//}");
    replaceString(originalStr, "~", "//~");
    replaceString(originalStr, "/u3000", " ");
    return originalStr;
 }
 
 private String replaceString(String source, String oldString,
                                     String newString) {
    if (source == null || oldString == null || newString == null) {
      return "";
    }
    else {
      return replace(source, oldString, newString);
    }
 }
 
 private String replace(String source, String oldString,
                                String newString) {
    StringBuffer output = new StringBuffer();
    int lengthOfSource = source.length();
    int lengthOfOld = oldString.length();
    int posStart;
    int pos;
    for (posStart = 0; (pos = source.indexOf(oldString, posStart)) >= 0;
         posStart = pos + lengthOfOld) {
      output.append(source.substring(posStart, pos));
      output.append(newString);
    }
 
    if (posStart < lengthOfSource) {
      output.append(source.substring(posStart));
    }
    return output.toString();
 }
 
 private String format(String source, String keyWord) {
    String[] keyWordArrary = keyWord.split(" ");
    for (int j = 0; j < keyWordArrary.length; j++) {
      String word = keyWordArrary[j];
      if (word.length() > 0) {
        source = replaceString(source, word,
                               "<font color=/"" +
                               HelpConfig.getInstance().getKeyWordColor() +
                               "/">" + word + "</font>");
      }
    }
    return source;
 }
 
 private List<HelpAQ> search(String keyWord, String[] fields) {
    List<HelpAQ> helpAQList = new ArrayList<HelpAQ> ();
 
    try {
      synchronized (lock) {
      BooleanQuery booleanQuery = new BooleanQuery();
      Query query = MultiFieldQueryParser.parse(keyWord, fields, occur,
                                                this.getAnalyzer());
      booleanQuery.add(query, Occur.MUST);
      createSearcher();
      Hits hits = searcher.search(booleanQuery);
      for (int i = 0; i < hits.length(); i++) {
        Document doc = hits.doc(i);
        HelpAQ helpAQ = new HelpAQ();
        populateHelpAQ(doc, helpAQ);
        /*
                   helpAQ.setId(doc.get(this.QUESTION_ID_KEY));
                   helpAQ.setIsAnswered(doc.get(this.IS_ANSWERED_KEY));
                   helpAQ.setSubject(doc.get(this.SUBJECT_KEY));
                   helpAQ.setAnswer(doc.get(this.ANSWER_KEY));
         */
 
        helpAQ.setSubject(format(helpAQ.getSubject(),keyWord));
        helpAQ.setAnswer(format(helpAQ.getAnswer(),keyWord));
        helpAQList.add(helpAQ);
      } //end for
      //searcher.close();
      } //end synchronized
    }
    catch (ParseException ex) {
      log.error("Occur an error when parse index file", ex);
    }
    catch (IOException ex1) {
      log.error("Occur an error when search result ", ex1);
    }finally{
      closeSearcher();
      return helpAQList;
    }
 }
}
 
23、IndexFileManager.java
package com.mxca.shop4i.Help.lucene;
 
import java.io.*;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class IndexFileManager extends LuceneHelper {
 private static final Log log = LogFactory.getLog(LuceneHelper.class);
 private static final long DELETE_THREAD_SLEEP = 500;
 private static final int DELETE_COUNT = 20;
 public IndexFileManager() {
 }
 
 public static boolean deleteFile(File file) {
    boolean isSuccess = false;
    int count = DELETE_COUNT;
    try {
        while (file.exists() && !file.delete() && count != 0) {
            count--;
            try {
                Thread.sleep(DELETE_THREAD_SLEEP);
            } catch (InterruptedException ignore) {
            }
        }
    } catch (Exception ex) {
    }
    if (file.exists() && count == 0) {
        log.error("Unable to delete '" + file + "' . " +
                  DELETE_COUNT + " attempts at " + DELETE_THREAD_SLEEP +
                  " milliseconds intervals.");
    } else {
        isSuccess = true;
    }
    return isSuccess;
}
 
 public static File[] getIndexFiles(){
   File[] files=null;
   File directory=new File(INDEX_PATH);
   if(!directory.exists()){
    log.error("Can not find the directory ["+INDEX_PATH+"]");
     files=new File[0];
   }else{
     files=directory.listFiles();
   }
   return files;
 }
 
 public static void main(String args[]){
    File[] files=getIndexFiles();
    for(int i=0;i<files.length;i++){
      File file=files[i];
      System.out.println("filename="+file.getName()+"filesize="+file.length());
    }
 }
}
 
24、BaseAction.java
package com.mxca.shop4i.Help.action;
 
import java.security.*;
import java.util.*;
 
import org.securityfilter.filter.*;
import com.mxca.shop4i.Help.module.*;
import com.mxca.shop4i.Page.display.*;
import com.opensymphony.xwork.*;
import com.mxca.shop4i.Help.xml.CatalogXML;
import com.opensymphony.webwork.interceptor.ParameterAware;
 
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class BaseAction
    extends ActionSupport {
 private String localeStr = "_" + Locale.getDefault().getLanguage() + "_" +
      Locale.getDefault().getCountry();
 private String currentUser;
 protected static final int DEFAULT_PAGE_SIZE = 20;
 protected String[] pageNo;
 protected String[] pageSize;
 private List<Catalog> catalogList=CatalogXML.getInstance().getCatalogList();
 public BaseAction() {
 
 }
 
 public String doLogin() throws Exception {
    return SUCCESS;
 }
 
 public String doLogError() throws Exception {
    this.addActionMessage(this.getText(
        "error.help.login.userId.or.password.not.right"));
    return ERROR;
 }
 
 public String doLogout() throws Exception {
    ActionContext.getContext().getSession().clear();
    return SUCCESS;
 }
 
 public String getLocaleStr() {
    return localeStr;
 }
 
 public String getCurrentUser() {
    Principal principal = (Principal) ActionContext.getContext().getSession().
        get(
            SecurityRequestWrapper.PRINCIPAL_SESSION_KEY);
    currentUser = principal.getName();
    return currentUser;
 }
 
 public String[] getPageNo() {
    return pageNo;
 }
 
 public String[] getPageSize() {
    return pageSize;
 }
 
 public List getCatalogList() {
    return catalogList;
 }
 
 public void resetCatalog(){
    catalogList=CatalogXML.getInstance().getCatalogList();
 }
 
 protected Page getCheckPage(int total) {
    Page page = Page.getInstance();
    if (pageNo != null && pageNo[0].length() > 0) {
      int pageNum = Integer.parseInt(pageNo[0]);
      if (pageNum <= 0) {
        pageNum = 1;
      }
      page.setPageNo(pageNum);
    }
    else {
      page.setPageNo(1);
    }
    if (pageSize != null && pageSize[0].length() > 0) {
      int pSize = Integer.parseInt(pageSize[0]);
      page.setPageSize(pSize);
    }
    else {
      page.setPageSize(DEFAULT_PAGE_SIZE);
    }
    page.setTotal(total);
    page.check();
    return page;
 }
 
 public String doCatalogList() throws Exception {
    return SUCCESS;
 }
 
 public void setPageNo(String[] pageNo) {
    this.pageNo = pageNo;
 }
 
 public void setPageSize(String[] pageSize) {
    this.pageSize = pageSize;
 }
 
 
}
 
25、AdminAction.java
package com.mxca.shop4i.Help.action.admin;
 
import java.util.*;
 
import com.mxca.shop4i.Help.action.*;
import com.mxca.shop4i.Help.module.*;
import com.mxca.shop4i.Help.lucene.*;
import com.mxca.shop4i.Help.util.*;
import com.mxca.shop4i.Help.xml.*;
import com.mxca.shop4i.Page.display.*;
 
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class AdminAction
    extends BaseAction {
 private User user;
 private String userId;
 private String password;
 private String catalogId;
 private String questionId;
 private String catalogName;
 private String catalogSrc;
 private String replyStatus;
 private String subject;
 private String answer;
 private int total = 0;
 //private List<Catalog> catalogList;
 private List<HelpAQ> helpAQList;
 private HelpAQ helpAQ;
 public AdminAction() {
 }
 
 public String doChangePwdInput() throws Exception {
    return INPUT;
 }
 
 public String doChangePwd() throws Exception {
    boolean isSuccess = UserXML.getInstance().updatePassword(userId, password);
    if (isSuccess == true) {
      this.addActionMessage(this.getText("msg.help.change.password"));
    }
    else {
      this.addActionMessage(this.getText("error.help.change.password"));
    }
    return SUCCESS;
 }
 
 /*
    public String doCatalogList() throws Exception {
      this.catalogList = CatalogXML.getInstance().getCatalogList();
      return SUCCESS;
    }
   */
 public String doDelCatalog() throws Exception {
    boolean isSuccess = CatalogXML.getInstance().deleteCatalog(catalogId);
    if (isSuccess == true) {
      this.addActionMessage(this.getText("msg.help.delete.catalog.success"));
    }
    else {
      this.addActionMessage(this.getText("error.help.delete.catalog.fail"));
    }
    resetCatalog();
    //this.catalogList = CatalogXML.getInstance().getCatalogList();
    return SUCCESS;
 }
 
 public String doUpdateCatalog() throws Exception {
    boolean isSuccess = CatalogXML.getInstance().updateCatalog(catalogId,
        new String(catalogName.getBytes("ISO-8859-1"), "UTF-8"));
    if (isSuccess == true) {
      this.addActionMessage(this.getText("msg.help.update.catalog.success"));
    }
    else {
      this.addActionMessage(this.getText("error.help.delete.catalog.fail"));
    }
    resetCatalog();
    //this.catalogList = CatalogXML.getInstance().getCatalogList();
    return SUCCESS;
 }
 
 public String doAddCatalog() throws Exception {
    boolean isSuccess = CatalogXML.getInstance().addCatalog( catalogName,
        catalogSrc);
    if (isSuccess == true) {
      this.addActionMessage(this.getText("msg.help.add.catalog.success"));
    }
    else {
      this.addActionMessage(this.getText("error.help.add.catalog.fail"));
    }
    resetCatalog();
    //this.catalogList = CatalogXML.getInstance().getCatalogList();
    return SUCCESS;
 }
 
 public String doQuestionList() throws Exception {
    if (replyStatus == null || replyStatus.length() <= 0) {
      this.helpAQList = CatalogXML.getInstance().getHelpAQList(catalogId);
    }
    else {
      this.helpAQList = CatalogXML.getInstance().getHelpAQList(catalogId,
          replyStatus);
    }
    this.total = helpAQList.size();
    if (total > 0) {
      Page checkPage = getCheckPage(total);
      int start = (checkPage.getPageNo() - 1) * checkPage.getPageSize();
      int end = checkPage.getPageNo() * checkPage.getPageSize();
      end = (end >= total ? total : end);
      helpAQList = helpAQList.subList(start, end);
    }
    else {
      this.addActionMessage(this.getText("msg.help.list.question.not.result"));
    }
    return SUCCESS;
 }
 
 public String doQuestionAdd() throws Exception {
    helpAQ = new HelpAQ();
    helpAQ.setId(RandomGID.getRam());
    helpAQ.setSubject(subject);
    helpAQ.setAnswer(answer);
    if (answer != null && answer.length() > 0) {
      helpAQ.setIsAnswered("1");
    }
    else {
      helpAQ.setIsAnswered("0");
    }
    boolean isSuccess = CatalogXML.getInstance().addHelpAQ(catalogId, helpAQ);
    if (isSuccess) {
      this.addActionMessage(this.getText("msg.help.add.question.success"));
      isSuccess = HelpIndexer.getInstance().addIndex(catalogId, helpAQ);
      if (isSuccess) {
        this.addActionMessage(this.getText(
            "msg.help.add.question.index.success"));
        HelpSearcher.reset();
      }
      else {
        this.addActionMessage(this.getText("error.help.add.question.index.fail"));
      }
    }
    else {
      this.addActionMessage(this.getText("error.help.add.question.fail"));
    }
 
    return SUCCESS;
 }
 
 public String doQuestionEditInput() throws Exception {
    helpAQ = CatalogXML.getInstance().getHelpAQ(catalogId, questionId);
    return INPUT;
 }
 
 public String doQuestionEdit() throws Exception {
    helpAQ = new HelpAQ();
    helpAQ.setId(questionId);
    helpAQ.setSubject(subject);
    helpAQ.setAnswer(answer);
    if (answer != null && answer.length() > 0) {
      helpAQ.setIsAnswered("1");
    }
    else {
      helpAQ.setIsAnswered("0");
    }
    boolean isSuccess = CatalogXML.getInstance().updateHelpAQ(catalogId, helpAQ);
    if (isSuccess) {
      this.addActionMessage(this.getText("msg.help.update.question.success"));
      isSuccess = HelpIndexer.getInstance().updateIndex(catalogId, helpAQ);
      if (isSuccess) {
        this.addActionMessage(this.getText(
            "msg.help.update.question.index.success"));
        HelpSearcher.reset();
      }
      else {
        this.addActionMessage(this.getText(
            "error.help.update.question.index.fail"));
      }
    }
    else {
      this.addActionMessage(this.getText("error.help.update.question.fail"));
    }
 
    return SUCCESS;
 }
 
 public String doDeleteQuestion() throws Exception {
    boolean isSuccess = CatalogXML.getInstance().deleteHelpAQ(catalogId,
        questionId);
    if (isSuccess) {
      this.addActionMessage(this.getText("msg.help.delete.question.success"));
      isSuccess = HelpIndexer.getInstance().deleteIndex(questionId);
      if (isSuccess) {
        this.addActionMessage(this.getText(
            "msg.help.delete.question.index.success"));
        HelpSearcher.reset();
      }
      else {
        this.addActionMessage(this.getText(
            "error.help.delete.question.index.fail"));
      }
    }
    else {
      this.addActionMessage(this.getText("error.help.delete.question.fail"));
    }
 
    return doQuestionList();
 }
 
 public User getUser() {
    return user;
 }
 
 public String getCatalogId() {
    return catalogId;
 }
 
 public String getCatalogName() {
    return catalogName;
 }
 
 public String getCatalogSrc() {
    return catalogSrc;
 }
 
 public int getTotal() {
    return total;
 }
 
 public String getReplyStatus() {
    return replyStatus;
 }
 
 public List getHelpAQList() {
    return helpAQList;
 }
 
 public String getQuestionId() {
    return questionId;
 }
 
 public String getAnswer() {
    return answer;
 }
 
 public String getSubject() {
    return subject;
 }
 
 public HelpAQ getHelpAQ() {
    return helpAQ;
 }
 
 public void setPassword(String password) {
    this.password = password;
 }
 
 public void setUserId(String userId) {
 
    this.userId = userId;
 }
 
 public void setCatalogId(String catalogId) {
    this.catalogId = catalogId;
 }
 
 public void setCatalogName(String catalogName) {
    this.catalogName = catalogName;
 }
 
 public void setCatalogSrc(String catalogSrc) {
    this.catalogSrc = catalogSrc;
 }
 
 public void setReplyStatus(String replyStatus) {
    this.replyStatus = replyStatus;
 }
 
 public void setQuestionId(String questionId) {
    this.questionId = questionId;
 }
 
 public void setAnswer(String answer) {
    this.answer = answer;
 }
 
 public void setSubject(String subject) {
    this.subject = subject;
 }
}
 
26、IndexAction.java
package com.mxca.shop4i.Help.action.admin;
 
import java.io.*;
 
import com.mxca.shop4i.Help.action.*;
import com.mxca.shop4i.Help.lucene.*;
import com.mxca.shop4i.Help.module.Catalog;
import com.mxca.shop4i.Help.xml.CatalogXML;
import com.mxca.shop4i.Help.module.HelpAQ;
import java.util.*;
import com.mxca.shop4i.Help.module.IndexFile;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class IndexAction
    extends BaseAction {
 private static final Log log = LogFactory.getLog(IndexAction.class);
 private List<IndexFile> indexFiles;
 public IndexAction() {
 }
 
 public String doIndexList() throws Exception{
    File[] files=IndexFileManager.getIndexFiles();
    indexFiles=new ArrayList<IndexFile>(files.length);
    for(int i=0;i<files.length;i++){
      IndexFile indexFile=new IndexFile();
      indexFile.setFileName(files[i].getName());
      indexFile.setSize(files[i].length());
      indexFile.setModifyDate(new Date(files[i].lastModified()));
      indexFiles.add(indexFile);
    }
    files=null;
    return SUCCESS;
 }
 
 
 
 public String doReIndex() throws Exception{
    try {
       //HelpSearcher.closeSearcher();
 
       File[] files=IndexFileManager.getIndexFiles();
       for(int i=0;i<files.length;i++){
         IndexFileManager.deleteFile(files[i]);
       }
       files=null;
       Date start = null;
       Date end = null;
       if (log.isDebugEnabled()) {
         start = new Date();
         log.debug(">>>>>>Start index files on " + start);
       }
      List<Catalog> catalogList = CatalogXML.getInstance().getCatalogList();
      for (Catalog catalog : catalogList) {
        List<HelpAQ>
            helpAQList = CatalogXML.getInstance().getHelpAQList(catalog.getId());
        HelpIndexer.getInstance().createIndex(catalog.getId(), helpAQList);
      }
      if (log.isDebugEnabled()) {
          end = new Date();
          log.debug(">>>>>>End index files completely ,and spend Time : " +
                    (end.getTime() - start.getTime()) + " milliseconds");
        }
 
      doIndexList();
    }
    catch (Exception ex) {
    }finally{
      //HelpSearcher.createSearcher();
      return SUCCESS;
    }
 }
 
 public List getIndexFiles() {
    return indexFiles;
 }
 
}
 
27、HelpAction.java
package com.mxca.shop4i.Help.action.help;
 
import java.util.*;
 
import com.mxca.shop4i.Help.action.*;
import com.mxca.shop4i.Help.module.*;
import com.mxca.shop4i.Help.lucene.*;
import com.mxca.shop4i.Help.xml.*;
/**
 *
 * <p>Title: Help</p>
 *
 * <p>Description: mxca help</p>
 *
 * <p>Copyright: Copyright (c) 2006</p>
 *
 * <p>Company: mxca</p>
 *
 * @author Sogui Dai
 * @version 1.0
 */
public class HelpAction extends BaseAction {
 private String catalogId;
 private String keyWord;
 private String menuTitle;
 private List<HelpAQ> helpAQList;
 public HelpAction() {
 }
 
 public String doSearch()throws Exception{
    if(catalogId!=null&&catalogId.length()>0){
      helpAQList=HelpSearcher.getInstance().searchByCatalogId(catalogId);
      menuTitle=CatalogXML.getInstance().getCatalogById(catalogId).getTitle();
      if(helpAQList.size()<=0){
        String[] args={menuTitle};
        this.addActionMessage(this.getText("msg.help.search.by.catalog.no.result",args));
      }
    }else{
      helpAQList=HelpSearcher.getInstance().searchByKeyWord(keyWord);
      menuTitle=this.getText("msg.help.search.by.keyword");
      if(helpAQList.size()<=0){
      String[] args={keyWord};
      this.addActionMessage(this.getText("msg.help.search.by.keyword.no.result",args));
     }
    }
    return SUCCESS;
 }
 
 public List getHelpAQList() {
    return helpAQList;
 }
 
 public String getCatalogId() {
    return catalogId;
 }
 
 public String getKeyWord() {
    return keyWord;
 }
 
 public String getMenuTitle() {
    return menuTitle;
 }
 
 public void setCatalogId(String catalogId) {
    this.catalogId = catalogId;
 }
 
 public void setKeyWord(String keyWord) {
    this.keyWord = keyWord;
 }
 
 public void setMenuTitle(String menuTitle) {
    this.menuTitle = menuTitle;
 }
 
}
 
28、Catalog.xml位于resources文件夹
<?xml version="1.0" encoding="UTF-8"?>
 
<Help>
 <catalog id="0">
    <title><![CDATA[购物指南]]></title>
    <src><![CDATA[ShoppingGuide.xml]]></src>
 </catalog>
 <catalog id="1">
    <title><![CDATA[安全保证]]></title>
    <src><![CDATA[SecurityPermission.xml]]></src>
 </catalog>
 <catalog id="2">
    <title><![CDATA[选购指导]]></title>
    <src><![CDATA[ChoiceGuide.xml]]></src>
 </catalog>
 <catalog id="3">
    <title><![CDATA[订单信息]]></title>
    <src><![CDATA[OrderInfo.xml]]></src>
 </catalog>
 <catalog id="4">
    <title><![CDATA[付款方式]]></title>
    <src><![CDATA[PayWay.xml]]></src>
 </catalog>
 <catalog id="5">
    <title><![CDATA[配送指南]]></title>
    <src><![CDATA[ShippingGuide.xml]]></src>
 </catalog>
 <catalog id="6">
    <title><![CDATA[售后服务]]></title>
   <src><![CDATA[AfterService.xml]]></src>
 </catalog>
 <catalog id="7">
    <title><![CDATA[注册会员]]></title>
    <src><![CDATA[UserRegister.xml]]></src>
 </catalog>
 
</Help>
 
29、User.xml位于resources文件夹
<?xml version="1.0" encoding="UTF-8"?>
 
<Help>
 <user id="admin">
    <password><![CDATA[21232f297a57a5a743894a0e4a801fc3]]></password>
 </user>
</Help>
 
30、Catalog.html
<#assign ww=JspTaglibs["/WEB-INF/webwork.tld"] />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><@ww.property value="%{getText('html.Catalog.title')}"/></title>
<link rel="stylesheet" type="text/css" media="screen" href="${req.contextPath}/styles/css.css"/>
<script src="${req.contextPath}/scripts/common.js" type="text/javascript"></script>
<script type="text/javascript">
 function editCatalog(catalogId){
    var object=document.getElementById(catalogId+"_title");
       object.innerHTML="<input type=/"text/" name=/""+catalogId+"_title_input/" value=/""+object.innerText+"/">";
      
       object=document.getElementById(catalogId+"_edit");
       object.href="javascript:saveCatalog('"+catalogId+"');";
       object.innerText="<@ww.property value="%{getText('html.common.title.save')}"/>";
      
 }
 
 function saveCatalog(catalogId){
   var catalogName=document.getElementById(catalogId+"_title_input").value;
   if(catalogName.length<=0){
    setErrorMsg("msg","<@ww.property value="%{getText('html.Catalog.msg.pls.input.catalog.name')}"/>");
    document.getElementById(catalogId+"_title_input").focus();
    return;
   }
   var action="${req.contextPath}/Admin/updateCatalog.jspx?catalogId="+catalogId+"&catalogName="+encodeURI(catalogName);
   window.location.href=action;
 }
 
 function checkAddCatalog(){
    var catalogName=document.getElementById('catalogName');
       if(catalogName.value.length<=0){
        setErrorMsg("msg","<@ww.property value="%{getText('html.Catalog.msg.pls.input.catalog.name')}"/>");
        catalogName.focus();
        return false;
       }
      
       var catalogSrc=document.getElementById('catalogSrc');
       if(catalogSrc.value.length<=0){
        setErrorMsg("msg","<@ww.property value="%{getText('html.Catalog.msg.pls.input.catalog.src')}"/>");
        catalogSrc.focus();
        return false;
       }
      
       if(catalogSrc.value.lastIndexOf('.xml')==-1){
        setErrorMsg("msg","<@ww.property value="%{getText('html.Catalog.msg.input.catalog.src.error')}"/>");
        catalogSrc.focus();
        return false;
       }
 }
 
 function deleteCatalog(catalogId){
   if(confirm("<@ww.property value="%{getText('html.Catalog.msg.delete.confirm')}"/>")){
      var action="${req.contextPath}/Admin/delCatalog.jspx?catalogId="+catalogId;
        window.location.href=action;
   }
 }
</script>
</head>
 
<body>
 
<table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
                     <td id="msg">
                     <@ww.if test="hasActionMessages()">
                             <p class="WarningMsg">
                                   <@ww.iterator value="actionMessages">
                                           <@ww.property/><br>
                                           </@ww.iterator>
                            </p>
                     </@ww.if>
                     </td>
                     </tr>
           
        <tr>
           <td bgcolor="EAEAEA">
                   <#if catalogList?has_content>
                   <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr bgcolor="FF7101" height="25">
                     <td colspan="4"><div align="center"><font color="#FFFFFF"><@ww.property value="%{getText('html.Catalog.title.list')}"/></font></div></td>
              </tr>
               <tr bgcolor="#FFFFFF" height="20">
                 <td width="20%"><@ww.property value="%{getText('html.Catalog.title.catalog.id')}"/></td>
                 <td width="23%"><@ww.property value="%{getText('html.Catalog.title.question.file.name')}"/></td>
                 <td width="27%"><@ww.property value="%{getText('html.common.title.catalog')}"/></td>
                 <td width="30%"><@ww.property value="%{getText('html.common.title.operate')}"/></td>
               </tr>
                        <#if catalogList?has_content>
                         <#list catalogList as catalog>
               <tr>
                 <td>${(catalog.id)?default('')}</td>
                 <td>${(catalog.src)?default('')}</td>
                 <td id="${(catalog.id)?default('')}_title">${(catalog.title)?default('')}</td>
                 <td>[<a href="javascript:editCatalog('${(catalog.id)?default('')}');" id="${(catalog.id)?default('')}_edit">
                 <@ww.property value="%{getText('html.common.title.edit')}"/>
                 </a>]&nbsp;&nbsp;[
                 <a href="javascript:deleteCatalog('${(catalog.id)?default('')}');">
                 <@ww.property value="%{getText('html.common.title.delete')}"/>
                 </a>]</td>
               </tr>
                         </#list>
                        </#if>
                        <tr bgcolor="#FFFFFF">
                        <td colspan="4">&nbsp;</td>
                        </tr>                  
             </table>       
                      </#if>
                      </td>
              </tr>
              <tr>
               <td bgcolor="EAEAEA">
               <form name="CatalogAddForm" method="post" action="addCatalog.jspx" onSubmit="javascript:return checkAddCatalog();">
                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
                 <tr bgcolor="FF7101" height="25">
                         <td colspan="4"><div align="center"><font color="#FFFFFF"><@ww.property value="%{getText('html.Catalog.title.add')}"/></font></div></td>
                     </tr>
             <tr>
               <td width="20%">&nbsp;</td>
               <td width="14%"><@ww.property value="%{getText('html.common.title.catalog')}"/>:</td>
               <td width="36%"><input name="catalogName" type="text" size="50"></td>
               <td width="30%">&nbsp;</td>
             </tr>
             <tr>
               <td>&nbsp;</td>
               <td><@ww.property value="%{getText('html.Catalog.title.question.file.name')}"/>:</td>
               <td><input name="catalogSrc" type="text" size="50"></td>
               <td>&nbsp;</td>
             </tr>
                                   <tr>
               <td>&nbsp;</td>
               <td>&nbsp;</td>
               <td align="center">
                 <input type="submit" name="Submit" class="go-wenbenkuang" value="<@ww.property value="%{getText('html.common.title.save')}"/>">
               </td>
               <td>&nbsp;</td>
             </tr>
                      
           </table>   
                  </form>
               </td>
              </tr>
               <tr bgcolor="FF7101">
                     <td colspan="4" height="25"></td>
                     </tr>
</table>
 
</body>
</html>
 
31、ChangePwd.html
<#assign ww=JspTaglibs["/WEB-INF/webwork.tld"] />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><@ww.property value="%{getText('html.ChangePwd.title')}"/></title>
<link rel="stylesheet" type="text/css" media="screen" href="${req.contextPath}/styles/css.css"/>
<script src="${req.contextPath}/scripts/common.js" type="text/javascript"></script>
<script type="text/javascript">
   function checkChange(){
      var oldpwd=document.getElementById('oldpassword');
            if(oldpwd.value.length<=0){
             setWarningMsg('msg',"<@ww.property value="%{getText('html.ChangePwd.msg.pls.input.old.password')}"/>");
               oldpwd.focus();
               return false;
            }
        
        var pwd=document.getElementById('password');
           if(pwd.value.length<=0){
              setWarningMsg('msg',"<@ww.property value="%{getText('html.ChangePwd.msg.pls.input.new.password')}"/>");
                 pwd.focus();
                 return false;
            }
               
        var pwd2=document.getElementById('password2');
            if(pwd2.value.length<=0){
              setWarningMsg('msg',"<@ww.property value="%{getText('html.ChangePwd.msg.pls.input.new.password.again')}"/>");
                 pwd2.focus();
                 return false;
               }
               
          if(pwd.value!=pwd2.value){
             setWarningMsg('msg',"<@ww.property value="%{getText('html.ChangePwd.error.new.and.old.password.not.the.same')}"/>");
               return false;
          }      
        
   }
</script>
</head>
<body>
<form action="changePwd.jspx" method="post" name="ChangePwdForm" onSubmit="javascript:return checkChange();">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                                           <td id="msg">
                                           <@ww.if test="hasActionMessages()">
                                           <p class="WarningMsg">
                                               <@ww.iterator value="actionMessages">
                                                <@ww.property/><br>
                                               </@ww.iterator>
                                                 </p>
                                                 </@ww.if>
                                           </td>
                                           </tr>
                          <tr bgcolor="FF7101" height="25">
                                           <td><div align="center"><font color="#FFFFFF"><@ww.property value="%{getText('html.ChangePwd.title')}"/></font></div></td>
                                           </tr>
                          <tr>
                            <td height="30" bgcolor="EAEAEA">
                                                
                              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td width="40%"><div align="right"><@ww.property value="%{getText('html.ChangePwd.title.username')}"/>:</div></td>
                                  <td width="23%">${currentUser?default('')}
                                  <input type="hidden" name="userId" value="${currentUser?default('')}"></td>
                                  <td width="32%">&nbsp;</td>
                                  <td width="5%">&nbsp;</td>
                                </tr>
                    
                                                        <tr>
                                  <td><div align="right"><@ww.property value="%{getText('html.ChangePwd.title.old.password')}"/>:</div></td>
                                  <td><input type="password" name="oldpassword"></td>
                                  <td>&nbsp;</td>
                                  <td>&nbsp;</td>
                                </tr>
                                                       
                                                                                                                <tr>
                                  <td><div align="right"><@ww.property value="%{getText('html.ChangePwd.title.new.password')}"/>:</div></td>
                                  <td><input type="password" name="password"></td>
                                  <td>&nbsp;</td>
                                  <td>&nbsp;</td>
                                </tr>
                                                       
                                                        <tr>
                                  <td><div align="right"><@ww.property value="%{getText('html.ChangePwd.title.new.passowrd.again')}"/>:</div></td>
                                  <td><input type="password" name="password2"></td>
                                  <td>&nbsp;</td>
                                  <td>&nbsp;</td>
                                </tr>
                                                                                                                <tr>
                                  <td>&nbsp;</td>
                                  <td><input name="Submit" type="submit" id="Submit" value="<@ww.property value="%{getText('html.ChangePwd.title.change')}"/>"></td>
                                  <td>&nbsp;</td>
                                  <td>&nbsp;</td>
                                </tr>
                                                         
                              </table>     
                           
                            </td>
                             </tr>
                             <tr bgcolor="FF7101">
                     <td colspan="4" height="25"></td>
                     </tr>
                             
                             </table>
          </form>
               </body>
</html>
 
32、IndexFileList.html
<#assign ww=JspTaglibs["/WEB-INF/webwork.tld"] />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><@ww.property value="%{getText('html.IndexFileList.title')}"/></title>
<link rel="stylesheet" type="text/css" media="screen" href="${req.contextPath}/styles/css.css"/>
<script src="${req.contextPath}/scripts/common.js" type="text/javascript"></script>
</head>
 
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
                     <td id="msg">
                     <@ww.if test="hasActionMessages()">
                             <p class="WarningMsg">
                                   <@ww.iterator value="actionMessages">
                                           <@ww.property/><br>
                                           </@ww.iterator>
                            </p>
                     </@ww.if>
                     </td>
                     </tr>
            <tr bgcolor="FF7101" height="25">
                     <td><div align="center"><@ww.property value="%{getText('html.IndexFileList.title')}"/></div></td>
                  </tr>
        <tr>
           <td height="30" bgcolor="EAEAEA">
                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
                     <tr bgcolor="#FFFFFF" height="25">
               <td width="39%">&nbsp;</td>
               <td width="42%">&nbsp;</td>
               <td width="19%"><input type="button" class="go-wenbenkuang" name="Submit" value="<@ww.property value="%{getText('html.IndexFileList.reindex')}"/>" onClick="javascript:window.location.href='${req.contextPath}/Admin/reIndex.jspx';"></td>
             </tr>
             <tr bgcolor="#FFFFFF" height="25">
               <td width="39%"><@ww.property value="%{getText('html.IndexFileList.title.file.name')}"/></td>
               <td width="42%"><@ww.property value="%{getText('html.IndexFileList.title.file.size')}"/></td>
               <td width="19%"><@ww.property value="%{getText('html.IndexFileList.title.file.modify.date')}"/></td>
             </tr>
                      <#if indexFiles?has_content>
                      <#list indexFiles as file>
              <tr height="25">
               <td>${(file.fileName)?default('')}</td>
               <td>${(file.size)?c}B</td>
               <td>${(file.modifyDate)?string("yyyy-MM-dd HH:mm:ss")}</td>
              </tr>
                      </#list>
                      </#if>
           </table>           </td>
              </tr>
</table>
</body>
</html>
 
33、Login.html
<#assign ww=JspTaglibs["/WEB-INF/webwork.tld"] />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><@ww.property value="%{getText('html.Login.title.system')}"/></title>
<link rel="stylesheet" type="text/css" media="screen" href="${req.contextPath}/styles/css.css"/>
<script src="${req.contextPath}/scripts/common.js" type="text/javascript"></script>
<script type="text/javascript">
 function loginCheck(){
   if(document.loginForm.j_username.value.length<=0){
 
        setErrorMsg("msg","<@ww.property value="%{getText('html.Login.msg.not.input.username')}"/>");
        document.loginForm.j_username.focus();
        return false;
   }
 
   if(document.loginForm.j_password.value.length<=0){
     setErrorMsg("msg","<@ww.property value="%{getText('html.Login.msg.not.input.password')}"/>");
        document.loginForm.j_password.focus();
        return false;
   }
 
 }
</script>
</head>
 
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
 
<table align="center" width="100%" height="100%">
 <tr>
 <td>
 <table width="360" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
    <td valign="middle">
      <div align="center">
        <table width="360" height="290" border="0" cellpadding="0" cellspacing="1" bgcolor="#E7E7E7">
          <tr>
            <td height="290" valign="top" bgcolor="#FFFFFF"> <table width="360" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="360">
                             <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="2" bgcolor="FFA600"><img src="${req.contextPath}/images/help/spacer.gif" width="1" height="1"></td>
                      </tr>
                      <tr>
                        <td height="22" bgcolor="FF9201" class="w2">&nbsp;</td>
                      </tr>
                      <tr>
                        <td height="5" bgcolor="FF7900"><img src="${req.contextPath}/images/help/spacer.gif" width="1" height="1"></td>
                      </tr>
                    </table>
                                   </td>
                </tr>
                            <tr >
                            <td ><img src="${req.contextPath}/images/help/title_login_2.gif" width="137" height="52"></td>
                            </tr>
 
                            <tr>
                     <td id="msg" height="10" colspan="3">
                                    <@ww.if test="hasActionMessages()">
                                           <p class="ErrorMsg">
                                               <@ww.iterator value="actionMessages">
                                               <@ww.property/><br>
                                               </@ww.iterator>
                                           </p>
                                   </@ww.if>
                                    </td></tr>
                <tr>
                  <td> <form name="loginForm" method="post" action="j_security_check" onSubmit="javascript:return loginCheck();">
                      <table width="100%" height="158" border="0" cellpadding="0" cellspacing="0">
                                     
                        <tr>
                          <td >
                                           <table width="350" border="0" align="center" cellpadding="0" cellspacing="0">
                              <tr>
                                <td width="40" height="33" class="w14"><img src="${req.contextPath}/images/help/username.jpg" width="32" height="32">                                  </td>
                                <td width="60" class="w14"><div align="center"><strong><@ww.property value="%{getText('html.Login.title.username')}"/>:</strong></div></td>
                                <td width="250"> <input name="j_username" type="text" value="admin" size="30" maxlength="20"></td>
                              </tr>
                                                    <tr>
                                <td height="10" colspan="3" class="w14"></td>
                              </tr>
                              <tr>
                                <td height="33" class="w14"><img src="${req.contextPath}/images/help/password.jpg" width="32" height="32"></td>
                                                        <td height="33" class="w14">
                                  <div align="center"><strong><@ww.property value="%{getText('html.Login.title.passowrd')}"/>:</strong></div></td>
                                <td> <input name="j_password" type="password" value="admin" size="32" maxlength="20"></td>
                              </tr>
 
                                                    <tr>
                                <td height="10" colspan="3">&nbsp;</td>
                              </tr>
 
                              <tr>
                                <td height="30" colspan="3">
                                                         
                                                           <div align="center">
                                                             <input name="submit" type="submit" class="go-wenbenkuang" value="<@ww.property value="%{getText('html.Login.title.submit')}"/>">
                                                              </div></td>
                              </tr>
                            </table></td>
                        </tr>
                      </table>
                                                      <script type="text/javascript">
                                                        document.getElementById('j_username').focus();
                                                        </script>
                    </form>
                             </td>
                </tr>
              </table></td>
          </tr>
        </table>
      </div>
      </td>
 </tr>
</table>
 </td>
 </tr>
</table>
 
 
</body>
</html>
 
34、logSuccess.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Success</title>
</head>
 
<body>
</body>
</html>
 
35、Main.html
<#assign ww=JspTaglibs["/WEB-INF/webwork.tld"] />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><@ww.property value="%{getText('html.Main.title.help.center')}"/></title>
</head>
<frameset rows="84,*" cols="*" framespacing="0" frameborder="no" border="0">
 <frame src="top.jspx" name="topFrame" frameborder="no" scrolling="NO" noresize title="topFrame" >
 <frameset rows="*" cols="160,*" framespacing="0" frameborder="no" border="0">
    <frame src="menu.jspx" name="leftFrame" scrolling="no" noresize title="leftFrame">
    <frame src="logSuccess.jspx" name="mainFrame" scrolling="auto" title="mainFrame">
 </frameset>
</frameset>
<noframes><body>
</body></noframes>
</html>
 
36、Menu.html
<#assign ww=JspTaglibs["/WEB-INF/webwork.tld"] />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><@ww.property value="%{getText('html.Menu.admin.title.menu')}"/></title>
<link rel="stylesheet" type="text/css" media="screen" href="${req.contextPath}/styles/css.css"/>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="5" bgcolor="E0E0E0"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
        </tr>
        <tr>
          <td height="39" valign="middle" background="${req.contextPath}/images/help/help_7.jpg"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
              <tr>
                <td width="25">&nbsp;</td>
                <td height="30" class="w16">
                 
                  <font color="#FFFFFF"><@ww.property value="%{getText('html.Menu.admin.title.menu')}"/></font></td>
              </tr>
            </table></td>
        </tr>
        <tr>
          <td valign="top" bgcolor="f3f3f3" class="td"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td valign="top" onmouseover="this.bgColor='F8F8F8';"
        onmouseout="this.bgColor='#ffffff';" bgColor=#ffffff> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
                          <tr>
                            <td width="20">&nbsp;</td>
                            <td width="20" height="30"> <div align="center"><img src="${req.contextPath}/images/help/help_6.jpg" width="11" height="11"></div></td>
                            <td> <a href="${req.contextPath}/Admin/questionListInput.jspx" target="mainFrame"><@ww.property value="%{getText('html.Menu.admin.item.question.manager')}"/></a></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td valign="top" bgcolor="f3f3f3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" onmouseover="this.bgColor='#F8F8F8';"
        onmouseout="this.bgColor='#ffffff';" bgColor=#ffffff>
                          <tr>
                            <td width="20">&nbsp;</td>
                            <td width="20" height="30"> <div align="center"><img src="${req.contextPath}/images/help/help_6.jpg" width="11" height="11"></div></td>
                            <td><a href="${req.contextPath}/Admin/catalogList.jspx" target="mainFrame"><@ww.property value="%{getText('html.Menu.admin.item.catalog.manager')}"/></a></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td valign="top" bgcolor="f3f3f3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" onmouseover="this.bgColor='#F8F8F8';"
        onmouseout="this.bgColor='#ffffff';" bgColor=#ffffff>
                          <tr>
                            <td width="20">&nbsp;</td>
                            <td width="20" height="30"> <div align="center"><img src="${req.contextPath}/images/help/help_6.jpg" width="11" height="11"></div></td>
                            <td><a href="${req.contextPath}/Admin/indexList.jspx" target="mainFrame"><@ww.property value="%{getText('html.Menu.admin.item.index.manager')}"/></a></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td valign="top" bgcolor="f3f3f3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" onmouseover="this.bgColor='#F8F8F8';"
        onmouseout="this.bgColor='#ffffff';" bgColor=#ffffff>
                          <tr>
                            <td width="20">&nbsp;</td>
                            <td width="20" height="30"> <div align="center"><img src="${req.contextPath}/images/help/help_6.jpg" width="11" height="11"></div></td>
                            <td><a href="${req.contextPath}/Admin/changePwdInput.jspx" target="mainFrame"><@ww.property value="%{getText('html.Menu.admin.item.user.manager')}"/></a></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td valign="top" bgcolor="f3f3f3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" onmouseover="this.bgColor='#F8F8F8';"
        onmouseout="this.bgColor='#ffffff';" bgColor=#ffffff>
                          <tr>
                            <td width="20">&nbsp;</td>
                            <td width="20" height="30"> <div align="center"></div></td>
                            <td></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td valign="top" bgcolor="f3f3f3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" onmouseover="this.bgColor='#F8F8F8';"
        onmouseout="this.bgColor='#ffffff';" bgColor=#ffffff>
                          <tr>
                            <td width="20">&nbsp;</td>
                            <td width="20" height="30"> <div align="center"></div></td>
                            <td></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td valign="top" bgcolor="f3f3f3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" onmouseover="this.bgColor='#F8F8F8';"
        onmouseout="this.bgColor='#ffffff';" bgColor=#ffffff>
                          <tr>
                            <td width="20">&nbsp;</td>
                            <td width="20" height="30"> <div align="center"></div></td>
                            <td></a></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td valign="top" bgcolor="f3f3f3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" onmouseover="this.bgColor='#F8F8F8';"
        onmouseout="this.bgColor='#ffffff';" bgColor=#ffffff>
                          <tr>
                            <td width="20">&nbsp;</td>
                            <td width="20" height="30"> <div align="center"></div></td>
                            <td></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td valign="top" bgcolor="f3f3f3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" onmouseover="this.bgColor='#F8F8F8';"
        onmouseout="this.bgColor='#ffffff';" bgColor=#ffffff>
                          <tr>
                            <td width="20">&nbsp;</td>
                            <td width="20" height="30"> <div align="center"></div></td>
                            <td></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td valign="top" bgcolor="f3f3f3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" onmouseover="this.bgColor='#F8F8F8';"
        onmouseout="this.bgColor='#ffffff';" bgColor=#ffffff>
                          <tr>
                            <td width="20">&nbsp;</td>
                            <td width="20" height="30"> <div align="center"></div></td>
                            <td></td>
                          </tr>
                        </table></td>
                    </tr>
                    <tr>
                      <td valign="top" bgcolor="f3f3f3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" onmouseover="this.bgColor='#F8F8F8';"
        onmouseout="this.bgColor='#ffffff';" bgColor=#ffffff>
                          <tr>
                            <td width="20">&nbsp;</td>
                            <td width="20" height="30"> <div align="center"></div></td>
                            <td></td>
                          </tr>
                        </table></td>
                    </tr>
                                                       <tr>
                      <td valign="top" bgcolor="f3f3f3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" onmouseover="this.bgColor='#F8F8F8';"
        onmouseout="this.bgColor='#ffffff';" bgColor=#ffffff>
                          <tr>
                            <td width="20">&nbsp;</td>
                            <td width="20" height="30"> <div align="center"></div></td>
                            <td></td>
                          </tr>
                        </table></td>
                    </tr>
                                                       <tr>
                      <td valign="top" bgcolor="f3f3f3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" onmouseover="this.bgColor='#F8F8F8';"
        onmouseout="this.bgColor='#ffffff';" bgColor=#ffffff>
                          <tr>
                            <td width="20">&nbsp;</td>
                            <td width="20" height="30"> <div align="center"></div></td>
                            <td></td>
                          </tr>
                        </table></td>
                    </tr>
                                    <tr>
                      <td valign="top" bgcolor="f3f3f3"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" onmouseover="this.bgColor='#F8F8F8';"
        onmouseout="this.bgColor='#ffffff';" bgColor=#ffffff>
                          <tr>
                            <td width="20">&nbsp;</td>
                            <td width="20" height="30"> <div align="center"></div></td>
                            <td></td>
                          </tr>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
            </table></td>
        </tr>
      </table>
</body>
</html>
 
37、Question.html
<#assign ww=JspTaglibs["/WEB-INF/webwork.tld"] />
<#assign page=JspTaglibs["/WEB-INF/page.tld"] />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><@ww.property value="%{getText('html.Question.title')}"/></title>
<link rel="stylesheet" type="text/css" media="screen" href="${req.contextPath}/styles/css.css"/>
<script src="${req.contextPath}/scripts/common.js" type="text/javascript"></script>
<script type="text/javascript">
 var catalogId="${catalogId?default('')}";
 
 var replyStatus="${replyStatus?default('')}";
 
 function check(){
 
 if(catalogId.length<=0){
    catalogId=document.getElementById('catalogId').value;
 }
 
 if(replyStatus.length<=0){
   replyStatus=document.getElementById('replyStatus').value;
 }
 
 }
 
 function addQuestion(){
    check();
       if(catalogId.length<=0){
        setErrorMsg("msg","<@ww.property value="%{getText('html.Question.title.not.set.catalog')}"/>");
        return;
       }
       var action="${req.contextPath}/Admin/questionAddInput.jspx?catalogId="+catalogId+"&replyStatus="+replyStatus;
       window.location.href=action;
 }
 
 function editQuestion(questionId){
    check();
    var action="${req.contextPath}/Admin/questionEditInput.jspx?catalogId="+catalogId+"&questionId="+questionId+"&replyStatus="+replyStatus;
       window.location.href=action;
 }
 
 function deleteQuestion(questionId){
 if(confirm("<@ww.property value="%{getText('html.common.title.delete.confirm')}"/>")){
    var action="${req.contextPath}/Admin/questionDelete.jspx?catalogId="+catalogId+"&questionId="+questionId+"&replyStatus="+replyStatus;
       window.location.href=action;
       }
 }
 
</script>
</head>
<body>
<@page.page action="questionList.jspx" total="${total?default('0')?c}">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
                     <td id="msg">
                     <@ww.if test="hasActionMessages()">
                             <p class="WarningMsg">
                                   <@ww.iterator value="actionMessages">
                                           <@ww.property/><br>
                                   </@ww.iterator>
                             </p>
                     </@ww.if>
                     </td>
                     </tr>
            
              </tr>
        <tr>
           <td height="30" bgcolor="EAEAEA">
                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
                 <tr bgcolor="FF7101">
                     <td colspan="4" height="25"><div align="center"><font color="#FFFFFF"><@ww.property value="%{getText('html.Question.title.list')}"/></font></div></td>
                     </tr>
                     <tr bgcolor="FFFFFF">
                      <td colspan="4" >
                      
                      <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>    
                       <td width="22%" ><@ww.property value="%{getText('html.common.title.catalog')}"/>                       </td>
                       <td width="21%" >
                                      <select name="catalogId">
                                      <#if catalogList?has_content>
                                        <#list catalogList as catalog>
                                             <option value="${(catalog.id)?default('')}">==${(catalog.title)?default('')}==</option>
                                           </#list>
                                      </#if>
                       </select>                       </td>
                       <td width="13%" ><@ww.property value="%{getText('html.Question.title.reply.status')}"/>:</td>
                       <td width="18%" >
                                      <select name="replyStatus">
                                           <option value="">==<@ww.property value="%{getText('html.Question.title.reply.status.pls.select')}"/>==</option>
                                           <option value="0">==<@ww.property value="%{getText('html.Question.title.reply.status.has.not.replied')}"/>==</option>
                                           <option value="1">==<@ww.property value="%{getText('html.Question.title.reply.status.has.replied')}"/>==</option>
                       </select>
                       </td>
                      <td width="26%" ><input type="submit" class="go-wenbenkuang" name="Submit" value="<@ww.property value="%{getText('html.common.title.search')}"/>">&nbsp;&nbsp;&nbsp;&nbsp;
                       <input type="button" name="Submit2" class="go-wenbenkuang" value="<@ww.property value="%{getText('html.common.title.add')}"/>" onClick="javascript:addQuestion();"></td>
                    </tr>
              </table>
                      
                      
                      </td>
                     </tr>
                     <tr bgcolor="#FFFFFF">
                      <td colspan="4">&nbsp;</td>
                      </tr>
                      <#if helpAQList?has_content>
                      <tr bgcolor="#FFFFFF">
                      <td colspan="4"><DIV align="center">
                         <@page.navigator style="text"/>
                         </DIV></td>
                      </tr>
             <tr bgcolor="#FFFFFF" height="20">
               <td width="17%"><@ww.property value="%{getText('html.Question.title.quesion.id')}"/></td>
               <td width="42%"><@ww.property value="%{getText('html.common.title.question.title')}"/></td>
               <td width="26%"><@ww.property value="%{getText('html.Question.title.reply.status')}"/></td>
               <td width="15%"><@ww.property value="%{getText('html.common.title.operate')}"/></td>
             </tr>
                    
                        <#list helpAQList as helpAQ>
             <tr>
               <td>${(helpAQ.id)?default('')}</td>
               <td>${(helpAQ.subject)?default('')}</td>
               <td><#if helpAQ.isAnswered=='1'><@ww.property value="%{getText('html.Question.title.reply.status.has.replied')}"/><#else><@ww.property value="%{getText('html.Question.title.reply.status.has.not.replied')}"/></#if></td>
               <td>[<a href="javascript:editQuestion('${(helpAQ.id)?default('')}');">
               <@ww.property value="%{getText('html.common.title.edit')}"/>
               </a>]&nbsp;&nbsp;[
               <a href="javascript:deleteQuestion('${(helpAQ.id)?default('')}');">
               <@ww.property value="%{getText('html.common.title.delete')}"/>
               </a>]</td>
             </tr>
                      </#list>
                    
                     <tr bgcolor="#FFFFFF">
                      <td colspan="4"><DIV align="center">
                         <@page.navigator style="text"/>
                         </DIV></td>
                      </tr>
                      </#if>
                                      <tr bgcolor="FF7101">
                     <td colspan="4" height="25">&nbsp;</td>
                     </tr>
           </table>          
                 </td>
              </tr>
</table>
</@page.page>
<script type="text/javascript">
var curCatalogId="${catalogId?default('')}";
var curStatus="${replyStatus?default('')}";
function initSelect(){//start if
 
var arrary=document.getElementById('catalogId').options;
if(curCatalogId.length>0){//start if1
 for(var i=0;i<arrary.length;i++){//start for
    if(curCatalogId==arrary[i].value){//start if
       document.getElementById('catalogId').selectedIndex=i;
          break;
    }//end if
 }//end for
}//end if1
 
if(curStatus.length>0){ //start if1
   arrary=document.getElementById('replyStatus').options;
   for(var i=0;i<arrary.length;i++){//start for
     if(curStatus==arrary[i].value){//start if
       document.getElementById('replyStatus').selectedIndex=i;
          break;
     }//end if
   }//end for
}//end if1
 
}
initSelect();
</script>
</body>
</html>
 
38、QuestionAdd.html
<#assign ww=JspTaglibs["/WEB-INF/webwork.tld"] />
<#assign FCK=JspTaglibs["/WEB-INF/FCKeditor.tld"] />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><@ww.property value="%{getText('html.QuestionAdd.title')}"/></title>
<link rel="stylesheet" type="text/css" media="screen" href="${req.contextPath}/styles/css.css"/>
<script src="${req.contextPath}/scripts/common.js" type="text/javascript"></script>
<script type="text/javascript">
 
 function checkAddQuestion(){
   var object=document.getElementById('subject');
   if(object.value.length<=0){
     setErrorMsg("msg","<@ww.property value="%{getText('html.QuestionAdd.msg.pls.input.subject')}"/>");
     object.focus();
        return false;
   }
 }
 
 function backToList(){
    var catalogId=document.getElementById('catalogId').value;
       var replyStatus=document.getElementById('replyStatus').value;
    var action ="${req.contextPath}/Admin/questionList.jspx?catalogId="+catalogId+"&replyStatus="+replyStatus;
       window.location.href=action;
 }
 
</script>
</head>
 
<body>
<form name="addQuestionForm" action="${req.contextPath}/Admin/questionAdd.jspx" method="post" onSubmit="javascript:return checkAddQuestion();">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
                     <td colspan="2" id="msg">
                     <@ww.if test="hasActionMessages()">
                             <p class="WarningMsg">
                                   <@ww.iterator value="actionMessages">
                                           <@ww.property/><br>
                                </@ww.iterator>
                            </p>
                     </@ww.if>                   </td>
                     </tr>
            <tr bgcolor="FF7101">
                      <td colspan="2" height="25">
                      <div align="center"><font color="#FFFFFF"><@ww.property value="%{getText('html.QuestionAdd.title')}"/></font></div>                                </td>
                  </tr>
               <tr>
          <td width="7%" height="30" bgcolor="EAEAEA"><@ww.property value="%{getText('html.common.title.catalog')}"/>:</td>
              <td width="93%" bgcolor="EAEAEA">
                            <select name="catalogId">
                                      <#if catalogList?has_content>
                                        <#list catalogList as catalog>
                                             <option value="${(catalog.id)?default('')}">==${(catalog.title)?default('')}==</option>
                                           </#list>
                                      </#if>
                       </select>
               </td>
        </tr>      
        <tr>
          <td width="7%" height="30" bgcolor="EAEAEA"><@ww.property value="%{getText('html.common.title.question.title')}"/>:</td>
              <td width="93%" bgcolor="EAEAEA"><input name="subject" type="text" size="80"></td>
        </tr>
           <tr>
             <td height="30" bgcolor="EAEAEA"><@ww.property value="%{getText('html.common.title.question.content')}"/>:</td>
             <td height="30" bgcolor="EAEAEA">
               <@FCK.editor id="answer" basePath="${req.contextPath}/FCKeditor/"
                            height="500"
                            imageBrowserURL="${req.contextPath}/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
                            linkBrowserURL="${req.contextPath}/FCKeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"
                            flashBrowserURL="${req.contextPath}/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"
                            imageUploadURL="${req.contextPath}/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Image"
                            linkUploadURL="${req.contextPath}/FCKeditor/editor/filemanager/upload/simpleuploader?Type=File"
                            flashUploadURL="${req.contextPath}/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Flash">          
               </@FCK.editor>  
               </td>
        </tr>
           <tr>
          <td height="30" bgcolor="EAEAEA" colspan="2" align="center">
                             <input type="submit" class="go-wenbenkuang" name="Submit" value="<@ww.property value="%{getText('html.common.title.add')}"/>">&nbsp;&nbsp;&nbsp;&nbsp;
                  <input type="button" class="go-wenbenkuang" name="Submit2" value="<@ww.property value="%{getText('html.common.title.return')}"/>" onClick="javascript:backToList();">
                  <input type="hidden" name="replyStatus" value="${replyStatus?default('')}"></td>
      </tr>
        <tr bgcolor="FF7101">
        <td colspan="2">&nbsp;     </td>
        </tr>
</table>
</form>
<script type="text/javascript">
var curCatalogId="${catalogId?default('')}";
 
var arrary=document.getElementById('catalogId').options;
if(curCatalogId.length>0){//start if1
 for(var i=0;i<arrary.length;i++){//start for
    if(curCatalogId==arrary[i].value){//start if
       document.getElementById('catalogId').selectedIndex=i;
          break;
    }//end if
 }//end for
}//end if1
 
</script>
</body>
</html>
 
39、QuestionEdit.html
<#assign ww=JspTaglibs["/WEB-INF/webwork.tld"] />
<#assign FCK=JspTaglibs["/WEB-INF/FCKeditor.tld"] />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><@ww.property value="%{getText('html.QuestionUpdate.title')}"/></title>
<link rel="stylesheet" type="text/css" media="screen" href="${req.contextPath}/styles/css.css"/>
<script src="${req.contextPath}/scripts/common.js" type="text/javascript"></script>
<script type="text/javascript">
 
 function checkUpdateQuestion(){
   var object=document.getElementById('subject');
   if(object.value.length<=0){
     setErrorMsg("msg","<@ww.property value="%{getText('html.QuestionAdd.msg.pls.input.subject')}"/>");
     object.focus();
        return false;
   }
 }
 
 function backToList(){
    var catalogId=document.getElementById('catalogId').value;
       var replyStatus=document.getElementById('replyStatus').value;
    var action ="${req.contextPath}/Admin/questionList.jspx?catalogId="+catalogId+"&replyStatus="+replyStatus;
       window.location.href=action;
 }
</script>
</head>
 
<body>
<form name="editQuestionForm" action="${req.contextPath}/Admin/questionEdit.jspx" method="post" onSubmit="javascript:checkUpdateQuestion();">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
                     <td colspan="2" id="msg">
                     <@ww.if test="hasActionMessages()">
                             <p class="WarningMsg">
                                   <@ww.iterator value="actionMessages">
                                           <@ww.property/><br>
                                </@ww.iterator>
                            </p>
                     </@ww.if>                   </td>
                     </tr>
            <tr bgcolor="FF7101" height="25">
                      <td colspan="2">
                      <div align="center"><font color="#FFFFFF"><@ww.property value="%{getText('html.QuestionUpdate.title')}"/></font></div>                      </td>
                  </tr>
        <tr>
          <td width="7%" height="30" bgcolor="EAEAEA"><@ww.property value="%{getText('html.common.title.question.title')}"/>:</td>
          <td width="93%" bgcolor="EAEAEA"><input name="subject" type="text" size="80" value="${(helpAQ.subject)?default('')}"></td>
       </tr>
           <tr>
             <td height="30" bgcolor="EAEAEA"><@ww.property value="%{getText('html.common.title.question.content')}"/>:</td>
             <td height="30" bgcolor="EAEAEA">
               <@FCK.editor id="answer" basePath="${req.contextPath}/FCKeditor/"
                            height="500"
                            imageBrowserURL="${req.contextPath}/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
                            linkBrowserURL="${req.contextPath}/FCKeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"
                            flashBrowserURL="${req.contextPath}/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"
                            imageUploadURL="${req.contextPath}/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Image"
                            linkUploadURL="${req.contextPath}/FCKeditor/editor/filemanager/upload/simpleuploader?Type=File"
                            flashUploadURL="${req.contextPath}/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Flash"> 
                            ${(helpAQ.answer)?default('')}        
               </@FCK.editor>  
               </td>
        </tr>
           <tr>
          <td height="30" bgcolor="EAEAEA" colspan="2" align="center">
                  <input type="submit" class="go-wenbenkuang" name="Submit" value="<@ww.property value="%{getText('html.common.title.save')}"/>">&nbsp;&nbsp;&nbsp;&nbsp;
                  <input type="button" class="go-wenbenkuang" name="Submit2" value="<@ww.property value="%{getText('html.common.title.return')}"/>" onClick="javascript:backToList();">
                     <input type="hidden" name="catalogId" value="${catalogId?default('')}">
                  <input type="hidden" name="replyStatus" value="${replyStatus?default('')}">
                  <input type="hidden" name="questionId" value="${questionId?default()}">
               </td>
      </tr>
        <tr bgcolor="FF7101">
        <td colspan="2">&nbsp;     </td>
        </tr>
</table>
</form>
</body>
</html>
 
40、Top.html
<#assign ww=JspTaglibs["/WEB-INF/webwork.tld"] />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Top</title>
<link rel="stylesheet" type="text/css" media="screen" href="${req.contextPath}/styles/css.css"/>
</head>
<body>
<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0>
 <TBODY>
 
 <TR>
    <TD width=193 height=60><IMG height=64 alt=本系统图标 src="${req.contextPath}/images/help/help_9.jpg"
      width=194 border=0></TD>
    <TD vAlign=top width="100%">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">                   
                    <tr bgcolor="#F3F3F3">
                      <td>
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td height="30" >
                                                
                                                 <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                                                
                                <tr>
                                  <td width="267" rowspan="2"></td>
                                  <td width="2" onmouseover="this.bgColor='#f3f3f3';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="133" rowspan="2" onmouseover="this.bgColor='#f3f3f3';"></td>
                                  <td width="134" rowspan="2" onmouseover="this.bgColor='#f3f3f3';"><@ww.property value="%{getText('html.Top.admin.title.current.user')}"/>:${currentUser?default('')}</td>
                                  <td width="2" onmouseover="this.bgColor='#f3f3f3';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="134" rowspan="2"  onmouseover="this.bgColor='#f3f3f3';">
                                                         
                                                                      <SCRIPT language=JavaScript>
 
   today=new Date();
   function initArray(){
        this.length=initArray.arguments.length
        for(var i=0;i<this.length;i++)
        this[i+1]=initArray.arguments[i] }
 
 var d=new initArray("<font color=RED>星期日","<font color=black>星期一","<font color=black>星期二","<font color=black>星期三","<font color=black>星期四","<font color=black>星期五","<font color=GREEN>星期六");
 
 document.write(today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日",d[today.getDay()+1]);
 
 
</SCRIPT>
                                                         
                                                         </td>
                                  <td width="134" rowspan="2" onmouseover="this.bgColor='#f3f3f3';"><div align="right"><img src="${req.contextPath}/images/help/logout.gif" width="16" height="16"><a href="${request.contextPath}/logout.jspx" target="_parent"><@ww.property value="%{getText('html.Top.admin.title.logout')}"/></a></div></td>
                                  <td width="1" onmouseover="this.bgColor='#f3f3f3';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                </tr>
                              </table>
                                                
                                              </td>
                          </tr>
                        </table>
                                    </td>
                    </tr>
                                   <tr bgcolor="#F3F3F3">
                      <td>&nbsp;
                                    
                                    </td>
                                   </tr>
                               <tr bgcolor="#F3F3F3">
                      <td height="19">&nbsp;                                 </td>
               </tr>
                                  
        </table>
     </TD></TR>
        
   <TR bgcolor="FF7101">
       <TD height="4" colspan="15" ><img src="<%=request.getContextPath()%>/images/spacer.gif" width="1" height="1"></td>
   </TR>            
 </TBODY></TABLE>
</body>
</html>
 
41、UserMan.html
 
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>UserMan</title>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td height="30" bgcolor="EAEAEA"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                                <tr>
                                  <td width="90" height="30" rowspan="2" bgColor=#EAEAEA onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"> <div align="center"><strong></strong><a href="#"></a></div></td>
 
                                  <td width="1" height="15" onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="90" rowspan="2" bgColor=#EAEAEA onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><div align="center"><strong><font color="d0000a" size="4">
                                  </font></strong></div></td>
                                  <td width="1" onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="90" rowspan="2" bgColor=#EAEAEA onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><div align="center"><strong><font color="d0000a" size="4">
                                  </font></strong></div></td>
                                  <td width="1" onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="90" rowspan="2" bgColor=#EAEAEA onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><div align="center"><strong></strong></div></td>
                                  <td width="1" onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="90" rowspan="2" bgColor=#EAEAEA onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><div align="center"></div></td>
                                  <td width="1" onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="90" rowspan="2" bgColor=#EAEAEA onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><div align="center"></div></td>
                                  <td width="1" onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="90" rowspan="2" bgColor=#EAEAEA onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><div align="center"></div></td>
                                  <td width="1" onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="124" rowspan="2" bgColor=#EAEAEA onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><div align="center"><a href="#"></a></div></td>
                                </tr>
                                <tr>
                                  <td width="1" bgColor=d0000a onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="1" height="15" bgColor=d0000a onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="1" bgColor=d0000a onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="1" bgColor=d0000a onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="1" bgColor=d0000a onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="1" bgColor=d0000a onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="1" bgColor=d0000a onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                </tr>
                                <tr bgcolor="FF7101">
                                  <td height="4" colspan="15" ><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                </tr>
                              </table>
                                                  
                              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td width="40%"><div align="right">用户名:</div></td>
                                  <td width="23%">&nbsp;</td>
                                  <td width="32%">&nbsp;</td>
                                  <td width="5%">&nbsp;</td>
                                </tr>
                    
                                                        <tr>
                                  <td><div align="right">旧密码:</div></td>
                                  <td><input type="password" name="password"></td>
                                  <td>&nbsp;</td>
                                  <td>&nbsp;</td>
                                </tr>
                                                       
                                                                                                                <tr>
                                  <td><div align="right">新密码:</div></td>
                                  <td><input type="password" name="password2"></td>
                                  <td>&nbsp;</td>
                                  <td>&nbsp;</td>
                                </tr>
                                                                                                                <tr>
                                  <td>&nbsp;</td>
                                  <td><input name="Submit" type="submit" id="Submit" value="修改"></td>
                                  <td>&nbsp;</td>
                                  <td>&nbsp;</td>
                                </tr>
                              </table>       
         
               </body>
</html>
 
 
42、CatalogBar.html
<#if catalogList?has_content>
              <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                            <#list catalogList as catalog>
                                   <#if catalog_index%8==0>
                         <tr>
                                   </#if>
                         <td height="25" width="13%" bgColor=#EAEAEA onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';">
                              <div align="center">
                                          <a href="${req.contextPath}/search.jspx?catalogId=${(catalog.id)?default('')}">
                                          <strong>${(catalog.title)?default('')}</strong>
                                          </a>
                                          </div>
                               </td>
                                 <#if catalog_has_next==false >
                                                 <#assign x= 7-(catalog_index%8)>
                                                  <#if x!=0 >
                                                    <#list 1..x as i>
                                                    <td>&nbsp;</td>
                                                    </#list>
                                                  </#if>
                         </tr>
                                    <#elseif catalog_has_next==true && catalog_index%8==7>
                                           </tr>
                                    </#if>
                            </#list>
                             <tr bgcolor="FF7101">
                     <td height="1" colspan="8">
                                          <img src="${req.contextPath}/images/Help/spacer.gif" width="1" height="1">
                                   </td>
                 </tr>
         </table>                                          
</#if>
 
 
43、Content.html
<#assign ww=JspTaglibs["/WEB-INF/webwork.tld"] />
<TABLE width="97%"
border=0 align="center" cellPadding=0 cellSpacing=0 style="BORDER-COLLAPSE: collapse">
        <TBODY>
          <TR>
            <TD vAlign=top width=728>
              <#if helpAQList?has_content>
                      <#list helpAQList as helpAQ>
              <A id=${(helpAQ.id)?default('')} name=${(helpAQ.id)?default('')}><BR></A>
                      <SPAN class=m-4><FONT id=f4><STRONG>
                      ·${(helpAQ.subject)?default('')}</STRONG></FONT> </SPAN><BR> <HR color=#e1deca noShade SIZE=1>
               ${(helpAQ.answer)?default('')}<BR>
              <DIV align=right>
                        <a href="#">
                       <img height=17 src="${req.contextPath}/images/help/Help_GotoTop.gif" width=60 border=0>
                        </a>
                      </DIV>
                      </#list>          
                      </#if>
              </TD>
          </TR>
        </TBODY>
      </TABLE>
44、Help.html
<#import "HelpMacro.html" as Help >
<#assign ww=JspTaglibs["/WEB-INF/webwork.tld"] />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><@ww.property value="%{getText('html.Help.title')}"/></title>
<link rel="stylesheet" type="text/css" media="screen"  href="${req.contextPath}/styles/css.css"/>
<script src="${req.contextPath}/scripts/common.js" type="text/javascript"></script>
<script type="text/javascript">
function searchCheck(){
 if(document.getElementById('keyWord').value.length<=0){
    setErrorMsg("msg","<@ww.property value="%{getText('html.Help.not.input.keyword')}"/>");
       document.getElementById('keyWord').focus();
    return false;
 }
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
 
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
    <td >&nbsp;</td>
 </tr>
 <tr>
    <td>&nbsp;</td>
 </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
    <td width="220" valign="top">
       <!--帮助菜单-->
    <@Help.Menu menuTitle="${menuTitle?default('')}"/>
       </td>
    <td valign="top">
       <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td >
               
                     <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td>
                                    
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="12">&nbsp;</td>
                            <td width="763">
                                                 <!--查询工具条-->      
                                                 <@Help.SearchBar />                                      
                                                 </td>
                          </tr>
                                           <tr>
                                           <td></td>
                                           <td id="msg">
                                           <@ww.if test="hasActionMessages()">
                                       <p class="WarningMsg">
                                           <@ww.iterator value="actionMessages">
                                                <@ww.property/><br>
                                           </@ww.iterator>
                                      </p>
                                  </@ww.if>
                                           </td></tr>
                        </table>
                                         
                                    </td>
                    </tr>
 
                    <tr>
                      <td>
                                    
                                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td bgcolor="EAEAEA">
                                          <!--类别分类条-->
                                          <@Help.CatalogBar />
                                          </td>
                          </tr>
                        </table>
                                         
                                    </td>
                    </tr>
            </table>
                      
               </td>
        </tr>
    </table>
        <!--帮助内容列表-->
             <@Help.Content />
    </td>
 </tr>
</table>
 
</body>
</html>
 
45、HelpMacro.html
<#macro Menu menuTitle>
 <#include "Menu.html">
</#macro>
 
<#macro SearchBar>
 <#include "SearchBar.html">
</#macro>
 
<#macro CatalogBar>
 <#include "CatalogBar.html">
</#macro>
 
<#macro Content>
 <#include "Content.html">
</#macro>
 
46、Menu.html
<table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="239"><img src="${req.contextPath}/images/help/help_5.jpg" width="239" height="90"></td>
        </tr>
        <tr>
          <td height="5" bgcolor="E0E0E0"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
        </tr>
        <tr>
          <td height="39" valign="middle" background="${req.contextPath}/images/help/help_7.jpg"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
              <tr>
                <td width="25">&nbsp;</td>
                <td height="30" class="w16">
                  <div align="center"></div>
                 <font color="#FFFFFF">${menuTitle?default('')}</font></td>
              </tr>
            </table></td>
        </tr>
        <tr>
          <td valign="top" bgcolor="f3f3f3" class="td">
               
               <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    
               <tr>
                <td>
                            <#if helpAQList?has_content>
                            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                               <#list helpAQList as helpAQ>
                    <tr>
                      <td valign="top" onmouseover="this.bgColor='F8F8F8';"
        onmouseout="this.bgColor='#ffffff';" bgColor=#ffffff>
              <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" >
                          <tr>
                            <td width="20">&nbsp;</td>
                            <td width="20" height="30"> <div align="center"><img src="${req.contextPath}/images/help/help_6.jpg" width="11" height="11"></div></td>
                            <td> <a href="#${(helpAQ.id)?default('')}">${(helpAQ.subject)?default('')}</a></td>
                          </tr>
         </table></td>
                   </tr>
                               </#list>
                  </table>
                               </#if>
                             </td>
               </tr>
          </table>
                   
               </td>
        </tr>
      </table>
 
47、SearchBar.html
 
<form name="searchForm" action="${req.contextPath}/search.jspx" method="post" onSubmit="javascript:return searchCheck();">
                                                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td width="20"><div align="right"><img src="${req.contextPath}/images/help/help_8.jpg" width="9" height="24"></div></td>
                                  <td width="80" height="24" bgcolor="d0000a">
                                    <div align="center"><font color="#FFFFFF"><@ww.property value="%{getText('html.Top.help.title.help.search')}"/></font></div></td>
                                  <td width="241" bgcolor="f3f3f3"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
                                      <tr>
                                        <td><input name="keyWord" type="text" class="biaodian" onFocus="javascript:this.select();" value="${keyWord?default('')}" size="50"></td>
                                      </tr>
                                    </table></td>
                                  <td width="53" bgcolor="f3f3f3"><input name="Submit" type="submit" class="go-wenbenkuang" value="<@ww.property value="%{getText('html.common.title.search')}"/>"></td>
                                  <td width="161" bgcolor="f3f3f3"><div align="center">
                                    <input type="button" name="Submit2" class="go-wenbenkuang" value="<@ww.property value="%{getText('html.Top.help.title.manager')}"/>" onClick="javascript:window.location.href='${req.contextPath}/login.jspx'">
                                  </div></td>
                                </tr>
                            </table>
                            <script type="text/javascript">
                             
                                   var keyWord="${keyWord?default('')}";
                                   if(keyWord.length<=0){
                                   document.getElementById('keyWord').value="<@ww.property value="%{getText('html.Help.title.search.tip')}"/>";
                                   }
                                  
                            </script>
</form>
 
48、Top.html
<#if catalogList?has_content>
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td height="30" bgcolor="EAEAEA">
                                                
                                                 <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                                                    <#list catalogList as catalog>
                                                      <#if catalog_index%8==0>
                                 <tr>
                                                         </#if>
                                  <td width="90" height="30" rowspan="2" bgColor=#EAEAEA onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"> <div align="center"><strong></strong><a href="${req.contextPath}/search.jspx?catalogId=${(catalog.id)?default('')}">${(catalog.title)?default('')}</a></div></td>
                                      <#if catalog_index%8==7>
                                </tr>
                                                       
                                <tr>
                                  <td width="1" bgColor=d0000a onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
             
                                  <td width="1" height="15" bgColor=d0000a onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="1" bgColor=d0000a onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="1" bgColor=d0000a onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="1" bgColor=d0000a onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="1" bgColor=d0000a onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                  <td width="1" bgColor=d0000a onmouseover="this.bgColor='#f3f3f3';"
        onmouseout="this.bgColor='#EAEAEA';"><img src="${req.contextPath}/images/spacer.gif" width="1" height="1"></td>
                                </tr>
                                                       
                                <tr bgcolor="FF7101">
                                 <td height="4" colspan="8" >
                                                         <img src="${req.contextPath}/images/spacer.gif" width="1" height="1">
                                                         </td>
                                </tr>
                                                       
                                                        </#if>
                                                        </#list>
                              </table>
                                                  </td>
                          </tr>
                        </table>
</#if>