In the future,based on the Internet platform,blockchain technology will be used to make a new change.Now is the key turning point.If there are any tie points in the blockchain that try to tamper with data privately,and most nodes do not change,this tampering behavior will then be rejected by the whole blockchain to ensure the consensus and security of the whole network.
但是如果我们把约定通过代码的形式,录入区块链中,一旦触发约定时的条件,就会有程序来自动执行,这就是智能合约。
The contract runs on blockchain technology,which is the basic technology of bitcoin and most cryptocurrencies.The input information represents the values assigned by the developer.When these values are met,the contract executes itself according to the rules it is programmed to execute.
package com.kb.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class MyController
{
@RequestMapping("/controller1")
public String controllerFunc1(Model m)
{
m.addAttribute("msg","hello controller 1");
return "test";
}
@RequestMapping("/controller2")
public String controllerFunc2(Model m)
{
m.addAttribute("msg","hello controller 2");
return "test";
}
@RequestMapping("/controller3")
public String controllerFunc3(Model m)
{
m.addAttribute("msg","hello controller 3");
return "test";
}
}
这里使用注解的方式,有三个方法可以被前端调用,分别为controllerFunc1
;controllerFunc2
;controllerFunc3
;URL分别为http://localhost:8080/controller1
;http://localhost:8080/controller2
;http://localhost:8080/controller3
。由于springmvc-servlet.xml
里配置了web访问的路径前缀包括jsp,因此在WEB-INFO路径下添加jsp文件夹,并创建test.jsp文件。
<%--
Created by IntelliJ IDEA.
User: KingBoy
Date: 2021/11/14
Time: 19:03
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
${msg}
</body>
</html>
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。