I have a really interesting situation under very normal circumstances, or so I thought.
My dev environment is Apache HTTP 2.2 -> Tomcat 6, Java 6
I have an HTML form posting to a servlet. The servlet receives the request, does some validation, adds some attributes to the request, and forwards to a JSP. The JSP runs in its entirety as evidenced through several System.out's littered throughout the page. The servlet stops processing as it should, as evidenced by the lack of the existence of a the result of a System.out in the servlet.
The really strange thing is, though, is that the client is left with a valid, but blank HTML page. I have no idea what is generating the blank page, but it nonetheless is what is returned to the client.
This may be more than what you want to see, but here is the code. Here is the servlet.
If you don't see output from code which ought to produce output, that usually means that said code was not executed. I think in the example you displayed that could be because the line before it threw an exception.
If you see the System.out message "person map failed, forwarding back" then the servlet should forward to your jsp as the next step. So, (if you haven't done so already), check your logs if there are any exceptions for not finding the jsp, or if there are exceptions when it tries to execute. You could also add a System.out at the top of your jsp so you know it actually starts executing:
posted 10 years ago
My apologies for the combined reply. I couldn't figure out how to reply to each individually.
Bear: The forward is there and clearly explained within the all caps comments in the code I posted. The code for the proprietary routine is displayed as well. Here it is again for reference:
The comments show up green to me in the original post. I thought it would be obvious the way I noted that and hoped it would reduce the need for anyone to read all of the code. I suspect if I can get it to flow properly past the noted point of code, the other places the forward occurs will work as well.
I did not post the message twice. However, I did make an edit to the original after posting and submitted that change. Maybe that's why the post displayed twice??
A blank but valid HTML means I'm getting:
And that HTML isn't being delivered by any code I have deployed to Tomcat nor Apache. So I suspect there is some kind of default routing it is hitting or page it delivers, but have no clue since the logs are empty of anything except what I explicitly output to them.
Paul: No exceptions are being thrown unless they can be thrown with no evidence of them in any logs anywhere. Actually, as stated in the orignal post, the forward is working just fine. I see all my System.out's in the Tomcat logs, both from the servlet and from the JSP. I do not see the:
in the logs, and I wouldn't expect to.
D. Ogranos: I littered my JSP with the exact kind of code you suggested. As stated in the original post, the JSP is running all the way through (there is a System.out after the last line of it). In fact, even the attributes are being passed in the request! The JSP completes just fine, and then it goes off to the blank HTML page shown above... which BTW, exists no where in my Tomcat app or Apache pages.
There are no exceptions showing up in the logs, and no errors showing up in the logs on either the Tomcat or Apache side. I can hit the JSP page directly through the browser and it works fine, so there are no issues with the JSP page. It has to be something about the forwarding that either I'm screwing up (though it seems simple enough). I also see the request to the servlet in the Apache access logs, and it returns a clean, 200!
William Brogden wrote:You said a blank page - did you view source or use one of the many tools available to see the exact response content?
I'm glad you said that. I just viewed source. I used both HttpFox in FireFox, and then CURL, and both show absolutely nothing coming back. Also, FireFox's view source showed nothing, but IE's was showing the generated HTML. Therefore, the wonderful IE must be generating the HTML source I see when it gets nothing back. This make me feel just a tiny bit better, as at least I know some rogue blank HTML page isn't sitting in my server somewhere. I had combed my configs to be sure I had not accidentally (or boneheadedly) suppressed 4xx and 5xx messages.
So, the mystery still remains...here is the Apache log entry showing the hit to the servlet:
The only thing in the error.log of apache is the missing "favIcon.ico" entry.... And nothing except my System.out's from both the servlet and the JSP in tomcat logs (localhost, stdout, stderr). Nothing in mod_jk, and no errors anywhere.
posted 10 years ago
Bear Bibeault wrote:Comments are not helpful. We need to see real code. Otherwise we have no way of knowing what's really executing.
I'm losing you, man! I posted the entire servlet code, and the code from the superclass that couldn't immediately be seen, so all the the code related to the problem is there. Though I did show that in comments within the code, looking back, the only thing I could have done to make it more clear was to point out to pay attention to the comments that are all caps.
posted 10 years ago
Thanks for all replies.
Embarrisingly enough, I had incorrectly spelled "error.jsp" within my JSP and, thought the JSP was getting an error, it was trying to route to "eror.jsp"...
Go ahead Bear... I'm ready to hear it! You deserve to tell me!