On Fri, 4 Nov 2005 11:14:19 -0800 (PST)
 Dola Woolfe <[EMAIL PROTECTED]> wrote:
Hi,

In one of my JSP pages (ErrorPage.jsp) I have the
following code.

<%
if (display-nothing-only-forward) {
 out.println("<META to forward to another page in 0
seconds>");
 // return;
}

//Lot's more code
%>

It works, but prints out unnecessary html before it
forwards. But if I uncomment "return" it stops
working. I get
HTTP 500 - Internal server error
What could that be? In the tomcat console window, I
get no indication that something is not right.

I would postulate that you are executing unnecessary code.

*Disclaimer: The following is NOT compliant with MVC best practices...

In your JSP page, you *probably* want your "if (display-nothing-only-forward)" statement to execute if there is nothing to do. If that is true, then after your closing brace with the META info in it, you probably want to use an 'else' clause and enclose the rest of your code in a set of braces.

In effect, what you've done is to tell the system to put the META statement out ONLY when there is nothing else to do - but the rest of your code runs all the time.

If you have sufficient experience, I would suggest removing all of the java code from your JSP page and putting the code into a Tag. Tags are really easy to use and keep your business logic seperate from your JSP presentation. Of course, you'll still have to generate HTML in the Tag, but that's partly what tags are for.

Bob

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to