【www.gdgbn.com--js教程】

在我们会用 Request对象来获取由表单提交过来的数据,这一点有点像asp里面的request获取数据方法.


回收的价值确定在表单字段
主要使用对象的要求是让价值用户提供了形式提交。例如,在此HTML页a.jsp :

<% 
    String bUrl = response.encodeUrl("b.jsp");
%>

<%-- presentation --%>

What is your favourite kind of eggs?
<% 
    String aUrl = response.encodeUrl("a.jsp");
%>

<% 
    String faveggs = request.getParameter("eggs"); 
    if ((faveggs != null) && (faveggs.trim().length() == 0))
        faveggs = null;
%>

<%-- presentation --%>

<% if (faveggs == null) { %>
No eggs supplied!
">Try again
<% } else if (faveggs.equals("green"))  { %>
Of course we have <%= faveggs %> eggs! 
It"s one of our favourites too.
<% } else { %>
We do not have <%= faveggs %> eggs.
<% } %>

本文来源:http://www.gdgbn.com/wangyezhizuo/18250/