Home > other >  Consult the Java EE master a small problem.
Consult the Java EE master a small problem.

Time:11-03

Pro, hello:
Recent student I can in the new Java EE encountered the following problem:
 & lt; % @ page language="Java" import="Java. Util. *" pageEncoding="utf-8" % & gt; 
<%
String path=request. GetContextPath ();
String=basePath request. GetScheme () + "://" + request. GetServerName () + ":" + request. GetServerPort () + + "/" path;
String errorMessage=(String) request. GetAttribute (" errorMessage ");
% & gt;


<meta HTTP - equiv="content-type" Content="text/HTML. Charset=utf-8 "/& gt;
Remote electronic medical diagnosis system - landing & lt;/title> <br/><The link href="https://bbs.csdn.net/topics/images/login.css" rel="stylesheet" type="text/CSS"/& gt; <br/><br/></head> <br/><br/><body> <br/><Div id="wrap" & gt; <br/><Div id="header" & gt; <Img SRC="https://bbs.csdn.net/topics/images/1428906892_831341.png"/& gt; </div> <br/><Div id="content - wrap" & gt; <br/><Div & gt; </div> <br/><The form action="& lt; %=basePath % & gt; The login. Do? Method=the doLogin "method=" post "& gt; <Div & gt; <br/><Div & gt; <Label> Account: & lt;/label> <Input the name="username" type="text"/& gt; </div> <br/><Div & gt; <Label> Password: & lt;/label> <Input the name="password" type="password"/& gt; <Br/& gt; </div> <br/><Div & gt; <Label> The user types: & lt;/label> <Br/& gt; <Select the name="userType" style="width: 140 px; Height: 25 px;"> <The option value="https://bbs.csdn.net/topics/doctor" & gt; The doctor users & lt;/option> <The option value="https://bbs.csdn.net/topics/patient" & gt; Patients with user & lt;/option> </select> <Br/& gt; <br/><% <br/>If (errorMessage!=null) {% & gt; <br/><Font color="red" & gt; <% %=errorMessage & gt; </font> <br/><%} <br/>% & gt; <br/><br/></div> <br/><Div & gt; <The input name="" type=" submit "value=" "/& gt; </div> <br/><br/></div> </form> <br/></div> <br/><Div id="footer" & gt; </div> <br/></div> <br/></body> <br/></html> <br/></pre> <br/>This code, the student I can't understand the fourth lines of code: <br/>: <br/><pre> String basePath=request. GetScheme () + "://" + request. GetServerName () + ":" + request. GetServerPort () + + "/" path; </pre> <br/>It's methods: "getScheme ()", "getServerName ()", "getServerPort ()", the specific way of using these three methods, where to find? <br/>If the player you mean to say: "to the network looking for struts 2 API. CHM" ", the younger brother I request, to be able to recommend the younger brother a "Chinese version", "struts 2", "no virus Trojan", the use of struts 2 CHM format of the API, <br/>Thank you master!!!!! <br/><p class="article - content rp"> CodePudding user response: </p>This statement is used to assemble relative path to the current web page, <br/><br/><Base href="https://bbs.csdn.net/topics/. "& gt; Is used to show the current page in the relative path to the root path used, <br/>Page, for example, internal have a connection, the complete path should be http://localhost:80/myblog/authen/login.do <br/>Of http://server/is the basic path of the server, myblog is the name of the current application, so, my root is supposed to be so http://localhost:80/myblog/, <br/><br/>With this & lt; The base...> Later, my links page content, I don't want to write the full path, I'll just write authen/login. Do is ok, the server will automatically & lt; The base...> The specified path and relative paths within the page up and assembled to form complete path <br/>Without this & lt; The base...> Then I even links must write the full path of the page, or the server will find, <br/><br/>Request. The getSchema () returns the current page can be used by the agreement, the above example is the "HTTP" <br/>Request. GetServerName () returns the current page in the name of the server, in the above example is "localhost" <br/>Request. GetServerPort () returns the current page in the server to use the port, is 80, <br/>Request. GetContextPath () returns the name of the current page in the application, in the above example is myblog <br/>The four assembled together, is the current application with path<p class="article - content rp"> CodePudding user response: </p>http://bbs.csdn.net/topics/190149328 <br/><br/><br/>The answer to the above this post there can check<p class="article - content rp"> CodePudding user response: </p>The Servlet content, to find the Servlet API </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/other/76859.html" target="_blank" style="color:#999">https//www.codepudding.com/other/76859.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/other/76858.html'>How to restore the registry here content</a></div> <div class="detail-arr-right">Next:<a href='/other/76860.html'>The WSAEventSelect model of a doubt, consult the novice</a></div> </div> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="hot-tags neitags"> <ul> <li><i class="iconfont icon-x-tags"></i> Tags:  </li> <a href='/e/tags/?tagname=Network+communication' target='_blank'>Network communication</a> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="xiangguan"> <ul class="msg msghead"> <li class="tbname">Related</li> </ul> <ul> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="flinks"> <ul> <li><i class="iconfont icon-x-tags"></i> Links:  </li> <li class="liflinks"><a target="_blank" href="/" title="CodePudding">CodePudding</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <p><span style="font-size:16px;color:#666;font-weight: bold">About Us:</span>  <a href="https://www.codepudding.com/contact.html">Contact Us</a>      <a href="https://www.codepudding.com/service.html">Terms of Service</a>      <a href="https://www.codepudding.com/privacy.html"> Privacy Policy</a></p> <p class="foot_info">Copyright © 2010-2023,Powered By <a href="/" target="_blank">CodePudding</a> </p> </div> <script type="text/javascript" src="/skin/code/tianhu.js"></script> </body></html>