java JSP/Jquery组合框下拉列表,通过图像从数据库动态加载
在我的web应用程序中,我需要显示从数据库动态加载的下拉列表
我需要从DB加载用户列表。每个用户的“访问级别”为1或2
当用户显示在下拉列表中时,他们的名字旁边必须有一个图像
(如“通行级别”1的“绿色”勾选)和(通行级别2的“红色十字”)
我已经检查了这个url http://www.marghoobsuleman.com/jquery-image-dropdown
但我需要根据从DB加载的访问级别显示图像
我想这可以通过JQuery/CSS实现
有人能告诉我怎么做吗?如果可能的话,请给出示例代码
# 1 楼答案
我以前做过类似的事情,我使用了JQuery flexbox插件。它使用起来很简单。我现在没有密码,但是在这里(http://flexbox.codeplex.com/)是一个网站,你可以在那里寻找如何实现它
# 2 楼答案
在网页所需的位置编写以下代码,以获取并列出用户列表
在你的头部分包括以下javascript/CSS插件
在文档准备功能中使用下面的
javascript
(它位于标题部分):# 3 楼答案
我没有JSP的知识,但是,我可以为您提供足够的信息,这样您就可以继续使用您的知识
HTML部分:
# 4 楼答案
由于您使用的是jsp作为查看技术,所以使用核心标记根据访问级别决定是显示绿色记号还是显示红色十字
访问this site了解更多关于核心标签的用法。别忘了包括jstl。罐子和标准瓶。项目类路径中的jar文件。它们是支持jstl的必要库
看起来您的应用程序是使用spring框架开发的,所以我将尝试这样解释
您的JSP代码如下所示:将其命名为userlist。jsp
现在您将拥有一个控制器,它将在调用某些操作后被调用,它将返回这个jsp以及用户名列表。 下面是示例UserController。java
&;用户DTO可以是这样的。 下面是示例用户。java
这不是一个完整的答案。我已经尽力解释了。 你试试看。应该行得通