快速入门之无序列表

  1. /**
  2. * 这是一个用户登录方法
  3. * <h1>你要遵循以下几点要求</h1>
  4. * <ul>
  5. * <li>雪碧</li>
  6. * <li>可乐</li>
  7. * <li>凉茶</li>
  8. * </ul>
  9. */
  10. public void login(){
  11. System.out.println("jaja ");
  12. }
  13. @Autowired
  14. UserService userService;
  15. @GetMapping("/")
  16. public void test(){
  17. userService.login();
  18. }

1610803465610.png

pre标签

  我们经常会在要保持文本格式的时候使用pre标签,比如当我们要展示源代码的时候,只要放一个pre标签,然后把源代码直接复制,粘贴,然后在页面上就可以保持好格式。不会像放在其它标签里那样,把换行和空格都自动折叠了。这里看一下pre是如何工作的呢?

HTML里的pre元素,可定义预格式化的文本。在pre元素中的文本会保留空格和换行符。文本显现为等宽字体。

下面我们看一个示例,这里我使用的是一段css代码,你也可以换成其它的。如下:

  1. body{
  2. background:#fff;
  3. font: 12px/24px 1.66;
  4. }

当我们用pre包裹它们时


<pre>
body{
    background:#fff;
      font: 12px/24px 1.66;
}
</pre>

会在浏览器上直接得到(注释原理一样)

1610803465647.png

可以看出上面的tab,空格,换行都完整的保留下来了。

lt和gt

lt 是less than的首字母缩写
gt 是greater than的首字母缩写

在 HTML 中,某些字符是预留的。
在 HTML 中不能使用小于号(<)和大于号(>),这是因为浏览器会误认为它们是标签。
如果希望正确地显示预留字符,我们必须在 HTML 源代码中使用字符实体

如需显示小于号,我们必须这样写:

1610803465678.png

/*
* 
<pre>
     * &lt;c:url value="/login" var="loginProcessingUrl"/&gt;
     * &lt;form action="${loginProcessingUrl}" method="post"&gt;
     *    &lt;fieldset&gt;
     *        &lt;legend&gt;Please Login&lt;/legend&gt;
     *                &lt;c:if test="${SPRING_SECURITY_LAST_EXCEPTION != null}"&gt;
     *                  Reason: &lt;c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}" /&gt;
     *                &lt;/c:if&gt;
     *            &lt;/div&gt;
     *        &lt;/c:if&gt;
     *        &lt;c:if test="${param.logout != null}"&gt;
     *            &lt;div&gt;
     *                You have been logged out.
     *            &lt;/div&gt;
     *        &lt;/c:if&gt;
     *        &lt;p&gt;
     *        &lt;label for="username"&gt;Username&lt;/label&gt;
     *        &lt;input type="text" id="username" name="username"/&gt;
     *        &lt;/p&gt;
     *        &lt;p&gt;
     *        &lt;label for="password"&gt;Password&lt;/label&gt;
     *        &lt;input type="password" id="password" name="password"/&gt;
     *        &lt;/p&gt;
     *        &lt;p&gt;
     *        &lt;label for="remember-me"&gt;Remember Me?&lt;/label&gt;
     *        &lt;input type="checkbox" id="remember-me" name="remember-me"/&gt;
     *        &lt;/p&gt;
     *        &lt;div&gt;
     *            &lt;button type="submit" class="btn"&gt;Log in&lt;/button&gt;
     *        &lt;/div&gt;
     *    &lt;/fieldset&gt;
     * &lt;/form&gt;
     * </pre>
     *
     * <h2>Impact on other defaults</h2>
     *
     * Updating this value, also impacts a number of other default values. For example,
     * the following are the default values when only formLogin() was specified.
     *
     * <ul>
     * <li>/login GET - the login form</li>
     * <li>/login POST - process the credentials and if valid authenticate the user</li>
     * <li>/login?error GET - redirect here for failed authentication attempts</li>
     * <li>/login?logout GET - redirect here after successfully logging out</li>
     * </ul>
     *
     * If "/authenticate" was passed to this method it update the defaults as shown below:
     *
     * <ul>
     * <li>/authenticate GET - the login form</li>
     * <li>/authenticate POST - process the credentials and if valid authenticate the user
     * </li>
     * <li>/authenticate?error GET - redirect here for failed authentication attempts</li>
     * <li>/authenticate?logout GET - redirect here after successfully logging out</li>
     * </ul>
     */

{@link}与@see

写代码的时候,有时候,你需要写一些注释,把内容相互关联起来,方便自己或别人看的时候,可以直接找到你关联的代码类或者啥的。
这个时候,{@link}与@see,这2个javadoc注解就派上用场了,
不管他具体有什么功能,咱就只管一个,他可以链接代码,让注释看的更清楚易懂。方便你我他。

@see 标签允许用户引用其他类的文档。具体使用方式如下:
@see classname
@see fully-qualified-classname
@see fully-qualified-classname#方法名称
@see fully-qualified-classname#属性名称

我在使用的时候,发现这个只能单独一行顶头写,如果不顶头写就不管用了,没了链接的效果。
但是,{@link}这个却可以随便放。
具体使用方法和上面那个@see是一样的。
实际效果,看下面的图吧。

1610803465735.png