Thoughts on the response. sendredirect () method

Source: Internet
Author: User

<% @ Page contenttype = "text/html; charset = iso8859_1" Language = "Java" %>
<% @ Page import = "Java. util. *" %>
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = iso8859_1">
<Title> learning content </title>
<Style type = "text/CSS">
<! --
Body {
Background-image: URL (.../../images/wgypx/background.gif );
}
-->
</Style> <%
List list = (list) request. getattribute ("contentlist ");
Map map = new hashmap ();
If (list. isempty ()){
String url = "/show/wgypx/right_jiecontent_err.jsp ";
Response. sendredirect (URL );
} Else {
Map = (MAP) list. Get (0 );
}
%>
<Body topmargin = "0" leftmargin = "0">
<Table width = "582" border = "0" cellspacing = "0">
<Tr>
<TD> <% = (string) map. Get ("content") %> </TD>
</Tr>
</Table>
</Body>
</Html>

If you want to disable the content after response. sendredirect (URL);, add
Return; statement, but directly add return; sometimes an error is reported. How can this problem be solved?

You can change the Syntax:
If (1 = 1 ){
Return;
}
OK. The problem is solved !! [Understanding: directly using the content after the return statement to report an error because it is impossible to execute the statement. The addition of a permanent condition seems to have eased the conflict, and the result is almost passed]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.