注册 登录
编程论坛 J2EE论坛

求助大神~jsp运行以后老说这里是错的

hiyourstory 发布于 2014-12-25 21:44, 2468 次点击
而且中文还是乱码,用myeclipse运行

<%@ page language="java" import="java.util.*,com.shopping.model.*" pageEncoding="utf-8"%>

<%
String goodstype = request.getParameter("goodstype");
if(goodstype==null){
    goodstype=1+"";
}
GoodsBeanBo gbb = new GoodsBeanBo();
ArrayList al =(ArrayList)gbb.getGoodsList(goodstype);

GoodsBean[]gb=new GoodsBean[6];
for(int i =0; i<al.size(); i++)
{
    gb[i]=(GoodsBean)al.get(i);
}

%>
 <html>
     <head>
         <script type="text/javascript">
            function lookup0(){
                <%
                    GoodsBean goods=gb[0];
                    request.setAttribute("goods", goods);
                %>
                window.open("show.jsp","_self");
            }
            function lookup1(){
                <%
                    GoodsBean good1=gb[1];
                    request.setAttribute("goods", good1);
                %>
                window.open("show.jsp","_self");
            }
            function lookup2(){
                <%
                    GoodsBean good2=gb[2];
                    request.setAttribute("goods", good2);
                %>
                window.open("show.jsp","_self");
            }
            
        </script>
     </head>
     <body>
     <form>
         <table>
             <tr>
                 <th height ="17" colspan="2" scope="col"><font color="#FF00FF">商品名称:   <%=gb[0].getGoodsName() %></font></th>
                 <th height ="28%" colspan="2" scope="col"><font color="#FF00FF">商品名称:<%=gb[1].getGoodsName() %></font></th>
                 <th height ="31%" colspan="2" scope="col"><font color="#FF00FF">商品名称:<%=gb[2].getGoodsName() %></font></th>
             </tr>

             <tr>
                 <th height ="17" colspan="2" scope="col"><font color="#FF00FF">商品价格:   <%=gb[0].getGoodsPrices() %></font></th>
                 <th height ="28%" colspan="2" scope="col"><font color="#FF00FF">商品价格:<%=gb[1].getGoodsPrices() %></font></th>
                 <th height ="31%" colspan="2" scope="col"><font color="#FF00FF">商品价格:<%=gb[2].getGoodsPrices() %></font></th>
             </tr>
             <tr>
                 <th height ="17" colspan="2" scope="col"><font color="#FF00FF">商品简介 :  <%=gb[0].getGoodsInfo() %></font></th>
                 <th height ="28%" colspan="2" scope="col"><font color="#FF00FF">商品简介:<%=gb[1].getGoodsInfo() %></font></th>
                 <th height ="31%" colspan="2" scope="col"><font color="#FF00FF">商品简介:<%=gb[2].getGoodsInfo() %></font></th>
             </tr>
             <tr>
                 <th height ="17" colspan="2" scope="col"><font color="#FF00FF"><input type="button" onclick="lookup0()" value="查看"/></font></th>
                 <th height ="28%" colspan="2" scope="col"><font color="#FF00FF"><input type="button" onclick="lookup1()"  value="查看"/></font></th>
                 <th height ="31%" colspan="2" scope="col"><font color="#FF00FF"><input type="button" onclick="lookup2()"  value="查看"/></font></th>
             </tr>
         
         </table>
         </form>
     </body>
 </html>

[ 本帖最后由 hiyourstory 于 2014-12-25 21:45 编辑 ]
2 回复
#2
hiyourstory2014-12-26 09:41
#3
java小蚂蚁2015-01-17 12:12
没看出来拿错了,你标红的地方
1