The writing of various types of addresses in Java Web development

Source: Internet
Author: User

This actually has three principles:

1. If this address is the starting point for this address to the server, start writing from the Web App

2. If this address is the beginning of the address to the browser, start writing from the site

3. All addresses start with a "/", representing the Web app or website

Commonly used addresses to write:

1.request.getrequestdispatcher ("/form1.html"). Forward (request,response); This forwarding is for the server to operate, so "/" represents the Web App

2.response.sendredirect ("/webapplication/form1.html"); Because this is a browser that needs to be manipulated, the redirected

3.this. Servletcontext.getrealpath ("/form1.html"); This is the acquisition of resources on the server, related to the server

4.this. Servletcontext.getresourceasstream ("/form1.html"); This is also related to the server, get the flow of the resource

5.<form action= "/webapplication/form1.html"/> form to be submitted to the browser, so "/" starts from the site

6.<a href= "/webapplication/form1.html" > click </a> hyperlink jump is also done by the browser, so start writing from the website

The writing of various types of addresses in Java Web development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.