五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

第二次操作考試:Java web字符串拼接,顯示成表格,有時(shí)要記憶,默寫內(nèi)容【詩(shī)書畫唱】

2020-10-06 21:54 作者:詩(shī)書畫唱  | 我要投稿



package T;


public class Product {

? ? private String name;

? ? private Double price;

? ? public Product(String n,Double p) {

// TODO Auto-generated constructor stub

? ? this.name = n;

? ? this.price = p;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public Double getPrice() {

return price;

}

public void setPrice(Double price) {

this.price = price;

}

}

package T;


import java.io.IOException;

import java.util.ArrayList;

import java.util.List;


import javax.servlet.ServletException;

import javax.servlet.annotation.WebServlet;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;


/**

?* Servlet implementation class TestServlet

?*/

@WebServlet("/ts")

public class TestServlet extends HttpServlet {

private static final long serialVersionUID = 1L;

? ? ? ?

? ? /**

? ? ?* @see HttpServlet#HttpServlet()

? ? ?*/

? ? public TestServlet() {

? ? ? ? super();

? ? ? ? // TODO Auto-generated constructor stub

? ? }


/**

* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)

*/

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

// TODO Auto-generated method stub

this.doPost(request, response);

}


/**

* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)

*/

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

// TODO Auto-generated method stub

List<Product>list = new ArrayList<Product>();

for(int i = 0;i < 3;i ++) {

Product p = new Product("商品" + i,3.3 + i);

list.add(p);

}

//將List中的數(shù)據(jù)拼接成一個(gè)表格,并且顯示出來(lái)

StringBuilder html = new StringBuilder();

html.append("<table border='1'><tr><th>商品名稱"

+ "</th><th>商品價(jià)格</th><th>操作</th></tr>");

for(Product p : list) {

html.append("<tr><td>");

html.append(p.getName());

html.append("</td><td>");

html.append(p.getPrice());

html.append("</td><td><a href='#'>修改</a></td></tr>");

}

html.append("</table>");

// System.out.println(html);

response.setCharacterEncoding("gbk");

//將html代碼顯示在頁(yè)面上

response.getWriter().write(html.toString());

}


}



第二次操作考試:Java web字符串拼接,顯示成表格,有時(shí)要記憶,默寫內(nèi)容【詩(shī)書畫唱】的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
丹寨县| 静宁县| 油尖旺区| 麻城市| 朝阳区| 秀山| 姚安县| 新兴县| 亳州市| 合江县| 阆中市| 山东省| 镶黄旗| 葵青区| 兰考县| 克什克腾旗| 都昌县| 游戏| 襄城县| 霸州市| 广汉市| 宜丰县| 金昌市| 金寨县| 安溪县| 霞浦县| 武山县| 高邮市| 安龙县| 石家庄市| 苏尼特左旗| 南皮县| 丽水市| 木兰县| 陈巴尔虎旗| 武冈市| 大名县| 徐闻县| 金乡县| 潼南县| 云和县|