📄 form.xtp
字号:
<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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -