473,461 Members | 1,426 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Scriptlet code not accessible inside javascript (Not working Randomly)

Hi JSP experts,
I am having a JSP in my project which has some scriptlet code in the start and then javascript follows. Inside the javasript the values of variables defined inside the scriptlet code are accessed. The problem here is that most of the time this works very fine but at random or probably when this JSP page loads for the first time then it doesn't work.
The variable inside the scriplet code doesn't get initialized and then are not available inside the javascript. We are facing this issue at one of our customers and it has got escalted now. Any quick help would be much appreciated.

Please also find the initial JSP and the view source of the page below :

JSP :

<%@ page language="java" %>
<%@ taglib uri="/itc" prefix="itc" %>
<%@ page import="java.util." %>
<%@ page import="java.text." %>
<%@ page import="java.net.URLEncoder" %>
....
....
<%@ page import="com.sap.itc.admin.businessobject.manager.G lobalConfigManager" %>
<%@ page contentType = "text/html; charset=UTF-8" %>
<%@ include file="/common/nocache.jsp" %>

<%
final String employee = (String)request.getAttribute(ITCAdminConstants.EMP LOYEE);
final String hasPrepayProfile = (String)request.getAttribute(ITCAdminConstants.HAS _PREPAY_PROFILE);
final String orgOrEmpsNeedRecalc = (String)request.getAttribute(ITCAdminConstants.ORG _OR_EMPS_NEED_RECALC);
final String empNeedsRecalc = (String)request.getAttribute(ITCAdminConstants.EMP _NEEDS_RECALC);
final String resultsExported = (String)request.getAttribute(ITCAdminConstants.RES ULTS_EXPORTED);
final String newWeekSelected = (String)request.getAttribute(ITCAdminConstants.NEW _WEEK_SELECTED);
String empStartDateStr = null;
if (empStartDate != null)
{
empStartDateStr = TextUtils.formatDate(empStartDate, session);
}

...
...

//get userinfo and prepare effective date and day breaker
final UserInfo userInfo = UserInfo.getUserInfo(session);

...
...

int excpRows = 0; // number of rows in the punch exceptions table
int hourRows = 0; // number of rows in hour bins
int payRows = 0; // number of rows in pay bins
%>

<script language="JavaScript">

var g_use24HrTime = <%=userInfo.use24HrTime()%>;
var g_recalcAfterSave = <%=gcd.isRecalcAfterSave()%>;
var g_noEmployeeLoaded = <%= StringUtils.isEmpty(agtId) %>;
var g_hasPrepayProfile = <%= hasPrepayProfile %>;
...
...
</script>
<itc:frameController leftURL="/LoadSearchFilter.do" topURL="shell/navigation.jsp" layout="STANDARD_ISV" forceRefresh="true" selectedId="<%=agtId%>" />

<html>
<head>
<link type="text/css" href="/itcadmin/common/styles/iTimeClock.css" rel="stylesheet"/>
<script type="text/javascript" src="/itcadmin/common/scripts/calendar.js"></script>
...
...
<script type="text/javascript" src="/itcadmin/punches/evdata.js"></script>

<script language="javascript">

var week_day_str = new Array();

//=======================================benefits/adjustments======================================= ==========

var g_benadjustpopup_href = "/itcadmin/LoadBenAdjust.do";
function doBenAdjust(){
//set popup paramaters
var params = new Object();
params["empId"] = "<%=userInfo.getSelectedAgentId()%>"
params["employee"] = "<%=employee%>";
params["allowEditBenAdj"] = g_allowEditBenAdj ? "X" : "";
...
...
}

....
....
....
var g_processExcpMode = parent.frames[1].g_processExcpMode;

<%
if(!StringUtils.isEmpty(excpFilterId))
{
%>
g_processExcpMode = true;
<%
}
%>

var g_firstDayDefinition = <%=effDate.getDayOfWeek()%>; // default first day index
var g_rootOrgId = "<%= userInfo.getSelectedOrgId() %>";
var screenData = new Startup();


View Source :

<script language="JavaScript">

var g_use24HrTime = false; //None of these values are not getting updated according to the scriplet code
var g_recalcAfterSave = true;
var g_noEmployeeLoaded = true;
var g_hasPrepayProfile = false;
var g_orgOrEmpsNeedRecalc = false;
....
....

if(parent.frames[1]) // if left frame loaded
{
if(!g_noEmployeeLoaded) // employee is loaded; force a refresh of the emplist
{
parent.frames[1].g_processNewData = true;
}
}

</script>
<script language="JavaScript">try{ parent.g_processFrameSet("/itcadmin/LoadSearchFilter.do","/itcadmin/shell/navigation.jsp",parent.layouts.STANDARD_ISV, null, false, null, false);}catch(ignored) {}</script>

<html>
<head>
<link type="text/css" href="/itcadmin/common/styles/iTimeClock.css" rel="stylesheet"/>
<script type="text/javascript" src="/itcadmin/common/scripts/calendar.js"></script>
.....
....
<script type="text/javascript" src="/itcadmin/punches/evdata.js"></script>

<script language="javascript">

var week_day_str = new Array();

//=======================================benefits/adjustments======================================= ==========

var g_benadjustpopup_href = "/itcadmin/LoadBenAdjust.do";
function doBenAdjust(){
//set popup paramaters
var params = new Object();
params["empId"] = "null" //Notice this value is not getting filled
params["employee"] = "null"; //Notice this value is not getting filled
params["allowEditBenAdj"] = g_allowEditBenAdj ? "X" : "";
var ba_popup = new Popup(g_benadjustpopup_href, 680, 500, null, params);
...
...
}

....
....
....

var g_firstDayDefinition = 1; // default first day index //Notice these values still got filled
var g_rootOrgId = "70000724"; //Notice these values still got filled
var screenData = new Startup();
Apr 28 '10 #1
0 2273

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Thomas Born | last post by:
Hi; I use following code in an ASP page to generate a GUID: <% dim obj Set obj = Server.CreateObject("Scriptlet.TypeLib") Response.Write(obj.guid) Set obj = nothing %>
0
by: Lim Chee H | last post by:
Hi All, I have an ASP calling a scriptlet. There is a method "Exec" which is using Server.Execute to run any ASP file/command. There rest of the methods are working fine.Somehow,...
2
by: Hats | last post by:
Hi, I've a site with no php, but ssi and scriptlets do work. I tried these tags. ++++++++++++++++++++++++++++++++++++++++++++++++++ <object type="text/x-scriptlet"...
3
by: eddie | last post by:
Hi, my colleague wrote a scriptlet to get server wide environment variables from ASP. However, my web application is written by C#, and I try to write a program to access that COM but I always get...
2
by: ze colmeia | last post by:
Hi all... i'm having trouble trying to pass a field value from a Data Access Page to a Scriptlet. Om my DAP i have: Function returnId() Dim pId pId = formName.Id.value returnId = pId
8
by: abctech | last post by:
Hi All, I have a dynamic table in my web page which I'm creating in a jsp-scriptlet - <html> <body> <% out.write("<table>") ; // code to add rows dynamically to the table from my...
13
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains...
9
by: unlikeablePorpoise | last post by:
I would like to have an HTML dropdown list where each selection calls a method. The following code doesn't work, but it I hope it gives the idea of what I'm trying to do: <FORM NAME="frm">...
3
by: oaklander | last post by:
I have this scriptlet working in a JSP and was wondering how I can put it in a class file and call it in my JSP. <jsp:useBean id="pageinfo" class="mypackage.PageInfo" scope="session"/> ......
2
by: Andrey Fedorov | last post by:
Is the scope of a closure accessible after it's been created? Is it safe against XSS to use closures to store "private" auth tokens? In particular, in... ....can untrusted code access...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.