大家帮我看看,可能是jsp:include的问题,急~~~~

ayace 2004-10-27 09:31:04
jsp文件:


test.jsp:
<%@ page contentType="text/html;charset=GB2312" %>
<HTML>
<BODY bgcolor=cyan><Font size=1 >
<P>您想使用什么方式查看文本文件A.txt?
<FORM action="tree3.jsp" method="post" name=form>
<INPUT TYPE="submit" value="word" name="submit1">
<INPUT TYPE="submit" value="excel" name="submit2">
</FORM>
</FONT>
</BODY>
</HTML>


tree3.jsp:
<%@ page contentType="text/html;charset=GB2312" %>
<HTML>
<BODY>
<% String str1=request.getParameter("submit1");
String str2=request.getParameter("submit2");
if(str1==null)
{str1="";
}
if(str2==null)
{str2="";
}
if(str1.startsWith("word"))
{response.setContentType("application/msword;charset=GB2312");
out.print(str1);
}
if(str2.startsWith("excel"))
{response.setContentType("application/x-msexcel;charset=GB2312");
}
%>
<jsp:include page="A.txt" flush="true">
</jsp:include>
</BODY>
</HTML>


用浏览test.jsp无问题,点按钮进入tree3.jsp,出现错误
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /tree3.jsp(20,0) Expected "param" tag with "name" and "value" attributes
........

后面还有很多,哪位达人教教我啊,谢谢,分不够我再加。
...全文
90 点赞 收藏 6
写回复
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
jinannanhai79 2004-10-29
String str1=request.getParameter("submit1");
String str2=request.getParameter("submit2");
有一个变量取不到值,所以将null赋值的时候出错,先做一下非空的判断,
String str1 = "";
if(request.getParameter("submit1") != null)
str1=request.getParameter("submit1");

回复
xinfeng802 2004-10-28
String str1=request.getParameter("submit1");
String str2=request.getParameter("submit2");
这两句出错了吧
回复
tom2005 2004-10-28

<jsp:include page="A.txt" flush="true"/>
回复
rainboy20024 2004-10-27
<jsp:include page="A.txt" flush="true"/>
回复
grpengwei 2004-10-27
要用include file =""
试试
回复
ayace 2004-10-27
怎么没人帮忙?郁闷。
回复
发动态
发帖子
Web 开发
创建于2007-09-28

7.9w+

社区成员

Java Web 开发
申请成为版主
社区公告
暂无公告