Struts 开发之 血的教训

来源:互联网 发布:多目标遗传算法工具箱 编辑:程序博客网 时间:2024/04/28 22:02
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

1. jsp页面中需要注意大小写

例如: <link rel="stylesheet" type="text/css" href="edit.css">

如果写成<link rel="stylesheet" type="text/css" href="Edit.css">

那么这个白痴jsp就会找不到edit.css文件

 

2.代码转换 

所有的中文 需要转换,加入

try {
      article_Key_Words = new String(article_Key_Words.getBytes("iso8859-1"), "GB2312");
    }
    catch (UnsupportedEncodingException ex) {
    }

当然,你也可以用filter(在serlet处理request和response之前执行的一个类,在web.xml中可以定义),把request的encoding 换成GB2312的.

3.

......

outp.output(doc, new FileOutputStream("../power/exampleB.xml"));

.....

return actionMapping.findForward("success");

//success 是"/exampleB.xml"

会出现错误!因为action的perform方法是多线程的,但对于正在执行的这个线程,输出文件还是需要时间的,在没有输出完全之前,是不能到达此页面的

4.Struts-config.xml 中的定义

一定要注意格式的正确  比如<action .../>

                            <forward .../>

                          <action/>

这样的错误。这个错误让我头痛了好几天(我用jbuilder8编译),最后才找到。

5.待续。。。。

6.Struts对工作流的支持很有限。如果对工作流程的定义要求较高,建议赶快放弃Struts 。当然,作者本人正在研究Struts与工作流方面的结合。

哎,为了糊弄毕业,得写出点论文。(: 有空给点建议。

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击