如何放置< s:选择...>和< s:textfield>在一行中-struts2? [英] How to put <s: select...> and <s: textfield> in a single line - struts2?

查看:43
本文介绍了如何放置< s:选择...>和< s:textfield>在一行中-struts2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这有点令人尴尬. 我在我的一个小项目中使用Struts2.在JSP中,当我输入如下内容时:

<s:select list="keywords" key="label.search" name="selectedKeyword"/>
<s:textfield name="searchparams" size="20" cssClass="label"/>

我知道了(抱歉,我是新用户,所以我无法添加图片): http://i.stack.imgur.com/ZA2Wg.png

--dropdown_--
[              ] < textfield

我想要的是同一行中下拉列表旁边的文本字段. 有没有一种方法可以创建我自己的主题?

提前谢谢!

解决方案

Struts2标签使用FreeMarker主题化.您可以通过在struts.properties中指定以下内容,将默认的XHTML主题更改为简单的主题:

struts.ui.theme=simple

或者您可以通过添加如下主题属性来仅覆盖这些标签的主题:

<s:select list="keywords" key="label.search" name="selectedKeyword" theme="simple"/>
<s:textfield name="searchparams" size="20" cssClass="label" theme="simple"/>

以下是有关主题的其他信息. /p>

This is somehow embarrassing. I'm using Struts2 in a small project of mine. In the JSP, when I put something like this:

<s:select list="keywords" key="label.search" name="selectedKeyword"/>
<s:textfield name="searchparams" size="20" cssClass="label"/>

I get this (sorry, I'm a new user, so I can't add images): http://i.stack.imgur.com/ZA2Wg.png

--dropdown_--
[              ] < textfield

What I want is that the textfield is next to the dropdown, in the same line. Is there a way to do this without creating my own theme?

Thank you in advance!

解决方案

The Struts2 tags are themed using FreeMarker. You can either change from the default XHTML theme to the simple theme by specifying the following in your struts.properties:

struts.ui.theme=simple

Or you can override the theme for just those tags by adding the theme attribute as follows:

<s:select list="keywords" key="label.search" name="selectedKeyword" theme="simple"/>
<s:textfield name="searchparams" size="20" cssClass="label" theme="simple"/>

Here's some additional information about themes.

这篇关于如何放置&lt; s:选择...&gt;和&lt; s:textfield&gt;在一行中-struts2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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