📄 req_url.xtp
字号:
<s1 title="URLs"><p>The <var/request/>object breaks down the request URL into components. Servlets and JSPpages can use those components to vary the response while using thesame servlet or JSP page.</p><p>Some reasons you may need to look at the URL information:</p><ul><li>form submission<li>selecting sections of a manual<li>displaying different stories on a news site<li>displaying comments on a discussion group<li>sort preferences for the discussion site<li>search results</ul><s2 title="RequestURI"><p><var/getRequestURI()/> returns the full path, excluding any query string.</p></s2><s2 title="ServletPath"><p><var/getServletPath()/> returns the URI prefix that matches theservlet. In the case of a JSP, it will return everything up to the*.jsp.</p><p>The servlet path is useful for servlets like JSP, XTP, or SSI thatread and transform files.</p></s2><s2 title="PathInfo"><p><var/getPathInfo()/> returns everything after the ServletPath.</p><p>A discussion board servlet could use PathInfo to select storiesand comments.</p></s2><s2 title="QueryString"><p><var/getQueryString()/> returns the query string, everything afterthe '?'</p><p>Often, query strings are the result of form submissions but it'salso useful for database-driven sites. For example, you might encode"story 15, comment 7" of a discussion as <var//comment.xtp?story=15&comment=7/>.</p></s2><example>http://localhost:8080/test/env.jsp/tail?a=b</example><example title='env.jsp'><table><tr><td>URI <td><%= request.getRequestURI() %><tr><td>ServletPath <td><%= request.getServletPath() %><tr><td>PathInfo <td><%= request.getPathInfo() %><tr><td>QueryString <td><%= request.getQueryString() %><tr><td>a <td><%= request.getParameter("a") %></table></example><results>URI /test/env.jsp/tailServletPath /test/env.jspPathInfo /tailQueryString a=ba b</results></s1>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -