提交表单返回图片值

来源:百度知道 编辑:UC知道 时间:2024/05/26 15:56:34
a.htm里有个表单入1,按提交按钮,提交到b.htm里,b.htm的表格里立即插入1.gif图片,这样的一个动作怎么样用java实现,请示代码。。我很菜,谢谢。。
我的图片放在ball里,路径:
2.html

<body>
<%String picname = request.getParameter("pic");
String pic = picname+".gif";//根据你自己要求的图片格式加尾缀名和图片路径
%>
<img src="ball/<%=pic %>"/>
</body>

这样路径对吗?可是这样图片没有办法实现

1.jsp
<body>
<form action="2.jsp" name="form1" method="post">
<input type="text" name="pic">
<input type="submit" value="提交">
</form>
</body>

2.jsp

<body>
<%String picname = request.getParameter("pic");
String pic = picname+".gif";//根据你自己要求的图片格式加尾缀名和图片路径
%>
<img src="<%=pic %>">
</body>

ball放在项目的什么位置