It's not a secret anymore!*
The moose likes JSP and the fly likes Please rectify my syntax error in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Please rectify my syntax error in jsp" Watch "Please rectify my syntax error in jsp" New topic
Author

Please rectify my syntax error in jsp

sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear All,Please rectify my code so that i should not face
the syntax error.
<%

int cmp = 0;int cmp_temp=0;int total=0;
if(session.getValue("abc")!=null)
{
BankLog.l("iNoOfRec : "+iNoOfRec);
for(int iCount=0;iCount < iNoOfRec;iCount++ )
{
cmp_temp=Integer.parseInt((String)inVec.elementAt(3));
cmp=cmp+cmp_temp;
}
total=cmp+session.getValue("abc");
session.putValue("abc",total);
}
else
{
session.putValue("abc",0);
}
%>
aswin kumar
Greenhorn

Joined: Dec 25, 2008
Posts: 12
hi,

just check these,

int cmp = 0;int cmp_temp=0;int total=0;


total is also changed again to zero because it is now in method scope so ,according to your requirement declare as a variable in class level scope,
like
<%!int total=0%>, hope it is useful for you,

regards
sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear Aswini Sir,
My doubt is
how i write the same code example <% if {%>.
Actually i am begineer .Hp you must rectify my code.

Thanks and Regards
Sumanta


<%

int cmp = 0;int cmp_temp=0;int total=0;
if(session.getValue("abc")!=null)
{
BankLog.l("iNoOfRec : "+iNoOfRec);
for(int iCount=0;iCount < iNoOfRec;iCount++ )
{
cmp_temp=Integer.parseInt((String)inVec.elementAt(3));
cmp=cmp+cmp_temp;
}
total=cmp+session.getValue("abc");
session.putValue("abc",total);
}
else
{
session.putValue("abc",0);
}
%>
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41571
    
  54
You didn't tell us what the error is that you're getting. Post the complete stack trace (you may have to look at the server's log files to see it).

you must rectify my code.

That doesn't sound like a really nice way of asking for help. You may want to get in the habit of using more polite language.


Ping & DNS - my free Android networking tools app
sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Sorry Sir,Please forgive me if i am wrong.

Thanks and Regards
Sumanta
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61043
    
  66

My suggestion would be to learn good practices right off the bat and not put any Java code in your JSPs.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please rectify my syntax error in jsp