在 Struts 1.x 中使用 java 设置选择的默认值 [英] Set default value of select using java in Struts 1.x

查看:25
本文介绍了在 Struts 1.x 中使用 java 设置选择的默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到过 Struts 2.x 的答案,但没有找到 Struts 1.x 的答案.

I've come across answers for Struts 2.x but none for struts 1.x.

我需要做的就是使用使用 optioncollector 的 HTML:SELECT 标记的 1.x 在页面加载时选择一个默认值:

All I need to do is select a default value on page load using 1.x of an HTML:SELECT tag that uses an optioncollector:

<html:select property="status">
  <html:optionsCollection name="statusList" label="description" value="id" />
</html:select>

看起来很简单,但我想避免为此使用 javascript.

Seems simple, but I'd like to avoid using javascript for this.

推荐答案

您是否尝试过 使用 标签上的 value 属性?

Have you tried to use the value attribute on the <html:select> tag?

<html:select property="status" value="...your status choise here...">
  <html:optionsCollection name="statusList" label="description" value="id" />
</html:select>

这篇关于在 Struts 1.x 中使用 java 设置选择的默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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