Results 1 to 2 of 2
  1. #1
    prashant7526 is offline Member
    Join Date
    Feb 2011
    Posts
    1
    Rep Power
    0

    Default Help me rguarding page forwading

    i have two pages.:- USING RAD:-
    SearchLeaveType.jsp:-
    <%
    //String PAGE_CODE="HRAR06";LEVM03
    String PAGE_CODE="LEVM020";
    %>
    <%@ include file= "/common/sessionValidator.jsp" %>

    <%
    request.setAttribute("title","SearchEmployee");
    %>

    <jsp:include page= "/common/topband.jsp" />
    <%
    ///YOU ARE REQUESTED NOT TO TOUCH ANY OF THE CODE ABOVE WITHOUT PRIOR PERMISSION.
    %>


    <%@ page language="java" import="java.util.*,java.io.*,java.text.*,com.sdne t.hr.support.*,
    com.sdnet.disnet.cmn.support.*, com.sdnet.disnet.customer.support.*, com.sdnet.util.common.*,
    com.sdnet.supnet.masters.support.*" %>


    <jsp:useBean id ="hrWorker" class="com.sdnet.hr.support.HRWorker" scope="request"/>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" height="385">
    <script language="JavaScript">
    function view()
    {

    var ind=window.document.form1.leaveType.options.select edIndex;
    if(window.document.form1.leaveType.options[ind].value=="Select")
    {
    alert("Please select a Leave Type first");
    }
    else
    {
    window.document.form1.submit();
    }
    }
    <%
    User user=(User)session.getValue("user");
    System.out.println("Prashant 1st-----------------------------------------------"+user);
    session.setAttribute("YearCode",request.getParamet er("YearCode"));
    String usercode=user.getUserCode();
    String yearcode ="";
    java.util.Date _yearcode = new java.util.Date();
    SimpleDateFormat simpledatef = new SimpleDateFormat ("yyyyMM");
    yearcode = simpledatef.format(_yearcode);
    // System.out.println(" oooo =======> "+yearcode.substring(0,4));
    //daWorker.showDetailLeaveApplication1(usercode,year code.substring(0,4));//change in this method ratish
    HashMap leave = new HashMap();
    //leave = daWorker.getleaveDetailnew(usercode); //
    //leave = daWorker.getleaveDetailnew1(usercode);
    request.setAttribute("leave", leave);
    String sysdate ="";
    java.util.Date _sysdate = new java.util.Date();
    SimpleDateFormat simpledf = new SimpleDateFormat ("dd'/'MM'/'yyyy");
    sysdate = simpledf.format(_sysdate);



    %>
    </script>


    <tr >
    <td colspan="2" class="heading" width="100%">SELECT LEAVE TYPE</td>
    </tr>
    <tr align="center" >

    <td colspan="2" width="100%" valign="top" height="352">

    <%
    ArrayList leaveT=(ArrayList)hrWorker.loadLeave();
    // String yearCode=request.getParameter("YearCode");

    // yearCode=session.getAttribute("YearCode");
    session.setAttribute("YearCode",request.getParamet er("YearCode"));

    String message =(String)request.getAttribute("error");
    %>

    <form name="form1" method="post" action="LeaveApplicationEntry.jsp">

    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <%
    if( (message != null) && ( (message.trim().length() ) > 0) )
    {
    %>

    <div align="center" >
    <span class="error" >
    <%=message %>
    </span>
    </div>


    <br>
    <%

    }
    else
    {

    }
    %>

    <table width="55%" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr>
    <td class="back">
    <table width="100%" border="0" cellspacing="1" cellpadding="3">
    <tr>

    <td class="back" width="35%">Select Leave Type :</td>

    <td class="tableback" width="65%">
    <select name="leaveType">
    <%
    for(int loopArrear=0;loopArrear<leaveT.size();loopArrear++ )
    {
    Hr leaveInfo=(Hr)leaveT.get(loopArrear);

    //String empVal=leaveInfo.getEmpCode()+"|"+empInfo.getEmplo yeeName()+"|"+yearCode;
    %>
    <option value="<%=leaveInfo.getLeaveType()%>"><%=leaveInfo .getLeaveType()%></option>
    <%
    // System.out.println("valueUser="+empVal+" "+empInfo.getEmpCode());
    }
    %>
    <option value="Select" selected>Select</option>
    </select>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    <br>
    <br>

    <input type="button" name="Submit" value="Submit" onClick="view() ">
    </form>
    </td>
    </tr>
    </table>
    <%
    %>
    <jsp:include page= "/common/bottomband.jsp" flush="true"/>

    and other is : LeaveApplicationEntry.jsp

    <html>
    <head>
    <link rel="stylesheet" type="text/css" href="main.css">
    <%
    String PAGE_CODE="LEVM02";
    /**

    * Copyright(c) 2001, Bharti Telesoft Ltd.
    * All Rights Reserved

    *-----------------------------------------------------------------------
    * Author Date History
    *-----------------------------------------------------------------------
    * ratish jha 12/08/2008 Initial Creation
    *-----------------------------------------------------------------------
    */
    %>
    <%@ include file= "/common/sessionValidator.jsp" %>
    <%
    System.out.println("Prashant in Leave Application Entry");
    request.setAttribute("title","Leave Application");
    %>
    <jsp:include page= "/common/topband.jsp" flush="true"/>

    <%
    System.out.println("Hello Prashant....................................1");
    User user1=(User)session.getValue("user");
    System.out.println("Hello Prashant....................................1"+req uest.getAttribute("leaveType"));
    System.out.println("Hello Prashant....................................1"+use r1);
    ///YOU ARE REQUESTED NOT TO TOUCH ANY OF THE CODE ABOVE WITHOUT PRIOR PERMISSION.
    %>

    <%@ page language="java" import="java.text.*, java.util.*,com.sdnet.util.common.SDNETUtil.*, com.sdnet.hr.support.*" %>
    <%@ page session="true" %>
    <%System.out.println("Hello Prashant....................................2"); %>
    <jsp:useBean id ="daWorker" class="com.sdnet.hr.support.DailyAttendenceWorker" scope="session"/>
    <jsp:setProperty name="rmWorker" property="*"/>
    <%System.out.println("Hello Prashant....................................3"); %>
    <!-- ***** This is the section of code you need to paste into your web pages ***** -->
    <script language="Javascript1.2">
    //04102008



    //end
    function isValidDate(s)
    {
    var ddmmyyyy = s.value;
    if(ddmmyyyy==null)
    {
    alert("Sorry date must be in dd/mm/yyyy format ");
    return false;
    }
    if(ddmmyyyy.length !=10)
    {
    alert("Sorry date must be in dd/mm/yyyy format ");
    return false;
    }
    var dd = ddmmyyyy.substring(0,2);
    var mm = ddmmyyyy.substring(3,5);
    var yyyy = ddmmyyyy.substring(6);
    var FirstSlash = ddmmyyyy.substring(2,3);
    var SecondSlash = ddmmyyyy.substring(5,6);
    if(FirstSlash != '/')
    {
    alert("Sorry date must be in dd/mm/yyyy format ");
    return false;
    }
    if(SecondSlash != '/')
    {
    alert("Sorry date must be in dd/mm/yyyy format ");
    return false;
    }
    var leap1 = parseInt(yyyy%4);
    if(dd<0 || dd>31)
    {
    alert("Sorry date between 1 and 31 ");
    return false;
    }
    if(mm<0 || mm>12)
    {
    alert("Sorry month between 1 and 12 ");
    return false;
    }
    if((dd==29) && mm==2 && leap1!=0)
    {
    alert("Not a valid leap yr ");
    return false;
    }
    if(mm==2)
    {
    if((dd==31) || (dd==30))
    {
    alert("Feb not having 30 and 31 ");
    return false;
    }
    }
    if((mm==4) ||(mm==6) ||(mm==9) ||(mm==11))
    {
    if(dd==31)
    {
    alert("4,6,9,11 not having 31 days");
    return false;
    }
    }
    return true;

    }

    function Save()
    {
    var leavefrom = form1.fromdate.value;
    var leaveto = form1.todate.value;
    leavefrom = leavefrom.substring(3,5);
    leaveto = leaveto.substring(3,5);
    if(leavefrom!=leaveto)
    {
    alert("Please Apply seperatly for each Month Leave as new Record");
    form1.todate.focus();
    }
    else if(form1.numberofdays.value=="")
    {
    alert("Please Insert Number of Days");
    form1.numberofdays.focus();
    }
    else
    {
    window.document.form1.submit();
    }
    }

    function checks(ob)
    {
    var flag=true;
    if(isNaN(ob.value))
    {
    alert("Please Enter Numeric Value Only");
    ob.value="";
    flag=false;
    ob.focus();
    }
    else if((flag)&&(parseFloat(ob.value)<0))
    {
    alert("(-)ve Amount is not allowed")
    ob.focus()
    }
    else if((flag)&&(ob.value==" "))
    {
    ob.value="";
    }
    checknumberofDays();
    }

    function chknull(ob)
    {
    var flag= true;
    if(ob.value=="")
    {
    alert("Field Can not Left Blank");
    flag=false;
    ob.focus();
    }
    }
    //30092009


    function checkf(ob)

    {

    var FestivalLeave=document.form1.FestivalLeave.value;
    //alert("FestivalLeave=="+FestivalLeave);


    var numberofdays=eval(document.form1.numberofdays.valu e);
    //alert("numberofdays=="+numberofdays);
    if (FestivalLeave=='y' )
    {
    if( parseFloat(form1.numberofdays.value)>1)
    {
    alert("Please aqpply only one day festival leave ");
    document.form1.numberofdays.value=1;
    document.form1.todate.value=document.form1.fromdat e.value
    //document.form1.FestivalLeave.value=false;
    //FestivalLeave
    //form1.numberofdays.focus();
    //return false;
    }
    }

    }

    //end

    //end
    function checknumberofDays()
    {
    if(parseFloat(form1.numberofdays.value)>parseFloat (form1.leavebalence.value))
    {
    alert("You can not applied the Leave");
    form1.numberofdays.focus();
    form1.numberofdays.value="";
    }
    }
    <%
    User user=(User)session.getValue("user");
    String usercode=user.getUserCode();
    String yearcode ="";
    java.util.Date _yearcode = new java.util.Date();
    SimpleDateFormat simpledatef = new SimpleDateFormat ("yyyyMM");
    yearcode = simpledatef.format(_yearcode);
    // System.out.println(" oooo =======> "+yearcode.substring(0,4));
    daWorker.showDetailLeaveApplication1(usercode,year code.substring(0,4));//change in this method ratish
    HashMap leave = new HashMap();
    //leave = daWorker.getleaveDetailnew(usercode); //
    leave = daWorker.getleaveDetailnew1(usercode);
    request.setAttribute("leave", leave);
    String sysdate ="";
    java.util.Date _sysdate = new java.util.Date();
    SimpleDateFormat simpledf = new SimpleDateFormat ("dd'/'MM'/'yyyy");
    sysdate = simpledf.format(_sysdate);



    %>
    </script>
    <body>
    <form name="form1" method="get" action="LeaveApplicationEntryC.jsp">
    <table width="100%" height="150" border="0" align="center" cellspacing="0" cellpadding="0" id="table1">
    <tr>
    <td class="heading" width="100%">Leave Application</td>
    </tr>
    <tr><td>&nbsp;</td></tr>
    <tr><td>&nbsp;</td></tr>
    <tr>
    <td width="100%">
    <table width="100%" border="1" cellspacing="0" cellpadding="0" id="table2">
    <tr><input type="hidden" name="usercode" value="<%=usercode %>">
    <input type="hidden" name="yearcode" value="<%=yearcode.substring(0,4) %>">
    <input type="hidden" name="gradecode" value="<%=daWorker.getGradecode() %>">
    <input type="hidden" name="deptcode" value="<%=daWorker.getDeptcode() %>">
    <input type="hidden" name="locationcode" value="<%=daWorker.getLocationcode() %>">
    <!-- 22092008 -->

    <input type="hidden" name="emailid" value="<%=daWorker.getEmailid() %>">
    <input type="hidden" name="empname1" value="<%=daWorker.getEmpname() %>">
    <%//System.out.println("emailid in jsp page is ----22092008----------"+daWorker.getEmailid()); %>
    <!-- end -->

    <td class="back" width="25%" height="20">Employee Name</td>
    <td class="tableback" width="25%" height="20"><%=daWorker.getEmpname() %></td>
    <td class="back" width="25%" height="20">Grade Name</td>
    <td class="tableback" width="25%" height="20"><%=daWorker.getGradename() %></td>
    </tr>
    <tr>
    <td class="back" width="25%" height="20">Department Name</td>
    <td class="tableback" width="25%" height="20"><%=daWorker.getDeptname() %></td>
    <td class="back" width="25%" height="20">Designation</td>
    <td class="tableback" width="25%" height="20"><%=daWorker.getDesigname() %></td>
    </tr>
    <tr>
    <td class="back" width="25%" height="20">Category</td>
    <td class="tableback" width="25%" height="20"><%=daWorker.getCatname() %></td>
    <td class="back" width="25%" align="center">Leave Balance</td>
    <TD width="25%" align="left" class="tableback"><input type="text" name="leavebalence" class="maninput" readonly value="<%=daWorker.getLeavebalance() %>"></TD>

    </tr>

    </table>
    <tr>
    <td>
    <table width="100%" border="1" cellspacing="0" cellpadding="0">
    <tr>
    <td align="center" class=back rowspan="1" width="10%">Leave No</td><!-- 06102008 -->
    <td align="center" class=back rowspan="1" width="10%">Date of Application</td>
    <td align="center" class=back rowspan="1" width="10%">No of Days</td>
    <td align="center" class=back colspan="1" width="15%">Leave Applied Period</td>
    <td align="left" class=back rowspan="1" width="15%">Reasons</td><!-- 26092008 -->
    <td align="left" class=back rowspan="1" width="10%">IMP Approved Date</td><!-- 26092008 -->
    <td align="left" class=back rowspan="1" width="10%">IMP Status</td><!-- 29092008 -->
    <td align="left" class=back rowspan="1" width="10%"> Hod Approved Date</td><!-- 29092008 -->
    <td align="left" class=back rowspan="1" width="8%">HodStatus</td><!-- 26092008 -->
    <td align="left" class=back rowspan="1" width="10%">HRA Approved Date</td><!-- 26092008 -->
    <td align="left" class=back rowspan="1" width="10%">HRA AppStatus</td><!-- 26092008 -->
    <td align="left" class=back rowspan="1" width="10%">Cancel</td><!-- 26092008 -->
    <td align="left" class=back rowspan="1" width="10%">Cancel Date</td><!-- 26092008 -->


    </tr>

    <%
    leave = (HashMap)request.getAttribute("leave");
    if(leave.size()>0)
    {
    //for(int i=0;i<leave.size()/4;i++)
    //System.out.println("leave.size()==========="+leave .size());
    //09102008 for(int i=0;i<leave.size()/11;i++)
    for(int i=0;i<leave.size()/15;i++)
    {
    %>
    <tr>
    <td align="center" class="tableback" height="10"><%=leave.get("leaveno"+i) %></td>
    <td align="center" class="tableback" height="10"><%=leave.get("applieddate"+i) %></td>
    <%
    //HashMap h11=;
    //if((leave.get("fleave"+i)=="Y") || ((leave.get("fleave"+i)).equals("Y")))
    //System.out.println("-------------leave f==="+leave.get("fleave"+i));
    if((leave.get("fleave"+i)==null) || (leave.get("fleave"+i)=="") || (leave.get("fleave"+i)=="N" ))
    {
    //leave.get("fleave"+i);

    %>
    <td align="center" class="tableback" height="10"><%=leave.get("leavetotal"+i) %> </td>
    <% } else {%>
    <td align="center" class="tableback" height="10"> <%=leave.get("leavetotal"+i) %></td>

    <%} %>

    <td align="center" class="tableback" height="15"><%=leave.get("leavefrom"+i) %>- <%=leave.get("leaveto"+i) %></td>

    <td align="left" class="tableback" height="15"><%=leave.get("reasons"+i) %></td><!-- start -->
    <%//System.out.println("reasons================"+leave .get("reasons"+i) );%>
    <!-- 09102008 -->
    <%
    if((leave.get("VERIFIEDON"+i)==null) || (leave.get("VERIFIEDON"+i)==""))
    {
    //leave.get("fleave"+i);

    %>
    <td align="center" class="tableback" height="10"></td>
    <% } else {%>
    <td align="center" class="tableback" height="10"> <%=leave.get("VERIFIEDON"+i)%></td>

    <%} %>

    <%
    if((leave.get("VERIFYSTATUS"+i)==null) || (leave.get("VERIFYSTATUS"+i)==""))
    {
    //leave.get("fleave"+i);

    %>
    <td align="center" class="tableback" height="10">-</td>
    <% } else {%>
    <td align="center" class="tableback" height="10"> <%=leave.get("VERIFYSTATUS"+i)%></td>

    <%} %>

    <%
    if((leave.get("HODVERIFIEDON"+i)==null) || (leave.get("HODVERIFIEDON"+i)==""))
    {
    //leave.get("fleave"+i);

    %>
    <td align="center" class="tableback" height="10">-</td>
    <% } else {%>
    <td align="center" class="tableback" height="10"> <%=leave.get("HODVERIFIEDON"+i)%></td>

    <%} %>
    <%
    if((leave.get("HODVERIFYSTATUS"+i)==null) || (leave.get("HODVERIFYSTATUS"+i)==""))
    {
    //leave.get("fleave"+i);

    %>
    <td align="center" class="tableback" height="10">-</td>
    <% } else {%>
    <td align="center" class="tableback" height="10"> <%=leave.get("HODVERIFYSTATUS"+i)%></td>

    <%} %>

    <%
    if((leave.get("APPROVEDON"+i)==null) || (leave.get("APPROVEDON"+i)==""))
    {
    //leave.get("fleave"+i);

    %>
    <td align="center" class="tableback" height="10">-</td>
    <% } else {%>
    <td align="center" class="tableback" height="10"> <%=leave.get("APPROVEDON"+i)%></td>

    <%} %>

    <%
    if((leave.get("APPSTATUS"+i)==null) || (leave.get("APPSTATUS"+i)==""))
    {
    //leave.get("fleave"+i);

    %>
    <td align="center" class="tableback" height="10">-</td>
    <% } else {%>
    <td align="center" class="tableback" height="10"> <%=leave.get("APPSTATUS"+i)%></td>

    <%} %>

    <!-- 18112008 -->
    <%
    if((leave.get("cstatus"+i)==null) || (leave.get("cstatus"+i)==""))
    {
    //leave.get("fleave"+i);

    %>
    <td align="center" class="tableback" height="10">-</td>
    <% } else {%>
    <td align="center" class="tableback" height="10"> <%=leave.get("cstatus"+i)%></td>

    <%} %>

    <%
    if((leave.get("cdate"+i)==null) || (leave.get("cdate"+i)==""))
    {
    //leave.get("fleave"+i);

    %>
    <td align="center" class="tableback" height="10">-</td>
    <% } else {%>
    <td align="center" class="tableback" height="10"> <%=leave.get("cdate"+i)%></td>

    <%} %>
    <!-- end -->


    <!-- end -->


    </tr>
    <% }
    } %>
    </table>
    </td>
    </tr>
    <tr>
    <td>
    <table width="100%" border="1" cellspacing="0" cellpadding="0">
    <tr>
    <td align="center" class=back rowspan="2" width="25%">Date of Application</td>
    <td align="center" class=back rowspan="2" width="25%">No of Days</td>
    <td align="center" class=back colspan="2" width="50%">Leave Applied Period</td>
    </tr>
    <tr>
    <td align="center" class="back">From(DD/MM/YYYY)</td>
    <td align="center" class="back">To(DD/MM/YYYY)</td>
    </tr>
    <tr>
    <td align="center" class="tableback"><input type="text" name="dateofapplication" class="maninput" readonly value="<%=sysdate %>"></td>
    <td align="center" class="tableback"><input type="text" name="numberofdays" size="10" class="maninput" onblur="checks(this)"></td>
    <td align="center" class="tableback"><input type="text" name="fromdate" size="10" maxlength="10" class="maninput" onblur="isValidDate(this)"></td>
    <td align="center" class="tableback"><input type="text" name="todate" size="10" maxlength="10" class="maninput" onblur="isValidDate(this)"></td>
    </tr>

    <!-- 04102008 -->
    <%

    //estivalLeave=request.getParameter("FestivalLeave") ;
    //System.out.println("FestivalLeave============="+Fe stivalLeave);
    String available="";
    String yearcodel=yearcode.substring(0,4);
    System.out.println("yearcodel=========="+yearcodel );
    available=daWorker.loadklleaveStatus(usercode,year codel);
    //System.out.println("FestivalLeave======available== =04102008===="+available);
    //07102008
    if(available==null || available=="")
    {
    available="N";
    }
    //end
    boolean success = false;
    if(available.equalsIgnoreCase("Y"))
    {
    //System.out.println("FestivalLeave====if==available ===04102008===="+available);
    %>
    <tr>
    <td class="back" width="50%" align="center">Festival Leave:</td>
    <td class="tableback" colspan="3">
    <input type="checkbox" name="FestivalLeave" value="N" checked DISABLED> </td></tr>
    <%}

    else
    {
    //System.out.println("FestivalLeave=====else==041020 08===="+available);
    %>
    <tr>
    <td class="back" width="50%" align="center">Festival Leave:</td>
    <td class="tableback" colspan="3">
    <input type="checkbox" name="FestivalLeave" value="y" onclick="checkf(this)"> </td></tr>
    <%} %>

    <!-- end -->
    </table>
    </td>
    </tr>
    <tr>
    <td>
    <table width="100%" border="1" cellspacing="0" cellpadding="0">
    <tr>
    <td class="back" width="50%" align="center">Reasons</td>
    <td width="50%" align="center" class="tableback"><TEXTAREA name="reasons" class="maninput" cols="50"></TEXTAREA></td>

    </tr>
    </table>

    </td>
    </tr>
    <tr>
    <td>
    <table width="100%" align="center">
    <tr>
    <td width="100%" align="center"><input type="button" name="Submit" value="Apply" onClick="Save()">


    </tr>
    </table>
    <tr><td>&nbsp;</td></tr>
    <tr><td>&nbsp;</td></tr>
    </table>
    </form>
    </body>
    </html>
    <jsp/common/bottomband.jsp/bottomband.jsp" flush="true"/>


    now when i am passing from 1st page to second page it giving error 500 NULL POINTER exception in USEBEAN TAG of second file
    <jsp:useBean id ="daWorker" class="com.sdnet.hr.support.DailyAttendenceWorker" scope="session"/>
    <jsp:setProperty name="rmWorker" property="*"/>

    can anyone help me?

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default

    Almost no one is going to look at a code dump like that.
    Even if you stuck code tags round it it's far too much.

    All we really needed was the error and where it was coming from (ie the last few lines of your post).

    There is no daWorker attribute stored in the session.

    Oh, and I'd say you had stuff going on in there that should not be in JSPs.

Similar Threads

  1. Go back to previous page using session in JSP page
    By gopikarikati009 in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 06-23-2011, 10:30 AM
  2. Replies: 0
    Last Post: 03-02-2010, 08:28 AM
  3. Error in forwading file to mail...
    By rakesh_n_mehta in forum Advanced Java
    Replies: 15
    Last Post: 02-09-2009, 01:28 PM
  4. setting the view to a jsp page from a self refeshing page
    By deepal_205 in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 08-15-2008, 04:41 PM
  5. warning that page has expired and i need to refresh the page again
    By 82rathi.angara in forum JavaServer Pages (JSP) and JSTL
    Replies: 5
    Last Post: 07-15-2008, 01:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •