Re: Trash appears in JSP page upon declaring error page
- From: Lew <lew@xxxxxxxxxxxxx>
- Date: Mon, 28 Jul 2008 11:19:11 -0700 (PDT)
On Jul 28, 9:56 am, "phillip.s.pow...@xxxxxxxxx"
<phillip.s.pow...@xxxxxxxxx> wrote:
<%
String errorURL = "https://" + request.getServerName() + "/common/
error/general_error.jsp";
%>
<%@ page errorPage = "<%= errorURL %>" %>
I believe this is your trouble right here. The <%= scriptlet tag says
to emit the enclosed text to the response 'out' stream. The <%@ JSP
metatag gives a directive to the JSP system, not an output to the
response. You can't mix them.
It's pretty much a mistake to set the error page from within the page
whose errors you're trying to catch. You'd be much better off setting
it from the web.xml.
<html>
<head>
<title>Blah</title>
</title>
Extra '</title>' here - invalid HTML.
</head>
<body>
Foo
</body>
</html>
The following URL, say, we call it "foo.jsp", once displayed, works
fine, except that this is your output:
%>
Foo
And the "%>" is found before the HTML tags are displayed, somehow
embedding this into the header. When I take out the <%@ page %> tag,
the "%>" disappears. I am required to reference the error page URL
within pages such as "foo.jsp", so how do I remove the extraneous
"trash" from the header, i.e. the "%>" from displaying?
Don't use scriptlet in the directive.
--
Lew
.
- References:
- Trash appears in JSP page upon declaring error page
- From: phillip.s.powell@xxxxxxxxx
- Trash appears in JSP page upon declaring error page
- Prev by Date: Re: [General]acces of members of subclass
- Next by Date: Re: acces of members of subclass
- Previous by thread: Trash appears in JSP page upon declaring error page
- Next by thread: Scrolling JList to Bottom
- Index(es):
Relevant Pages
|