Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP is not compiling

 
Krishna Acharya
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My JSP used to get compiled (to Java code) whenever I made any valid changes to it before. Now when I write Java code (as simple as creating string with hard coded string value) inside that JSP page, it does not compile and as a result of that, I can't see any change reflected when I run the JSP. However when I write log statement or System.out.println(), it works. Strange thing is: System.out.println() is also Java Code. Please note that JSP file is included (with <%@ include..) inside another JSP file (Parent). When I write Java code in Parent JSP, it just works. Please rest assured that: Java code that I wrote is correct and include directive (<%@ include..) is also correct (I have not make any change to that)

If I put the following code in already compiling and running JSP (Child), JSP file does not simply compile.
String myString = "Hello bro"

If I put the following code, it just works- meaning it gets compiled and it gets reflected when I run the JSP.
System.out.println("Hello Bro");

There should be some problem with compiling Java code in inner (child) JSP.

Thanks for your help guys!
 
Claude Moore
Ranch Hand
Posts: 795
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems a re-publish problem or some cache-related problem, but you should tell us more about IDE and appserver you're using.
 
Krishna Acharya
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I forgot to mention in the above post:
I am using WebSphere application server 7 as Application Server, and IntelliJ Idea IDE (13.1.2)
 
Claude Moore
Ranch Hand
Posts: 795
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know IntelliJ, but let's try... what about if you forcedly republish your project to websphere ?
Moreover, try to add to each JSP page HTML directives to prevent caching:



It's no more than a trail....
 
Krishna Acharya
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. Yes, I republished the project (.ear file) to websphere from websphere admin console. That's what I always do. I am less optimistic that this is cache issue because it does not compile if I put any java code and it immediately compiles if I remove the java code that I put that caused it to not compile but I will try that. Just sharing my thought. Thanks!
 
Krishna Acharya
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting fact about my problem:
If I put java code inside that JSP page it does not compile (I already mentioned that)
If I commented that code, it still does not compile.
If I remove (instead of commenting), it compiles (works!).

In laymen's language: that JSP sounds like a country where there is no rules and regulation! STRANGE!!!
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post the relevant JSP (the actual contents) and the complete error message. Without that it's just going to be guess work which I don't think is going to help much. For example:


If I put the following code in already compiling and running JSP (Child), JSP file does not simply compile.
String myString = "Hello bro"

If I put the following code, it just works- meaning it gets compiled and it gets reflected when I run the JSP.
System.out.println("Hello Bro");


You have a missing semi colon in the first statement which will cause a compilation failure. Of course, without looking at the actual JSP, I can't say if you posted it wrong here or if the JSP itself is missing the semi colon.
 
Claude Moore
Ranch Hand
Posts: 795
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's more than strange, it seems absurd..when you redeploy an ear, was should entirely replace all previous classes and artifacts -including JSPs, so i don't know your page may not reflect changes without something caching it. Is your was instance behind an http server? Moreover, try a simple experiment: in your jsp, just add some html static text and try and change it as well as java parts you modify. If even the html part is displayed unchanged, you're done: the problem is not with internal jsp compiler, simply changes aren't detected.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic