Making the options of a lt;s:checkboxlistgt; display vertically in struts2(制作 lt;s:checkboxlistgt; 的选项struts2中垂直显示)
问题描述
*我需要我的复选框列表选项垂直显示,而不是默认的水平显示.我在名称模板的 src 文件夹中创建了一个文件夹,并在另一个文件夹中创建了一个名为 vertical-checkbox 的文件夹,其中包含我修改后的 .ftl 文件自定义复选框列表.我无法显示自定义复选框我在 JSP 中的代码是
*I need my check box list option to display vertically instead of the default horizontal display.I have created a folder in my src folder in the name templates and another folder with name vertical-checkbox containing the modified .ftl file of my customized check box list.I am unable to display the customized check box My code in JSP is
<s:checkboxlist theme="vertical-checkbox" label="Which of the following are states of India"
name="states"
list="#{'01':'January','02':'February','03':'March','04':'April',
'05':'May'}"
/>
请指出我哪里出错了.
推荐答案
通常struts2中的struts checkboxlist会横向调整复选框.在大多数应用程序中,我们希望垂直显示复选框(逐行).为了将其对齐为垂直,我们必须执行以下操作
Normally the struts checkboxlist in struts2 diaply the check boxes horizontally. In most of application we want to display the check boxes vertically (line by line). For aligning this as vertical we have to do the following
你必须在你的 src 文件夹中创建一个目录模板
You have to create a directory template in your src folder
使用您要创建的模板名称创建一个文件夹(垂直复选框)
Create a folder with the name of the template you want to create (vertical-checkbox)
将struts-2.1.6/src/core/src/main/resources/template/simple/checkboxlist.ftl文件复制到该目录下该文件内容如下.在您必须根据需要或喜欢此链接放置
标签之前:http://codeglobe.blogspot.com/2009/09/struts2-align-check-box-vertical.html
Copy the struts-2.1.6/src/core/src/main/resources/template/simple/checkboxlist.ftl file to this directory content of this file is as follows. Before the you have to put a
tag as you want or like this link:
http://codeglobe.blogspot.com/2009/09/struts2-align-check-box-vertical.html
<s:checkboxlist list="urllist" name="selectedValues" listKey="id" listValue="descrption" theme="vertical-checkbox"></s:checkboxlist>
这将为您提供一个垂直的复选框列表.唯一的区别是这里你必须指定和你在项目的src文件夹的模板目录中创建的目录相同的主题.
This will give you a vertical check box list. The only difference is that here you have to specify the theme which is same as the directory you have created in the template directory in the src folder of your project.
这篇关于制作 <s:checkboxlist> 的选项struts2中垂直显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:制作 <s:checkboxlist> 的选项struts2中垂直显示


- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01