English 中文(简体)
Freemarker hash for Struts2 @s.select tags list property
原标题:Freemarker hash for Struts2 @s.select tag s list property

I m 利用自由标志作为“Stuts 2”应用的辅助发动机,并存在一些问题,试图将自由标识带往@s。 选定标值为标值。

我现在想像我的模板那样做的事情:

<@s.select name="myDropdown" list={"1":"Foo", "2":"Bar", 3:"Baz"} />

由此形成的超文本是:

<select name="myDropdown" id="myDropdown">
    <option value="freemarker.ext.beans.HashAdapter$1$1$1@2c9bebb">freemarker.ext.beans.HashAdapter$1$1$1@2c9bebb</option>
    <option value="freemarker.ext.beans.HashAdapter$1$1$1@16ca4a">freemarker.ext.beans.HashAdapter$1$1$1@16ca4a</option>
    <option value="freemarker.ext.beans.HashAdapter$1$1$1@173ee8">freemarker.ext.beans.HashAdapter$1$1$1@173ee8</option>
</select>

根据文件,看来这样做会奏效,但实际上唯一的例子是使用自由标识清单。 哈希斯只是另一个选择,但我没有能够找到任何使用它们的法律实例。

最后,我的问题是,如果我与Stuts 2选择标签使用什么自由标识使下述超文本?

<select name="myDropdown" id="myDropdown">
    <option value="1">Foo</option>
    <option value="2">Bar</option>
    <option value="3">Baz</option>
</select>
最佳回答

看来,使用地标和地标的特性似乎就是trick。

现行工作法典是:

<@s.select name="myDropdown" list={"1":"Foo", "2":"Bar", 3:"Baz"} listKey="key" listValue="value" />

象这样的种子应当自动由tag子来照顾,但我无法在没有明确确定这两个额外特性的情况下开展工作。

问题回答

暂无回答




相关问题
Getting sitemesh to work with struts2

I m trying to integrate sitemesh into my struts2 app, but i m finding that it s not making any difference and isn t showing any errors (or anything sitemesh related at all) in the logs. I ve started ...

Struts Action Validation

Hey People. I have been recently validating Struts 2 actions. In One of my action class, the save method to be precise must have two id s. That is an assessmenttype id and a course id. this is what is ...

struts2 action not calling properly

On default I want my struts2 app to forward to an action: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"...

How to validate a select tag in struts 2 framework

I am a newbie into programming and i am currently employed as a junior programmer. I am currently having some problems validating the select tags in one of my forms. What i actually trying to do is to ...

Setting the default value in Struts2

I am setting the value(kind of default value) for a drop down select value from action class in a page(given below). When the page loads the value is beig displayed but the other elements of the ...

Localized exceptions (within a Struts2 app)

I am developing a Struts 2 application with support for multiple languages. If one of the domain objects needs to throw an exception, how can it do so in such a way that the error message is no ...

热门标签