Something about struts1.2-using
2009-10-03 12:59
351 查看
Topic 1:About Mapping
Q:What's difference between this two code?
mapping.findForward(mapping.getInput());
AND
mapping.getInputForward();
Re:
Mapping.getInput() which type is String, and as we know, mapping.findForward(), which will find the forword String from Struts Content setted in cfg xml file, so if use it we must set "<forward ... />" if not will can't find the item page and in console will out an "Unable to find '/messageinfo.jsp' forward. " log, and page will forword an null page.
while mapping.getInputForward(), which type is a ActionForward, and getInputFroward() which get the Input page setted in cfg.xml, so when use it you should set "input" page in "<action input="somePage.jsp" .../> ", if not, it will throw an exception, and you cann't get any correct page!
Topic 2:About Action's Messages
Q:What's difference of those code? Can you guess the results?
---------------------------------------<br>
<html:messages id="message">
<bean:write name="message"/>
<br/>
</html:messages>
--------------------------------------<br>
<html:messages id="message" property="info">
<bean:write name="message"/>
<br />
</html:messages>
-------------------------------------<br>
<html:messages id="message" message="true">
<bean:write name="message"/>
<br />
</html:messages>
-------------------------------------<br>
<html:messages id="message" message="true" property="info">
<bean:write name="message"/>
<br />
</html:messages>
Re:
As you see, the main difference is some use "message", and some use "property" attribute, so that's the key.
If you want to show all info in ActionMessages object, so you should use " message='true'" item.
If you want to show some property info of ActionMessages object, use like this "message="true" property="info""
If you want to show all info in ActionErrors object, you may should use none of the "message" & "property".
If you want to show some property info of ActionErrors object, you may need to use as "property="info""
And have a try in you eclipse, it's may be have a littlr funning.
Note:
Here the messages object should construct as like this:
msgs.add("okinfo", new ActionMessage("send ok!",false));
Topic 3:Ibatis CharSet
<property name="JDBC.ConnectionURL" value="jdbc:mysql://localhost:3306/taxims?useUnicode=true&characterEncoding=UTF-8"/>
If the whole app use UTF-8, include mysql also use default charset utf-8, and ibatis have been used, you should set this code to set the JDBC's charset is utf-8, then you can insert utf-8 char into db.
Q:What's difference between this two code?
mapping.findForward(mapping.getInput());
AND
mapping.getInputForward();
Re:
Mapping.getInput() which type is String, and as we know, mapping.findForward(), which will find the forword String from Struts Content setted in cfg xml file, so if use it we must set "<forward ... />" if not will can't find the item page and in console will out an "Unable to find '/messageinfo.jsp' forward. " log, and page will forword an null page.
while mapping.getInputForward(), which type is a ActionForward, and getInputFroward() which get the Input page setted in cfg.xml, so when use it you should set "input" page in "<action input="somePage.jsp" .../> ", if not, it will throw an exception, and you cann't get any correct page!
Topic 2:About Action's Messages
Q:What's difference of those code? Can you guess the results?
---------------------------------------<br>
<html:messages id="message">
<bean:write name="message"/>
<br/>
</html:messages>
--------------------------------------<br>
<html:messages id="message" property="info">
<bean:write name="message"/>
<br />
</html:messages>
-------------------------------------<br>
<html:messages id="message" message="true">
<bean:write name="message"/>
<br />
</html:messages>
-------------------------------------<br>
<html:messages id="message" message="true" property="info">
<bean:write name="message"/>
<br />
</html:messages>
Re:
As you see, the main difference is some use "message", and some use "property" attribute, so that's the key.
If you want to show all info in ActionMessages object, so you should use " message='true'" item.
If you want to show some property info of ActionMessages object, use like this "message="true" property="info""
If you want to show all info in ActionErrors object, you may should use none of the "message" & "property".
If you want to show some property info of ActionErrors object, you may need to use as "property="info""
And have a try in you eclipse, it's may be have a littlr funning.
Note:
Here the messages object should construct as like this:
msgs.add("okinfo", new ActionMessage("send ok!",false));
Topic 3:Ibatis CharSet
<property name="JDBC.ConnectionURL" value="jdbc:mysql://localhost:3306/taxims?useUnicode=true&characterEncoding=UTF-8"/>
If the whole app use UTF-8, include mysql also use default charset utf-8, and ibatis have been used, you should set this code to set the JDBC's charset is utf-8, then you can insert utf-8 char into db.
相关文章推荐
- something about struts
- some thing about struts (谈谈struts)
- Struts1.2 验证用户是否登陆 两种方法
- 【Struts1.2总结】struts-config.xml配置
- 从零开始创建基于struts1.2 + Hibernate3.0 Web工程
- something about set the FSDB file
- This is usually caused by using Struts tags without the associated filter.
- Something about Ajax
- struts1.2配置(1)-web.xml配置
- 关于resin3以上版本不能运行struts1.2程序的问题解决办法
- Something about WM_PAINT
- something about my mistake.----p1475_push the boxes
- Something about Perl (1)
- Something about Perl (3) 输入输出
- 【Struts1.2总结】struts-config.xml配置
- Struts1.2 Action 属性详解
- 从零开始创建基于struts1.2 + Hibernate3.0 Web工程(第一部分)
- SOMETHING ABOUT MENTAL MODEL
- struts1.2 bean标签的用法
- struts1.2源码分析之容器启动所做的工作