JSP的 有错 找不出来了

来源:百度知道 编辑:UC知道 时间:2024/06/27 06:26:02
<body>
<% String s=request.getParameter("showtype");
if(s==null){ %>
<form action="4_11.jsp" method="get" >
请选择文件显示方式<br>
<input type="radio" name="showtype" value="0">word<br>
<input type="radio" name="showtype" value="1">excel<br>
<input type="radio" name="showtype" value="2">html<br>
<input type="submit" name="submit" value="确定">
</form>

<% }
else
{
if(s.equals("0"))
{response.setContentType("application/msword;charset=gb2312");}
else if(s.equals("1"))
{response.setContentType("application/x-msexcel;charset=gb2312");}
else
{response.setContentType("text/html;charset=gb2312");} %>
<jsp:include

如果from请求GET的话.setContentType没用.汉字显示不出来.必须要用方法把汉字变成编码,比较复杂.你把提交方式设置成post就行了.
还有<jsp:include page="data.txt"> 改成
<jsp:include page="data.txt" flush="true"/>
设置一下flush属性清空缓冲区数据.还有如果没有<jsp:param>不用</jsp:include>直接用/>就行了.

<jsp:include page="data.txt"></jsp:include> 换成<%@include file="data.txt"%> ,试试

提交表单用post呢?