📄 update.jsp
字号:
<%@page contentType="text/html" pageEncoding="UTF-8"%><%@page import="model.*"%><%@page import="java.util.*,javax.swing.*,java.awt.*,java.util.regex.*,javax.swing.text.*"%><%@page import="org.apache.commons.lang.StringEscapeUtils" %><jsp:useBean id="pb" scope="session" class="model.ProductsBean" /><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><% String name = request.getParameter("product"); session.setAttribute("product", name); String tf = request.getParameter("tf"); session.setAttribute("tf", tf); String patternStr = "([0-9]+)"; Pattern pattern = Pattern.compile(patternStr); Matcher matcher = pattern.matcher(name); if (!matcher.find()) { out.println("Cannot be empty!"); return; } Integer id = Integer.parseInt(name); Product p = pb.find(id); if (p == null) { out.println("We donnot have it!"); return; }%><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <style> @import url("entry.css"); table.entry td.left { width: 90px; } </style> </head> <body> <%@ include file="nav.jsp" %> <form action="update"> <table border="1" cellpadding="5px"> <tr> <th>id</th> <th>description</th> <th>price</th> </tr> <% {%> <tr> <td><%= p.getId()%></td> <td><%= StringEscapeUtils.escapeHtml(p.getDescription())%></td> <td><input type="text" class="text" name="tf" value="<%= p.getPrice()%>" /></td> </tr> <% }%> </table> <input type="submit" name="button" value="submit" /> <input type="hidden" name="tf" value="<%= tf%>" /> <input type="hidden" name="product" value="<%= name%>" /> </form> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -