Some problems in the Java Web

Source: Internet
Author: User

http://localhost:8080/struts2demo/online/userLogin.jsp

Request mode://hostname name (or server name): Port/servlet container name (usually project name)/custom Web page folder name or file package name/page name in map and prefix or response action

This is implemented in Eclipse Request.getscheme ()://Request.getservername (): Request.getserverport ()/Request.getcontextpath () /

1,<base> Labeling Issues

The <base> tab specifies the default address or default destination for all links on the page. Typically, the browser extracts the corresponding element from the URL of the current document to fill in the whitespace in the relative URL.

Using <base> tags can change this. The browser will then no longer use the URL of the current document and use the specified base URL to resolve all relative URLs. This includes URLs in the <a>, , <link>, <form> tags.

The wording is: <base href= "The_url", the position must be in the

For Java Web projects, in general, do not specify a value for base on a page, the current path defaults to: Request mode://hostname name (or server name): Port/servlet container name (usually project name)/page layer or multi-layer package name

2, return value

Define one of the following functions: why wrong? This is a primary school brother asked me the question, I think, it is really a bit of meaning.

Public string[] Type () {

String[] Array = {"A", "B"};

return {"A", "B"};

}

The error message in Eclipse is this:

Multiple markers at the
-This method must return a result of type string[]
-Syntax error, insert "}" to complete Block
-Syntax error, insert ";" To complete returnstatement

I thought about it. The reason may be, first of all, intuitively, return expects an object to be returned, and when it fails to implement its wish, it becomes an error, so it cannot be used as an object and cannot be converted to a string[] type, because it is invalid to make a forced conversion of a string array;

Second, in the end what it is, a closer look will find that it is actually a wrong way of writing a block of statements and an empty statement. But we prefer to be considered as the correct assignment for a sring[] type. When you add a ";" Symbol between return and it, it's clear.

Finally, it is a wrong block of statements and an empty statement, or a correct way to assign a value to the string[] type, but is used incorrectly.

Resources:

HTML <base> Tags http://www.w3school.com.cn/tags/tag_base.asp

Some issues in the Java Web

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.