• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP compilation

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Below code works fine on first time but second time it will not work .

BasicCounter.jsp

<html>
<body>
The page count is :
<%out.println(Counter.getCount())%>;
</body>
</html>

------------------------------------------------------

package foo;

public class Counter{
private static int count ;
public static synchronized int getCount(){
count++;
return count;
}
}
----------------------------------------------------
I am not able to understand why it is working for first time ?
Please reply .

 
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Before I tried the code, what is the output for the second time? Did you get any exception?
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess Rushikesh you always get the same output instead of increasing count. It might be due to browser caching, but I'm just guessing...
 
rushikesh kalikar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Second time I am getting exception " Unable to compile jsp" but first time it deploys successfully.
 
Ranch Hand
Posts: 624
9
BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSP compilation is one-time activity. It is compiled when first time it is accessed and is loaded into memory.
On further access, it is accessed from memory.
Can you post the exact error and can you explain what exactly are doing? This will be helpful in identifying the root cause.
 
reply
    Bookmark Topic Watch Topic
  • New Topic