0

'

<head>

    <title>Reprint</title>    

    <script>

        function addDate1() {
            date1 = new Date();
            var month = date1.getMonth() + 1;
            var day = date1.getDate();
            var year = date1.getFullYear();

            if (document.getElementById('date1').value == '') {
                document.getElementById('date1').value = year + '-' + month + '-' + day;
            }
        }
        function addDate() {
            date = new Date();
            var month = date.getMonth() + 1;
            var day = date.getDate();
            var year = date.getFullYear();

            if (document.getElementById('date').value == '') {
                document.getElementById('date').value = year + '-' + month + '-' + day;
            }
        }
    </script>
    <style type="text/css">
        .btn_hover:hover{

            color: darkblue ;
        }

    </style>
</head>
<body onload="addDate();
            addDate1()" style="background-color: aliceblue;" >
    <table align="" border="1">
        <tr align="">
            <td  >
                <h3 align="center" >Reprint Request Form <img  src="sarasavi.png" />  </h3>
                    <%
                        Date dNow = new Date();
                        SimpleDateFormat ft = new SimpleDateFormat(" yyyy.MM.dd");
                        out.print("<h4 align=\"center\">" + ft.format(dNow) + "</h4>");
                    %>  

            </td>

        </tr>
        <tr>
            <td>
                <h6 >
                    Enter ISBN or Scan the Barcode <i style="color: #545454" class=" icon-barcode"></i>
                </h6>
                <input id="isbn" type="text" placeholder="ISBN "/>

            </td>
        </tr>

    </table>

    <table border="1">
        <tr>
            <td>
                <ul class=" tabs left  " >
                    <li><a href="#tabr1" >Stores</a></li>
                    <li><a href="#tabr2">Publishing Department</a></li>
                    <li><a href="#tabr3">Printing Department</a></li>
                    <li><a href="#tabr4">Director</a></li>
                </ul>
                <!-- End Tabs -->

                <!-- Stores -->
                <form action="####" method="Post"> 
                    <div id="tabr1" class="tab-content">
                        <!-- HALF & HALF -->

                        <div class=" col_6">
                            <label for="text1" style=" font-size: 16px;">Title  </label><br/>
                            <input id="text1" type="text" placeholder="Title" style="width: 355px; height: 28px;" /><br/><br/>
                            <label for="text2" style=" font-size: 16px;">Author  </label><br/>
                            <input id="text2" type="text" placeholder="Author" style="width: 355px; height: 28px;" /><br/><br/>
                            <label for="text3" style=" font-size: 16px;">Price   </label></span> <br/>
                            <input id="text3" type="text" placeholder="price" style="width: 95px; height: 28px;" /><br/><br/><br/>

                            <!-- Radio -->
                            <label style=" font-size: 16px;">Move</label><br/><br/>
                            <input type="radio" name="radio" id="radio1" />
                            <label for="radio1" class="inline">Fast</label><br/>
                            <input type="radio" name="radio" id="radio2" />
                            <label for="radio2" class="inline">Medium</label><br/>
                            <input type="radio" name="radio" id="radio3" />
                            <label for="radio3" class="inline">Slow</label><br/>
                            <!-- Radio -->
                        </div>

                        <div class="col_6">
                            <label for="text4" style=" font-size: 16px;">Stock in hand </label> <br/>
                            <input id="text4" type="text" placeholder="" style="width: 100px; height: 28px;" /><br/><br/>
                            <label style=" font-size: 16px;">Last GRN Date</label><br/>
                            <input type="date" ><br/><br/>
                            <label for="text5" style=" font-size: 16px;">Last GRN Quantity </label></span> <br/>
                            <input id="text5" type="text" placeholder="Qty" style="width: 100px; height: 28px;" /><br/><br/><br/>

                            <input type="submit" value="Save"  class="btn_hover"/>&nbsp;&nbsp;
                            <input type="submit" value="Reset" class="btn_hover" />
                        </div>
                    </div>
                </form>
                <!-- Stores -->

                <!-- Publishing Department -->
                <form action="####" method="Post">
                    <div id="tabr2" class="tab-content">
                        <div class="col_4">
                            <!-- Check box -->
                            <input type="checkbox" id="check1" />
                            <label for="check1" class="inline" style="font-size: 16px; font-weight: bold;" >Informed the Author </label><br/><br/><br/>
                            <!-- Check box -->
                            <!-- Table sortable -->
                            <label style="font-size: 18px; font-weight: bold;"> Last Print </label> <br/><br/>
                            <table class="sortable" border='1'>
                                <thead><tr>
                                        <th>Print</th>
                                        <th>Date</th>
                                        <th>Quantity</th>
                                    </tr></thead>
                                <tbody>
                                    <tr>
                                        <td>Item1</td>
                                        <td>Item2</td>
                                        <td>Item3</td>
                                    </tr>
                                    <tr>
                                        <td>Item1</td>
                                        <td>Item2</td>
                                        <td>Item3</td>
                                    </tr>
                            </table>
                            <!-- Table sortable -->
                            <br/><br/>
                            <label for="text6" style=" font-size: 16px;">Printer  </label><br/>
                            <input id="text6" type="text" placeholder="Type Printer Name" style="width: 355px; height: 28px;" /><br/><br/>
                            <!-- Select -->
                            <label for="select1">Paper Type</label> <br/>
                            <select id="select1">
                                <option value="0">- Choose a Paper Type -</option>
                                <option value="1">Bank Paper</option>
                                <option value="2">Book Printing Paper </option>
                                <option value="3">Art Paper</option>
                                <option value="4">Bulk</option>
                            </select>
                            <!-- Select -->
                            <br/><br/>
                            <label for="text7" style=" font-size: 16px;">Delivery for Printing  </label><br/>
                            <input id="text7" type="text" placeholder="Type here" style="width: 355px; height: 28px;" /><br/><br/>

                            <label for="text8" style=" font-size: 16px;">Quantity Suggested</label><br/>
                            <input id="text8" type="text" placeholder="Type here" style="width: 355px; height: 28px;" /><br/><br/> 
                        </div>

                        <div class="col_6" style="padding-left: 100px;">
                            <label style=" font-size: 16px;">Date</label><br/>
                            <input type="text" id="date1" readonly="true " ><br/><br/> 
                            <label for="text9" style=" font-size: 16px;">Altered Page Numbers </label></span> <br/>
                            <input id="text9" type="text" placeholder="Eg-: 4 , 5 , 6 , 34" style="width: 355px; height: 28px;" /><br/><br/><br/>
                            <!-- Check box -->
                            <input type="checkbox" id="check2" />
                            <label for="check2" class="inline" style="font-size: 16px; font-weight: bold;">Sample Copies </label><br/><br/><br/>
                            <!-- Check box -->
                            <label for="text10" style=" font-size: 16px;">Altered Tracing (No.s) </label> <br/>
                            <input id="text10" type="text" placeholder="" style="width: 355px; height: 28px;" /><br/><br/>

                            <label style=" font-size: 16px;">Book Cover</label><br/><br/>
                            <input type="radio" name="radio" id="radio4" />
                            <label for="radio4" class="inline">Same Cover</label><br/><br/>
                            <input type="radio" name="radio" id="radio5" />
                            <label for="radio5" class="inline">New Cover</label><br/><br/><br/>

                            <input type="submit" value="Save" class="btn_hover"/>&nbsp;&nbsp;&nbsp;
                            <input type="submit" value="Reset" class="btn_hover" />
                        </div>

                    </div>

                </form>
                <!-- Publishing Department -->
                <form action="####" method="Post"> 
                    <!-- Printing Department -->
                    <div id="tabr3" class="tab-content">
                        <div class="col_4">
                            <!-- Select2 -->
                            <label for="select2">Size</label> <br/>
                            <select id="select2">
                                <option value="0">- Choose a Size -</option>
                                <option value="1">SD 1/8</option>
                                <option value="2">D 1/8</option>
                                <option value="3">D 1/4</option>
                                <option value="4">Cr 1/8</option>
                                <option value="5">Cr 1/4</option>
                                <option value="6">A4</option>
                                <option value="7">A5</option>
                                <option value="8">B4</option>
                            </select><br/><br/><br/>
                            <!-- Select2 -->  
                            <label style="font-size: 18px; font-weight: bold;">No. of Pages</label><br/><br/>
                            <label>Black & White -</label>
                            <input type="text"  id="text11"style="width: 100px; height: 28px;" ><br/><br/>
                            <label style="padding-right: 45px">Colour -</label>
                            <input type="text" id="text12 "style="width: 100px; height: 28px;" ><br/><br/><br/>

                            <label style="font-size: 18px; font-weight: bold;"> Last Production Cost</label><br/><br/>
                            <!-- Table sortable2 -->
                            <table class="sortable" border='1'>
                                <thead><tr>
                                        <th>Year</th>
                                        <th>Qty</th>
                                        <th>Cost</th>
                                        <th>Unit Cost</th>
                                    </tr></thead>
                                <tbody>
                                    <tr>
                                        <td>Item1</td>
                                        <td>Item2</td>
                                        <td>Item3</td>
                                        <td>Item4</td>
                                    </tr>

                            </table><br/><br/>
                            <!-- Table sortable2 -->

                            <label style="font-size: 18px; font-weight: bold;"> Estimated Printing Cost</label><br/><br/>
                            <label for="text13" style=" font-size: 16px;">Quantity</label> <br/>
                            <input id="text13" type="text" placeholder="" style="width: 155px; height: 28px;" /><br/><br/>
                            <label for="text14" style=" font-size: 16px;">Cost</label> <br/>
                            <input id="text14" type="text" placeholder="" style="width: 155px; height: 28px;" /><br/><br/>
                            <label for="text15" style=" font-size: 16px;">Unit Cost</label> <br/>
                            <input id="text15" type="text" placeholder="" style="width: 155px; height: 28px;" readonly="true" /><br/><br/>
                        </div>
                        <div class="col_3">
                            <!-- Select3 -->
                            <label for="select2">Paper</label> <br/>
                            <select id="select3">
                                <option value="0">- Choose a Paper -</option>
                                <option value="1">60 gsm</option>
                                <option value="2">70 gsm</option>
                                <option value="3">80 gsm</option>
                                <option value="4">100 gsm</option>
                                <option value="5">120 gsm</option>
                                <option value="6">150 gsm</option>
                            </select><br/><br/>
                            <!-- Select3 -->  
                            <!-- Select4 -->
                            <label for="select4">Binding</label> <br/>
                            <select id="select4">
                                <option value="0">- Choose a Binding Methode   -</option>
                                <option value="1">Hard Binding</option>
                                <option value="2">Perfect Binding</option>
                                <option value="3">Suddle Binding</option>
                                <option value="4">Thread Binding/Perfect Binding</option>

                            </select><br/><br/>

                            <!-- Select4 -->  
                            <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
                            <input type="submit" value="Save"  class="btn_hover"/>&nbsp;&nbsp;&nbsp;
                            <input type="submit" value="Reset" class="btn_hover" />

                        </div>
                        <div class="col_3">
                            <label style=" font-size: 16px;">Date</label><br/>
                            <input type="text" id="date" readonly="true" ><br/><br/>

                        </div>
                    </div>
                    <!-- Printing Department -->
                </form>
                <form action="####" method="Post"> 
                    <div id="tabr4" class="tab-content">
                        <div class="col_6">
                            <label for="text16" style=" font-size: 16px;">Present Price  </label><br/>
                            <input id="text16" type="text" placeholder="current Price" style="width: 355px; height: 28px;" /><br/><br/>
                            <label for="text17" style=" font-size: 16px;">Revise Price  </label><br/>
                            <input id="text17" type="text" placeholder="new Price" style="width: 355px; height: 28px;" /><br/><br/>
                            <label for="text18" style=" font-size: 16px;">Quantity   </label></span> <br/>
                            <input id="text18" type="text" placeholder="Qty" style="width: 355px; height: 28px;" /><br/><br/><br/>

                            <input type="submit" value="Approve"  class="btn_hover"/>&nbsp;&nbsp;
                            <input type="submit" value="Cancel" class="btn_hover" />&nbsp;&nbsp;
                            <input type="submit" value="Reset" class="btn_hover" />
                        </div>
                        <div class="col_4">
                            <!-- Textarea -->
                            <label for="textarea1" style="font-size: 18px; font-weight: bold;"> Remark</label><br/>
                            <textarea id="textarea1" placeholder="Type Here" style="width: 650px; height: 200px;" ></textarea>
                        </div>
                    </div> 
                </form>

            </td>
        </tr>

    </table>
    <!-- Tabs  -->

</body>

'

我使用 jsp 在 Java 中制作了一个小 webapp,但在登录身份验证方面遇到了一点问题。

  1. 我有 4 个不同的用户。在一个jsp页面中有4个标签

  2. 我需要给他们有限的标签访问权限。

eg-director(可以看到所有的标签)officer 1(只能看到可以访问3个标签)officer 2(只能看到可以访问2个标签)officer 3(只能看到可以访问1个标签)

这就像一个安全许可,我尝试了很多方法但都失败了,我正在考虑通过将布尔值传递给数据库并为此提供访问级别,如果它是一个小的示例登录项目,我需要帮助对我很有帮助

4

1 回答 1

1

试试这个方法,

登录成功后,将用户类型保存在会话中。然后在jsp中为角色添加以下条件。

比方说,我们想阻止“officer 2”访问 Tab 4。
然后在 Tab 4 的 jsp 中,添加以下条件。并且在其他jsp中也很明智。

<c:if test="${role== 'officer 2'}">
  <jsp: forward page="../invalidAccess.html"/>
</c:if>

或者,您可以使用过滤器来做同样的事情。过滤器比以前的方式更受欢迎。

于 2013-11-06T04:07:05.337 回答