Struts 2标记在jsp中 [英] Struts 2 Tag in jsp

查看:91
本文介绍了Struts 2标记在jsp中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

表---

城市名称|地区名称|

艾哈迈达巴德|赖布尔|

艾哈迈达巴德| Vastrapur |



使用此表显示如下< br $>


Ahmedab​​ad

Raipur

Vastrapur



在jsp页面中使用struts2的迭代器

解决方案

你好,



目前还不是很清楚您将此数据从控制器传递到VIEW,其次是您是要将其显示为列表还是表格。如果您以一个或多个bean实例的List的形式传递它,并且您希望在 HTML Select 列表中显示数据,并且数据排序 CityName 然后您可以使用以下代码

 <   c:set     var   =  _ curCity    value   =   /  < span class =code-keyword>>  
< select id = areaSelect size = 1 >
< s:iterator value = cityinfo var = _ city >
< c:选择 >
< c:何时 测试 =


{not empty _c urCity&& _curCity ne _city.cityName} >
< 选项 value =


{fn:escapeXml(_city.cityName)} >

Table---
City Name | Area Name |
Ahmedabad |Raipur |
Ahmedabad |Vastrapur |

using this table display like this

Ahmedabad
Raipur
Vastrapur

using iterator of struts2 in jsp page

解决方案

Hello,

It''s not very clear how you are passing this data from controller to the VIEW, and secondly whether you want to display it as a list or a table. If your are passing it in the form of a List of one or more bean instance and you want to display the data in a HTML Select list and that the data is ordered by CityName then you can use following code

<c:set var="_curCity" value=""/>
<select id="areaSelect" size="1">
<s:iterator value="cityinfo" var="_city">
    <c:choose>
        <c:when test="


{not empty _curCity && _curCity ne _city.cityName}"> <option value="


{fn:escapeXml(_city.cityName)}">


这篇关于Struts 2标记在jsp中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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