Hi,
I have a problem with some jsp pages firing twice.
In a jsp page I have a bundle. It is called exactly once. Inside the bundle it makes a save to the jcr. This save is called exactly once inside the bundle. It is done at the entrance to the bundle. This save method is not part of a conditional or a loop.
When debugging the page in Eclipse I attach to LocalHost set up in debug mode.
Straight after the bundle is created then its service method called in the jsp I place an arbitrary html header tag to print out an arbitrary numerator.
Inside Eclipse as I debug the code inside the bundle gets called, then straight after the bundle exits it immediately gets called again.
The jsp still has not got to the next line straight after the bundle's method is called.
Straight after the second iteration through the bundle the control returns to the jsp.
This also occurred on a separate component that ends up sending an email twice.
Regards
Clive Stewart
Solved! Go to Solution.
Views
Replies
Total Likes
I have found what caused the jsp to fire twice in my case.
If any variable on the jsp gains a null and then a read to the variable is done the server re parses the page.
In the jsp any variable calling to a service that could fail or return a null needs to be first checks for null.
Example
var a = whateverMethod();//where {in pseduocode where var can be an object, String etc} private String whateverMethod() {returns a variable that is null from a failed process inside a try catch}.
String b = (String) a;
The server appears to try parse the line twice before continuing onto the next line in the jsp.
In my case I resolved it by using
String b = "";
if (a != null) {
b =(String) a;
} else {
b = {default};
}
Views
Replies
Total Likes
I have found what caused the jsp to fire twice in my case.
If any variable on the jsp gains a null and then a read to the variable is done the server re parses the page.
In the jsp any variable calling to a service that could fail or return a null needs to be first checks for null.
Example
var a = whateverMethod();//where {in pseduocode where var can be an object, String etc} private String whateverMethod() {returns a variable that is null from a failed process inside a try catch}.
String b = (String) a;
The server appears to try parse the line twice before continuing onto the next line in the jsp.
In my case I resolved it by using
String b = "";
if (a != null) {
b =(String) a;
} else {
b = {default};
}
Views
Replies
Total Likes
Views
Like
Replies
Views
Likes
Replies