制作 <s:checkboxlist> 的选项struts2中垂直显示 [英] Making the options of a <s:checkboxlist> display vertically in struts2

查看:27
本文介绍了制作 <s:checkboxlist> 的选项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

  1. 你必须在你的 src 文件夹中创建一个目录模板

  1. 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.

这篇关于制作 &lt;s:checkboxlist&gt; 的选项struts2中垂直显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆