在用s:textfield标签显示action中返回的值,用name属性即可。但是如果放在table中的td的话,就会出现一个问题。自动换行,在页面上看起来就是占了一个tr上下距离比较高。这个原因是标签定义的时候就定义成这样了。看看怎么定义的:
查看struts.properties或$ {struts-core-2.06.jar}/org/apache/struts2/default.properties文件,其中有如下配置: struts.ui.theme=xhtml struts.ui.templateDir=template struts.ui.templateSuffix=ftl
修改成这样
struts.ui.theme=simple struts.ui.templateDir=template struts.ui.templateSuffix=ftl
这样修改的话能解决问题,但是要修改jar包总是不好的,建议用下面的方式修改:
在struts.xml文件中加入下面的代码即可;
<constant name="struts.ui.theme" value="simple" /> <constant name="struts.ui.templateDir" value="template" /> <constant name="struts.ui.templateSuffix" value="ftl" />