Beniled
Beniled

Reputation: 1

How to I get my JSP code to run when I refresh my page

I have a JSP page that is a keypad emulator, like a keypad on a security door.

When the page loads the JSP makes a call to a java file that checks a txt document to see if the door is locked or not. If it is locked the keypad should not work, else if it is unlocked the keypad should be functional.

This text document is edited with a separate Java application and all that works. However when I load my site up, it makes the calls and correctly functions based on the contents of the text file at run time.

The problem is that when I use the Java application to edit the text file, while the site is running, and then hit refresh it continues in the state that it was in when the page was originally ran.

What I want to know is how do I re-execute the JSP portion of the page on page refresh... See if I change the content of the text file to unlocked and hit refresh the page should act as if it was unlocked, and if I then change it to lock and refresh, the page should act as if the keypad is locked. This is for a homework assignment so the requirements are not negotiable.

Thank you in advanced for any and all help.

Edit* Never mind I figured it out... It was doing it, I just had a minor syntactical error... used ....equals("unlocked") instead of ...equals("unlock")... duh... lol.

Upvotes: 0

Views: 784

Answers (1)

Laurent
Laurent

Reputation: 940

The JSP should re-execute everytime it's hit. Are you sure it's not a problem with the Java code that reads the file? Can you debug/log values in the Java code to make sure it's doing what's expected?

Otherwise, you could try explicitly setting the cache-control header to make sure that there's no caching going on.

Upvotes: 1

Related Questions