Jeecms项目遇到问题集

来源:互联网 发布:asp.net core php 编辑:程序博客网 时间:2024/04/30 05:42

(1)修改菜单,让栏目出现更多的菜单项目,或者更换菜单背景,只需要修改layout.css

/* nav
----------------------------------------*/
#menu{background:url(../img/dhlGB.gif) repeat-x;  height:40px; width:980px;}
#topmenu{display:inline; margin:0; height: 38px; float:left; position:relative;}
#topmenu dt{text-align:center;padding:0 8px; float:left; display:inline;margin:0px 0px 0px -2px; line-height: 33px!important;  line-height: 38px; font-weight:bold;}
#topmenu dt .menu_first{padding-left:15px;}
#topmenu dt a{display:block;float:left;width:82px;color:#fff;height:38px;}
#topmenu dt a.selected/*切换的颜色*/{font-weight: bold; height:38px;color:#225099; background-image: url(../img/menuBG.gif); line-height: 33px!important;  line-height: 38px;}
#topmenu dt a:link {text-decoration: none;background:url(../img/dhlGB.gif) repeat-x;color:#ffffff; }
#topmenu dt a:visited {text-decoration: none;background:url(../img/dhlGB.gif) repeat-x;color:#ffffff; }
#topmenu dt a:hover {text-decoration:none;background:url(../img/menuBG.gif) repeat-x;color:#225099; }
其中 :dt 的原理啊 padding:0 10px 可以适当的调整就行了!

 

官网论坛上下载的安装版,在Windows下能正常安装运行,在Linux下就不行了,都是tomcat 6和jdk 1.7,略奇怪。

第一个错误:

 

java.lang.NoClassDefFoundError: Could not initialize class com.octo.captcha.image.gimpy.GimpyFactory

我下载了一个jcaptcha-all-1.0-RC6.jar替换掉自带的jcaptcha-1.0.jar,解决这个问题之后出现第二个问题,GenericManageableCaptchaServic参数不对。

看jcaptcha文档得知,GenericManageableCaptchaService的构造器只有3个参数,所以修改captcha-context-xml,去掉第4个参数。

 

xml<bean id="captchaService" class="com.octo.captcha.service.multitype.GenericManageableCaptchaService"><constructor-arg index="0" ref="imageEngine"/><constructor-arg type="int" index="1" value="180"/><constructor-arg type="int" index="2" value="100000"/><!-- <constructor-arg type="int" index="3" value="75000"/> --></bean>

乱码

JEECMS一些模板是中文名的,用unzip解压要注意,不然会有乱码,我直接下载编译unzip 6.10b,加-O CP936解压。

重定向

我一开始以为这部分最简单,结果把!=写成==花了我不时间debug。

要实现把所有为登陆的请求重定向到登陆页面,可以利用Spring的HandlerInterceptor实现。因为自己对Spring不熟,所以直接改了JEECMSd的FrontContextInterceptor,它原来就有判断用户登陆,所以很简单就实现重定向。

在重定向的时候,要注意的是有些请求不能重定向到登陆页面,例如注册页面、和找回密码等等。一开始我用grep找出可以用GET请求的URL,然后自己判断是否允许。

只能GET:

grep -r "@RequestMapping" | grep GET | grep '".*\.jspx"' -oh | sort  | uniq

能GET能POST:

grep -r "@RequestMapping" | grep -v POST | grep '".*\.jspx"' -oh | sort  | uniq

后来,我是直接操作一遍,记录下要放行URL就可以了。

编译

用笨方法,直接编译,然后连代码一起打包成jar就可以了。

javac -g -cp .:/tmp/tmproot/lib/*:/tmp/tmproot/webapps/ROOT/WEB-INF/lib/* `find com -name "*.java"`jar cf jeecms-all.jar com/

和代码一起打包是为了方便打包xml文件,如果忘了和hibernate用的xml一起打包,就会出现XXXX is not mapped的异常。用-g编译,是因为JEECMS用@RequestMapping但又不用注解指定参数的后果。

其他

今天是我最频繁用grep和find的一天,很难想像没有这些工具,要怎样快速定位到文件。犯过一些低级错误之后,我明白了昏昏欲睡的时候就应该好好休息。

 

该方法,不如直接去掉相关的实际

修改后台登录路径,修改web.xml中的
<servlet-mapping>
<servlet-name>JeeCmsAdmin</servlet-name>
<url-pattern>/admin/huayu/*</url-pattern>
</servlet-mapping>
url-pattern的路径,修改为2层路径
(若要改为一层路径,需修改拦截器AdminContextInterceptor.java中的getURI
方法,修改count=2为count=1;)
修改jeecms-servlet-admin.xml中的<entry key="appBase" value="/admin/huayu"/>value值
<property name="loginUrl" value="/admin/huayu/login.do"/>
<property name="returnUrl" value="/admin/huayu/index.do"/>
修改这两个属性中的value值

在cmsLoginAct.java中@RequestMapping(value = "/login.do", method = RequestMethod.POST) public String submit方法下添加条件
if(returnUrl==null){
returnUrl = new String("/admin/huayu/index.do");
}
目的是,在后台敲入http://localhost:8080/jeecms/admin/huayu/index.do中,returnURL字段自动去转向
原创粉丝点击