Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld >> Enterprise Java

Pages: 1
katie_c_s
stranger


Reged: 08/10/07
Posts: 10
Why is this variable changing in this jsp??
      #176167 - 07/25/08 03:20 PM

Here is my code:
Code:
 
String pageNumStr = request.getParameter("pageNum");
out.println("pageNumStr: " + pageNumStr);
int pageNum = 1;
int weekNum;

if(pageNumStr != null && pageNumStr.length() > 0) {
pageNum = Integer.parseInt(pageNumStr);
pageNum++;
}

weekNum = (pageNum-1) * -7;
date.add(Calendar.DAY_OF_WEEK, weekNum);

out.println("pageNum before: " + pageNum);

out.println("date: " + date.getTime());
%>
<%--header--%>
<jsp:include page="../header.jsp">
<jsp:param name="cd" value="."/>
<jsp:param name="sectionId" value="<%=sectionId%>"/>
</jsp:include>

<%--header--%>


<table cellSpacing="0" cellPadding="0" width="960" border="0" id="table3">
<tr>
<td vAlign="top" width="120">


<jsp:include page="../leftNavMenu.jsp">
<jsp:param name="sectionId" value="<%=sectionId%>"/>
<jsp:param name="cd" value=".."/>
</jsp:include>


<cache:cache key="<%=key%>" scope="application" time="<%=siftweb.getCacheTimeout()%>" >


</td>
<td width="4"><img height="1" src="<%=staticDirectories.getStaticLink()%>/section/t.gif" width="4"></td>
<td vAlign="top" width="2" bgColor="#000000">
<img height="1" src="<%=staticDirectories.getStaticLink()%>/section/b.gif" width="2"></td>
<td width="4"><img height="1" src="<%=staticDirectories.getStaticLink()%>/section/t.gif" width="4"></td>
<td vAlign="top" width="930"><!-- Start of StatCounter Code -->
<SCRIPT language=javascript type=text/javascript>
<!--
var sc_project = 1257901;
var sc_invisible = 1;
var sc_partition = 11;
var sc_security = "48a14f8b";
//-->
</SCRIPT>

<SCRIPT language=javascript src="http://www.statcounter.com/counter/counter.js"
type=text/javascript></SCRIPT>
<noscript><a href="http://www.statcounter.com/" target="_blank"><img
src="http://c12.statcounter.com/counter.php?sc_project=1257901&java=0&security=48a14f8b&invisible=1"
alt="hit counter code" border="0"></a>
</noscript>
<!-- End of StatCounter Code -->
<table cellSpacing="0" cellPadding="0" width="820" border="0" id="table5">
<tr>
<td vAlign="top" width="500"><font class="Small">
<table border="0" cellpadding="0" cellspacing="2" class="photos">
<tr>
<td align="center" valign="top"><font face="arial,helvetica">
<a class="DefaultLink" href="../Video/weeklyVideos.jsp?pageNum=<%=pageNum%>">Previous Week</a></font>
</td>
</tr>
<%
out.println("pageNum after: " + pageNum);



The print outs:

"pageNum before: 2"
"pageNum after: 1"

I can't figure out why these numbers are different. What am I missing? Thanks in advance!

--------------------
Newbie~don't breed or buy pets~Adopt,RECYCLE, RENEW, REUSE~


Post Extras: Print Post   Remind Me!   Notify Moderator  
Alucard
stranger


Reged: 07/16/08
Posts: 6
Re: Why is this variable changing in this jsp?? [Re: katie_c_s]
      #176315 - 07/26/08 06:09 PM

Is it possible that ../header.jsp or ../leftNavMenu.jsp reset or alter this variable?

Post Extras: Print Post   Remind Me!   Notify Moderator  
katie_c_s
stranger


Reged: 08/10/07
Posts: 10
Re: Why is this variable changing in this jsp?? [Re: Alucard]
      #176588 - 07/28/08 11:44 AM

No, it can't be the other jsps because pageNum is not a variable in either of those pages. Thanks though

--------------------
Newbie~don't breed or buy pets~Adopt,RECYCLE, RENEW, REUSE~


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:   

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 5397

Rate this topic

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5