struts2.1.8+hibernate2.5.6+spring3.0(ssh2三大框架)常见异常原因和解决方案(下)

首先声明:该文从我自己的网易博客“敏敏的博客”(现已不再更新)整理过来,仍属原创。

上篇请看“struts2.1.8+hibernate2.5.6+spring3.0(ssh2三大框架)常见异常原因和解决方案(上)”。


-------------------------------------------------------------------------------------------------------------------------------------------------


问题十一:MyEclipse中修改项目名称后,如何重新部署到 tomcat?

解决方案: 首先修改工程名(直接按F2即可),然后选择工程名--右键--Properties--MyEclipse--Web--把Web Context-root的名字改成新的项目名称, 再把tomcat的工程删除了,最后重新部署下即可。


问题十二:在jsp页面中用request方式向struts的action中传递不了中文参数,例如下面代码:

<silver;mso-highlight:silver;mso-font-kerning:0pt;" >
a href="findBooksByConditionAction.action?page=<s:property value="%{pageBean.currentPage+1}"/>
&property=0pt;" ><%=session.getAttribute(0pt;" >"property")mso-font-kerning:0pt;" >%>&condition=mso-font-kerning:0pt;" >
<%=session.getAttribute(mso-font-kerning:0pt;" >"condition")color:#BF5F3F;mso-font-kerning:0pt;" >%>
&category=0pt;"  ><%=session.getAttribute(0pt;"  >"category")mso-font-kerning:0pt;"  >%>&subCategory=mso-font-kerning:0pt;"  >
<%=session.getAttribute(mso-font-kerning:0pt;"  >"subCategory")color:#BF5F3F;mso-font-kerning:0pt;"  >%>0pt;"  >"    
class="right-font08">下一页</background:silver;mso-highlight:silver;mso-font-kerning:0pt;"  >amso-font-kerning:0pt;"  >>

这样传递过去的中文是乱码。


解决方案:放在input文本域里面传递过去,即

<input type="hidden" name="condition" value="<%=session.getAttribute("condition")%>"/>
<input type="hidden" name="category" value="<%=session.getAttribute("category")%>"/>
<input type="hidden" name="subCategory" value="<%=session.getAttribute("subCategory")%>"/>
<input type="hidden" name="property" value="<%=session.getAttribute("property")%>"/>

然后直接

<a href="findBooksByConditionAction.action?page=<s:property value="%{pageBean.currentPage+1}"/>"class="right-font08">下一页</a>

但发现值竟然没有传过去(空指针报错),经问同事后知道,要想input里的值传过去必须提交表单才可,仅采用这种超链接方式进行跳转的值是传不过去的,于是将超链接换为

<a href="javascript:queryByConn('<s:property value="%{pageBean.currentPage+1}"/>');" class="right-font08">下一页</a>

js中相应加上该函数的实现:

function queryByConn(page) {

document.bookForm.action="findBooksByConditionAction.action?page="+page;

    document.bookForm.submit();

}

在js中将表单提交即可,这样乱码问题就解决了。


问题十三:hibernate中出现异常:

org.hibernate.LazyInitializationException: could not initialize proxy - no Session

at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:57)

at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)

原因:hibernate配置中 many-to-one的默认选项是 lazy = "proxy"

解决方法:<many-to-one>  及 <set> 中设置 lazy="false"即可


问题十四:如何建立svn服务器

解决方案:首先当然要安装客户端svn(小乌龟TortoiseSVN )和服务器端svn(Subversion),然后在命令行下输入以下命令:

1、  svnadmin oa(oa是存放各个版本信息的文件夹名称,自定义)

2、  svnserve  –d –r oa(打开svn服务器)


PS:可能遇到的问题

     authorized failed(权限认证失败)

解决方案:在oa目录下找到passwd文件,在里面加上几个用户

用户名=密码(自己定义用户名和密码)

并将svnserve.conf里的password-db = passwd这句前面的#去掉即可(前面不能留有空格)

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值