国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(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ó)家法律
隆化县| 安陆市| 九江市| 青龙| 富锦市| 凭祥市| 房山区| 蓬安县| 大田县| 白银市| 施秉县| 江达县| 滁州市| 华坪县| 沛县| 砚山县| 延川县| 灵璧县| 广水市| 攀枝花市| 江西省| 焦作市| 江华| 莆田市| 武宁县| 台南市| 山丹县| 左权县| 新绛县| 元江| 顺义区| 洛南县| 昌吉市| 丁青县| 如东县| 鞍山市| 淳化县| 荔浦县| 富宁县| 卢湾区| 罗田县|