unity有必要使用数据库吗

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了unity有必要使用数据库吗相关的知识,希望对你有一定的参考价值。

参考技术A unity有必要使用数据库。unity有必要使用数据库。 参考技术B unity有必要使用数据库。unity有必要使用数据库。 参考技术C unity有必要使用数据库。unity有必要使用数据库。

弹簧数据绑定标签形式没有必要吗?

我正在研究Spring MVC中的数据绑定,我正在接近使用标签形式来实现它。如上所述,为了在Spring框架中实现数据绑定,似乎是必要的。

但我使用Spring Boot进行了测试,并且我没有使用form标签,甚至没有使用JSP页面进行输入,而只是使用外部HTML页面。

所以,问题是,表单标签是有用的但不是必需的,或者只有Spring Boot才有必要?

下面的代码。谢谢!

输入HTML表单

<html>
<body>
<h3> Registration Form <h3>
<br/>
<form action="http://localhost:8080/register" method="post" >
    <pre>
         Name <input type="text" name="name" />
         Email address <input type="text" name="emailAddress" />
         Password <input type="password" name="password" />
         <input type="submit" value="Submit" />
    </pre>
</form>
</body>
</html>

弹簧控制器:

package hello;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class RegistrationController {

    @RequestMapping("/register")
    public String greeting(User user, Model model) {  
        model.addAttribute("user", user);
        return "result";
    }
}

pom.hml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example.bytecode</groupId>
    <artifactId>SpringBootBindingForm</artifactId>
    <version>1.0-SNAPSHOT</version>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.6.RELEASE</version>
    </parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>
    </dependencies>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

使用Thymeleaf的输出页面(为了验证正确的数据绑定)

<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Getting Started: Serving Web Content</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
    <p th:text="'Name, ' + ${user.name} + '!'" />
    <p th:text="'Password, ' + ${user.password} + '!'" />
    <p th:text="'Email, ' + ${user.emailAddress} + '!'" />
</body>
</html>

而User.java和Application.java我不认为有必要在这里展示。

答案

是的,标签表单提供了一些添加功能,但实现Spring Controller Databinding并不是绝对必要的。

否则,如果不使用具有该特定标记的JSP发送请求,则无法使用简单的HTML表单或PostMan实现DataBinding。

以上是关于unity有必要使用数据库吗的主要内容,如果未能解决你的问题,请参考以下文章

使用阿里云服务器有必要单独使用云数据库吗?

请问用unity3d来制作MMO类型网络游戏,服务端该如何制作?听说用Photon网络引擎可以制作,有详细的教程吗?

弹簧数据绑定标签形式没有必要吗?

unity同一个gameobject上可以同时存在碰撞体和触发器吗

我可以将 Unity 与 iOS 混合使用吗?

学Python数据分析及可视化有必要吗?