aspose file tools*
The moose likes Struts and the fly likes Moving run time issues to compile time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Moving run time issues to compile time" Watch "Moving run time issues to compile time" New topic
Author

Moving run time issues to compile time

Yogesh Gandhi
Ranch Hand

Joined: Dec 05, 2008
Posts: 206
Hey Friends,

A very frequent problem I face with JSP's. I have an idea, I want you guys to comment if such a thing already exists in market or not...

In our projects we usually use <bean:message tag...where we refer to Resource.properties for the key...

And many times, we do forget to add that key in resource bundle, or it gets missed by mistake during merging process.....

In such a scenario, it gives a white screen when JSP is accessed on websphere... and one has to go to system logs to check where is the problem... and if such mistake happens to be in production environment, that is even worse.... Client yells on me...

So, i was wondering, if it could be possible to identify this issue at compile-time, during the compilation of JSP...because, its a general practice of developer that he atleast compiles his JSP before merging it to production....So if such an error comes at compile time, he could be saved of issues that might come up at run time...

What do you guys have to say about this?
Is there any such product already existing in market? or this is practically impossible or any thing that comes to your mind !!!

Waiting for your responses...
>
Moises Lejter
Greenhorn

Joined: Aug 10, 2006
Posts: 3
Ideally, this would be something that you could get the IDE to validate for you...

As an alternative, there's a question on stackoverflow that discusses several alternatives, when one is trying to use Java constants in JSP EL expressions:
http://stackoverflow.com/questions/3732608/how-to-reference-constants-in-el

The suggestion in the question, though, is one way in which you could get compile-time validation that you are indeed defining all the constants you'd need: you can use
<%=Addresses.URL%>
to reference Java constants by their name.

You could then define a class that defines a Java String constant for each key you intend to use, then reference keys in your JSPs by using references to the Java constants in your class.
If you now compile all your JSPs before deploying the application, any reference to a String constant that is not in your class will result in a compile-time exception when compiling that JSP...

Granted, this wouldn't help you, if you forget to define the value for that key...

Moises
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Moving run time issues to compile time
 
Similar Threads
Why Microsoft sucks?
comments in Java Class
Career Issue
weired wep application error
Arrogant programmers and economic climate