form.xtp
来自「解压在c盘」· XTP 代码 · 共 52 行
XTP
52 行
<s1 title="Forms"><p>Forms are, of course, the most important way of getting informationfrom the customer of a web site. In this section, we'll just create asimple color survey and print the results back to the user.</p><p>First, create the entry form. Our HTML form will send its answersto form.jsp for processing.</p><p>For this example, the <code/name="name"/> and <code/name="color"/>are very important. You will use these keys to extract the user'sresponses.</p><example title='form.html'><form action="form.jsp" method="get"><table><tr><td><b>Name</b> <td><input type="text" name="name"><tr><td><b>Favorite color</b> <td><input type="text" name="color"></table><input type="submit" value="Send"></form></example><p>Resin keeps the browser request information in the<code/request/> object. The <code/request/> object contains theenvironment variables you may be familiar with from CGI programming.For example, it has the browser type, any HTTP headers, the servername and the browser IP address.</p><p>You can get form values using <code/request.getParameter/> object.</p><p>The following JSP script will extract the form values and print themright back to the user.</p><example title='form.jsp'>Name: <%= request.getParameter("name") %> <br>Color: <%= request.getParameter("color") %> </example></s1>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?