本文介绍了Struts 2:如何将值加载到< s:从会话列表中选择>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Struts的新手.我想将会话中的数据列表加载到选择标记<s:select>,它等于纯html <select><option>values..</option></select>.数据可能会从数据库中加载,然后放入列表中.我在寻找互联网.但这对我没有用.请任何人让我知道如何执行此操作或提供任何与工作示例的链接.(包括操作类,struts.xml和jsp页面.最需要的代码就足够了.)

I am new to struts. I want to load a list of data in the session to a select tag <s:select> which equals to pure html <select><option>values..</option></select> . The data might be loaded from database and put them to a list. I looked for Internet. But it all didn't work for me. Please any one let me know how to do this or provide any link with working example.( including the action class,struts.xml and jsp page. most needed codes are enough.)

推荐答案

只要您在堆栈上的java.util.List中具有值列表,就可以使用以下类似的东西:

As long as you have the list of values in a java.util.List on the stack, you should be fine with something like this:

<s:select label="Some label"          
list="yourList"
name="somName" />

您可以在此处找到示例: http: //www.mkyong.com/struts2/struts-2-sselect-drop-down-box-example/

You can find a sample here: http://www.mkyong.com/struts2/struts-2-sselect-drop-down-box-example/

这篇关于Struts 2:如何将值加载到&lt; s:从会话列表中选择&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 10:19