Jstl Usage

Hi  Dove :)

Just wondering, how much am addicted to you.
I mean, you been the total inspiration at each part of the life :)
Lately, i been enjoying all the little pleasures of life and making others happy. Just like you do all the time :)

At each part, each second of life.. you are on my mind.Thanks for the total smiles and inspiration.
And this JSTL, you taught me, how to learn things easily.

Its total your inspiration that lean me to learn Jsp, JSTL, CSS and all. Now am total confident in all these.
I wish i would have that all my life. Yet am lucky to know you in this life.

Love you dove  :)


<%@ page language="java" contentType="text/html"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="/resource/tlds/UserActionRoles.tld" prefix="UserActionRoles" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Add Users</title>
<script type="text/javascript"
    src="<c:url value="/resource/js/jquery.min.js"/>"></script>
<script type="text/javascript"
    src="<c:url value="/resource/js/jquery-ui.min.js"/>"></script>
<link rel="stylesheet"
    href="<c:url value="/resource/css/overcast/jquery-ui.css"/>"
    type="text/css"></link>
<link href="<%=request.getContextPath()%>/resource/css/layout.css"
    rel="stylesheet" type="text/css">
<link rel="stylesheet" href="<c:url value="/resource/css/style.css"/>"
    type="text/css"></link>

<script type="text/javascript">


   
    $(document)
            .ready(
                    function() {
                        $("input:submit, a, button").button();
                        $(".portlet")
                                .addClass(
                                        "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all")
                                .find(".port-header").addClass(
                                        "ui-widget-header ui-corner-all")
                                //.prepend( "<span class='ui-icon ui-icon-minusthick'></span>")
                                //.end()
                                .find(".portlet-content");
                       
                       
                       
                    });
       
    jQuery(document).ready(
           
            function($){
                    $('#panel').fadeOut('slow', function() {                       
                      });
                $("#imgexp").toggle(function(){
                    $("#panel").hide();
                    $('#main_header').css('margin-top','25px');
                },
                function(){
                    $("#panel").show();
                    $('#main_header').css('margin-top','0');
                    $("#panel").attr('title', 'This is the hover-over text');

                }

                 );
                /* $("#btn-submit").click(function () {
                    $("#roleName_Div").effect("shake", {times: 2, distance: 2}, 50);
                }); */
            }
        );
</script>

<c:set var="uarVariableNames" scope="page" value="${UserActionRoles:getNames()}"/>
<c:set var="uarVariableValues" scope="page" value="${UserActionRoles:getVariables()}"/>
<c:set var="EditFlag" scope="page" value = "${param.EditAction}" />
<c:set var="EditRoleName" scope="page" value = "${param.RoleName}" />

<script type="text/javascript">

function beforeSubmit()
{
    if(document.getElementById('roleName') != null)
    {
        var roleName = document.getElementById('roleName').value;
        if(roleName == null || roleName == "")
        {
            document.getElementById('roleName').value = 'Plz enter Role Name';
            document.getElementById('roleName').style.color = "red";
           
            return false;
        }
    }
   
    var atleastOne = false;
   
    <c:forEach var="i" begin="0" end="${fn:length(uarVariableValues) -1}" >       
        <c:set var="variable_name" value="${uarVariableValues[i]}" />
        var temp = document.getElementById("${variable_name}").checked;
       
        /* <c:if test="fn:containsIgnoreCase(variable_name, 'delete') == true" >
            <c:set var="deleteRole" value = "true" />
        </c:if> */
       
        if(temp == true)
        {
            document.getElementById('tempValue').value = 1;
            atleastOne = true;
        }
        else
        {
            document.getElementById('tempValue').value = 0;   
        }
       
        /*
        <jsp:useBean id='UserActionRoles' class='com.arrayshield.sdk.asas.adminRoles.UserActionRolesTable'>
            <c:set target='${UserActionRoles}' property='${uarVariableValues[i]}' value=''/>
        </jsp:useBean>
        */
       
    </c:forEach>
   
/*     if('${deleteRole}' == true)
    {
        alert('here');   
    }
 */
     if(atleastOne == false)
     {
        var answer = confirm ("Add role with no roles at all?");
        if (answer)   
        {
            document.addRoleForm.submit();
        }
       
        return false;
     }
   
    document.addRoleForm.submit();
}

function focus()
{
    if("${EditFlag}" == 0)
    {
        document.getElementById('roleName').value = "";
        document.getElementById('roleName').autocomplete = "off";
        document.getElementById('roleName').focus();
    }
    else
    {
        document.getElementById('EditAction').value = "EditAction";
        document.getElementById('roleName').value = "${EditRoleName}";
        document.getElementById('roleName').readOnly = true;
        document.getElementById('btn-submit').value = "Update Role";
    }
}

function onFocus()
{
    document.getElementById('roleName').value = "";
    document.getElementById('roleName').style.color = "brown";
}

</script>
        <body onload="focus();" style="padding-bottom: 0px;">
            <form name="addRoleForm" method="post" action="../Admin/SaveOrUpdateRole">
   
   
                    <input type="hidden" id="tempValue" name="tempValue" >                   
                    <input type="hidden" id="EditAction" name="EditAction" >
                   
                <!-- Expander Help Text -->
                <!-- <img id="imgexp" style="float:left;" alt="Expand Div" src="../resource/images/inlinehelp1.png"/>
                <div id="panel" class="expander_text">
                    <font size="-1" id="fonttext" face="Arial">This feature enables you to add
                        role into the IDAS system.</font>
                </div> -->
               
                <!-- Main Header -->
                <!-- <div id = "main_header" class="port-header ui-widget-header ui-corner-all" style="width:30%; text-align:center;margin:20px auto;">Add Role</div> -->
                                           
                <div id="roleName_Div" style="background-color: #E7E6E6;margin-bottom: 13px;margin-left: 23%;margin-top:
                            40px;padding: 16px; width: 50%;border-radius:10px">
                    <font style="font-size:19px;padding-right:30px;">Role Name</font>
                    <input class= "input_role" type="Text" id="roleName" name="roleName" size="50" maxlength="50"
                            onfocus="onFocus()" />
                </div>
                      <div id="user_management_roles" class="expander_text" style="margin-left:10%;height:50%">
                      <table style="margin-left: 125px;width:100%">   
                        <c:forEach var="i" begin="0" end="${fn:length(uarVariableNames) -1}" >                     
                            <c:set var="flag" scope="page" value="${!flag}" />
                              <c:if test = "${flag eq true }">
                                  <tr>
                              </c:if>   
                              <c:choose>
                                  <c:when test='${flag eq "true"}' >
                                        <td >
                                          <input type="checkbox" id="${uarVariableValues[i]}" value="1" >
                                        <font style="font-size:17px;padding-right:30px;"><c:out value="${uarVariableNames[i]}"/></font>
                                    </td>
                                </c:when>
                                <c:otherwise>
                                    <td>
                                          <input type="checkbox" id="${uarVariableValues[i]}" value="1" >
                                        <font style="font-size:17px;padding-right:30px;"><c:out value="${uarVariableNames[i]}" /></font>
                                    </td>
                                </c:otherwise>
                            </c:choose>
                            <c:if test = "${flag eq false }">
                                  </tr>
                              </c:if>
                          </c:forEach>
                    </table>       
                    </div>               
               
                <div style="margin: 0 auto;padding-top: 15px;width: 13%;">
                <input type="button" value="Add Role" id="btn-submit" class="submit_button" onclick="return beforeSubmit();">
                </div>
                               
            </form>
        </body>
   
</html>