如何更改的显示项目的外观
在 jsp 页面的 Struts2 应用程序中,我有一个字段,用户可以在其中选择他想要的任何选项,我使用了 struts:checkboxlist 像这样
<s:checkboxlist name="cust.communityList" label="Are You Inteterested In"
list="{'WebSpere Consultuing','Portal Consulting','SOA/BPM Consulting','Content Management',
'DataPower Consulting','Information Management Services','Application Monitoring','Application Security',
'Migration to WebSphere','Application Testing','WebSphere Version Upgrade','JAM/Panther Consulting','IBM Software Procurement','XMLink/Progressions','Other'}" />
它工作正常。但在浏览器中它的外观并不好,它一个接一个地按行显示列表元素,然后在下一行......
我想显示它们,第一行中的 2 个,接下来的 2 个项目第二行等等...
我怎样才能以这种方式显示复选框列表项目?
In the Struts2 application in the jsp page I have a feild where the user can select what ever option he want , i used struts:checkboxlist like this
<s:checkboxlist name="cust.communityList" label="Are You Inteterested In"
list="{'WebSpere Consultuing','Portal Consulting','SOA/BPM Consulting','Content Management',
'DataPower Consulting','Information Management Services','Application Monitoring','Application Security',
'Migration to WebSphere','Application Testing','WebSphere Version Upgrade','JAM/Panther Consulting','IBM Software Procurement','XMLink/Progressions','Other'}" />
It is working fine . But in the browser it's look is not good , It dispalying the list elements in a row wise one after the other ,then in the next row ....
I wanted to display them ,2 in the first row ,next 2 items in the second row ans so on ...
How can i display the checkboxlist items in that way ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,我只是通过自定义模板方法做到了这一点。看起来任务完成了。查看文档,了解如何将原始复选框列表 FreeMarker css 代码拉入您自己的项目中。总之,将
struts2.core.jar/template/simple/checkboxlist.ftl
拉入您自己的 webapp/template 目录并进行修改。我进行了以下更改:1:在文件顶部,迭代器标记所在的位置,我在前后添加了以下几行(不是迭代器行):
2:在文件末尾,迭代器结束的位置,我补充:
3:就是这样。实际上,本教程告诉您需要了解的内容,这只是修改 FreeMarker 代码的问题。
Ok, I just did this via the custom template method. It seemed to get the job done. Look at the docs to see how to pull the original checkboxlist FreeMarker css code into your own project. In summary, pull
struts2.core.jar/template/simple/checkboxlist.ftl
into your own webapp/template directory and modify it. I make the following changes:1: at the top of the file, where the iterator tag is, I added the following lines (not the iteratorline) before and after:
2: At the end of the file, where the iterator ends, I added:
3: That's it. Really, the tutorial tells you what you need to know, it's just a matter of hacking up the FreeMarker code.
您可以更改复选框的主题,或者可以扩展主题然后更改它。
在 /template/simple/checkboxlist.ftl 中查找基本复选框列表模板。
有关覆盖模板的信息,请参阅:http://struts.apache.org /2.0.11/docs/template-loading.html
You can change the theme for the checkbox OR you can extend the theme and then change it.
Look in your /template/simple/checkboxlist.ftl for the base checkboxlist template.
For info on overriding templates see: http://struts.apache.org/2.0.11/docs/template-loading.html