开发者

How to create Struts Drop down List?

I m new to struts.

I Want to add drop down in web page.That drop down should contain four values. The default and first value will be (Select).

I want to persist the selected value, when that form is opened again and while submitting, if user doesn't select any value from drop down (meaning the default value is present) I want to give an alert to the user and then not to allow a submit until till th开发者_开发问答e user selects an option from the dropdown.

There is one action.java, form.java, javascript file and jsp file. In action.java, I m suppose to use ArrayList to hold different drop down values. How this can be done. please help me.


<s:select list="#{'':'Select', 'key1':'Value 1', 'key2':'Value 2'}" key="selectedValue"></s:select>

or you have a list object(id, value)

<s:select key="selectedValue" list="yourlists" headerKey="" headerValue="Select" listKey="id" listValue="value"/>


Firstly, you need to show your code here. If you are interested in tutorials then I'd suggest - VaanNila, a great place to learn struts framework. (Here is a link of select tag.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜