While trying out some error-handling on JSP I noticed some strange behaviour.
I create a Myobject but don't put anything in it to cause a nullpointer for testing.
I have included the errorPage directive in my page so it should go to my errorpage when this exception occurs.
The actual error will occur in the input of a form:
....
<input type="hidden" id="INITIAL_ACTION" name="INITIAL_ACTION" value="<%=Myobject.myMethod()%>"/>
<input type="hidden" name="INITIAL_PAGE" ....
I see the content of my errorpage so the errorpage directive is working but the page doesn't look normal. Now when i look at the source of the page, it looks like the errorpage is actualy inserted into the value of this INITIAL_ACTION input on my previous page instead of being a forward:
...
<input id="INITIAL_ACTION" type="hidden" value=" <html> <head> <title>ErrorPage</title> <link rel = 'stylesheet' type = 'text/css' href = '../css/newstyle.css' /> </head> <body> <div id=" name="INITIAL_ACTION"></input>
<table class="borderedtable">
<tbody>
<tr> … </tr>
<tr> … </tr>
...
Of course this is giving me some layout/css issues on the actual error-page. Could anyone please explain this behaviour or point me in the right direction?
Edit :
Increasing the page buffer works.
But this would be hard for my current application to identify which pages need this to make sure their error-handling works.
The problem was that the first double quoute of the id-attribute of the first DIV in the error page was used to close the value-attribute of the place where it was inserted..
at the top of the errorpage I have added a html-comment which contains a double quote + explanation.. Now that quote is used and the rest of the page is rendered fine.
But I don't realy like my solution, doesn't feel solid