JSP内置对象:设置content-type属性

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title heretitle>
head>
<body>
<%
String s=request.getHeader("accept");
String unit[]=s.split(",");
%>
<form action="content2.jsp">
<select name="mysel">
<%for(int i=0;iString t="+unit[i]+"";
    out.print(t);
}

%>
select>
<input type="submit" value="ok"/>
form>
body>
html>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title heretitle>
head>
<body>
<%String s=request.getParameter("mysel");
String content=s+";chrset=gbk";
response.setContentType(content);

int d[][]={{1,2,3},{4,5,6},{7,8,9}};
out.print("");
for(int i=0;i"");
    for(int j=0;j"");     
    }
    out.print("
"
); } %>
body>
html>

你可能感兴趣的:(jsp学习)