java - 如何在java中将通知菜单与数据库连接

标签 java html jsp servlets

我有一个菜单选项,请假请求是如果有任何通知,它将显示类似通知的菜单,因此假设当员工提出请假请求并且只有一名员工提出请求时,它应该显示 1通知如果 2 名员工提出请求,那么它应该增加 2,现在单击通知后的第二件事应该在 jsp 页面上显示第一人休假请求我完全困惑如何开始这个我刚刚从一件小事开始这是我的代码......请任何人帮助我并建议我一些逻辑和想法......

  <style>

 .badge1 {
position:relative;
   }
    .badge1[data-badge]:after {
  content:attr(data-badge);
  position:absolute;
  top:-10px;
 right:-10px;
  font-size:.7em;
  background:green;
  color:white;
    width:18px;height:18px;
     text-align:center;
       line-height:18px;
     border-radius:50%;
   box-shadow:0 0 1px #333;
 }


</style>
 </head>
    <body>

      <br>
   <a href="" class="badge1" data-badge="27">Badge Notification Example</a>
   </body>
  </html>

最佳答案

请尝试下面的代码,也许它会给您一个想法,我尝试制作一个演示,我在评论中描述了这一点。请将 jquery.min.js 文件放置在您的工作空间中。

通知.html

<html>
        <head>
            <script src="jquery.min.js"></script>
            <link rel="stylesheet" type="text/css" href="style.css">
        </head>
        <body>
        <form method="POST">
            <a href="" id="notification"  class="badge" data-badge="0">Badge Notification Example</a>
            <input id="submit" value="Push" class="submit" onclick="push();"  type="button"></input>
            <input id="submit" value="Pop" class="submit" onclick="pop();"  type="button"></input>
        </form>
       </body>
    <script>
        function push(){
            var notification=$("#notification").attr("data-badge");
            var counter =parseInt(notification,10);
            if(counter>9){
                alert("Notification list is full!");
                return;     
            }
            counter=counter+1;      
            $("#notification").attr("data-badge",counter);
        }
        function pop(){
            var notification=$("#notification").attr("data-badge");
            var counter=parseInt(notification,10);
            if(counter<1){
                alert("list is empty!");
                return;     
            }
            counter=counter-1;
            $("#notification").attr("data-badge",counter);
        } 
    </script>
     </html>

样式.css

.badge{
    position:relative;
}
    .badge[data-badge]:after {
    content:attr(data-badge);
    position:absolute;
    top:-10px;
    right:-10px;
    font-size:.7em;
    background:green;
    color:white;
        width:18px;
    height:18px;
        text-align:center;
        line-height:18px;
        border-radius:50%;
    box-shadow:0 0 1px #333;
}
.submit{
    margin-top    : 20px;
        margin-right  : 10px;
        margin-bottom : 20px;
        margin-left   : 10px;
    font-size:100m;
    background:orange;
    color:green;
        width:150px;
    height:30px;
        text-align:center;          
}

关于java - 如何在java中将通知菜单与数据库连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24609932/

相关文章:

html - 固定位置div,显示在下一个div之上

java - Spring 3 表单 validator

java - 如何在网页中创建蜂鸣声?

jsp - 同一个 sencha touch 应用程序的两个实例

java - 如何制作可定制的图表

java - 下载带有 MVP 图案的照片

Javascript onClick 在 Chrome 上不起作用

html - 将我的文本限制为宽度不同的三行

java - 在一行中创建数组

java - Android 中的 HTML 解析