如何创建Struts下拉列表?
我是struts新手。
我想在网页中添加下拉菜单。该下拉菜单应包含四个值。默认值和第一个值将为(选择)。
我想保留所选值,当再次打开该表单并提交时,如果用户没有从下拉列表中选择任何值(意味着存在默认值),我想向用户发出警报,然后不要允许提交,直到用户从下拉列表中选择一个选项。
有1个action.java、form.java、javascript文件和jsp文件。在action.java中,我想使用ArrayList来保存不同的下拉值。如何做到这一点。请帮我。
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 the 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
或者你有一个列表对象(id,值)
or you have a list object(id, value)
首先,您需要在此处显示您的代码。如果您对教程感兴趣,那么我建议 - VaanNila,学习struts框架的好地方。 (这里是一个链接选择标签。)
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.)