请教,jsp显示问题

fldsun 2011-03-14 10:48:23
运行一个修改商品信息的jsp,运行后能确实修改数据库里的信息,但是浏览器里却显示了html代码,没有执行代码实际的内容

jsp代码如下

<%@ page contentType="text/html; charset=gb2312" language="java" %>
<%@ page import="java.sql.*,com.netshop.*,java.text.*" %>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>商品交易平台</title>

<style type="text/css"></style>
</HEAD>
<BODY>
<jsp:useBean id="goods" scope="page" class="com.netshop.goods"/>
<jsp:useBean id="FileUpload" scope="page" class="com.netshop.FileUpload"/>
<center>
<%
String strTime;
SimpleDateFormat dateFormatterfile = new SimpleDateFormat("yyyyMMddHHmmss");
strTime=dateFormatterfile.format(new java.util.Date());
String fileName="";
FileUpload myUpload=new FileUpload();
myUpload.initialize(request,response);

String strID = myUpload.getFormFields("ID");
goods.init(strID);

if(myUpload.getFormFields("isReUpload").equals("1"))
{
myUpload.setMax_size(10240000);
myUpload.setFilePath("E:\\netshop\\uploadPhotos\\");
fileName=myUpload.getFileName();
fileName=strTime+fileName.substring(fileName.lastIndexOf("."),fileName.length());
myUpload.saveFile(fileName);
if(myUpload.getErrNum()!=0 )
{
out.println(myUpload.getErrDesc() );
}
}

if(myUpload.getFormFields("isReUpload").equals("1"))
{
goods.goodsURL =fileName;
}
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
goods.createDate =dateFormatter.format(new java.util.Date());
goods.title =myUpload.getFormFields("title");
goods.description =myUpload.getFormFields("description");
goods.price = Integer.parseInt(myUpload.getFormFields("price"));
goods.linkMan =myUpload.getFormFields("linkMan");
goods.telephone = myUpload.getFormFields("telephone");

if(goods.modifyGoodsInfo(strID))
{
%>
<font color=blue size=5><b>商品修改成功!</b></font>
<br><br>
<input type=button name=gofirs value="确定" onclick=javascript:window.location='myGoodsList.jsp'>
<%
}
else
{
%>
<font color=red size=5><b>商品修改失败,请重试!</b></font>
<br><br>
<input type=button name=goback value="返回" onClick="javascript:window.history.go(-1)" >
<%
}
%>

</center>
</BODY>
</HTML>


浏览器里显示的是这段代码

<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>商品交易平台</title>

<style type="text/css"></style>
</HEAD>
<BODY>


<center>

<font color=blue size=5><b>商品修改成功!</b></font>
<br><br>
<input type=button name=gofirs value="确定" onclick=javascript:window.location='myGoodsList.jsp'>

</center>
</BODY>
</HTML>
...全文
27 点赞 收藏 回复
写回复
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复

还没有回复,快来抢沙发~

相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2011-03-14 10:48
社区公告
暂无公告