This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP compilation  RSS feed

 
rushikesh kalikar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • 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 .

 
Himai Minh
Ranch Hand
Posts: 1566
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before I tried the code, what is the output for the second time? Did you get any exception?
 
Ankit Garg
Sheriff
Posts: 9610
37
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Second time I am getting exception " Unable to compile jsp" but first time it deploys successfully.
 
Tapas Chand
Ranch Hand
Posts: 614
9
BSD Java
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!