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 and run time variables.  RSS feed

 
Karthik Muthukumaraswamy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I will first brief my requirement. I have JSP pages which have Javascript alert boxes (for my own debugging purposes) scattered all over them. As a developer I am fine with these alert boxes, but other people who test the application are better off not seeing these alert boxes. It ANNOYS them :-).

Now the question:
-----------------
I am planning to use some kind of "global JSP variable" that determines whether these alert boxes are shown to the user or not. I was thinking about doin this setting at a later stage i.e., during compilation, build (i use Apache Ant to build the app). But, I have little idea how to actually do it.

Do you think of any solution that could help me set this variable. I guess this is rather a peculiar situation, but I also believe that some one faced a similar situation.

Thank you.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alerts are annoying.

Under what conditions will they be disabled? Are you planning to have separate builds? Do you want to set it in a properties file? In the deployment descriptor? Let the user chose?

There are many choices and possibilities.
[ November 10, 2006: Message edited by: Bear Bibeault ]
 
Karthik Muthukumaraswamy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Under what conditions will they be disabled?
I would want the alert boxes disabled while building the application. So, this would mean that I(developer who builds and deploys the app to the testing/production server) would like to pass the "choice" while building the application.

2)Are you planning to have separate builds?
Yes, according to the answer to Q1.

3)Do you want to set it in a properties file?
If I can dynamically alter values in these properties file.

4)In the deployment descriptor?
If I have an option to do so.

5)Let the user chose?
No the user need not have the option. As I mentioned in Answer 1 above, it is a choice that the developer should have. The developer determines whether the current build will have alert boxes disabled or not).

Note:
I am deploying the app on a JBOSS server and we use Struts.

Thanks.
-Karthik.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, one way: use your build (using ant?) to set the value of a context parameter in the deployment descriptor to true or false.

You can use this to make on-page decisions (<c:if>) about whether to incldue the alerts or not.

Or better yet, factor the alerts into a JavaScript function that uses the context param to decide whether to actually show the alert.
 
Karthik Muthukumaraswamy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,
Thanks for the reply. I will try your ideas and will keep you posted.
-karthik.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!