我正在浏览React教程,在网络上,我看到了很多有关同构React的知识。只是对它是什么以及它如何工作感到困惑。
根据我的理解,Isomorphic React应用程序是从一开始就加载所有需要的数据,然后根据用户的请求将其保留在客户端上,以将完整数据保存在商店中(Redux architechture)。
现在,如果我遇到这样的情况,例如需要从第三方应用程序中使用webservice加载完整的HTML表单,在该应用程序中我从中获取数据作为json(需要在屏幕上呈现哪些字段的架构)并执行一些操作。操作我需要将请求发送回去,以便获得其他架构以将其加载为下一个屏幕。在这种情况下,每次需要进行服务器调用或ajax调用时,我该如何使用同构(我不喜欢这样做,因为它可能暴露API)
所以在这种情况下我可以说这个应用程序是同构的,或者我对同构的理解是完全错误的?
我在项目中使用Thymeleaf进行布局,但是无法动态获取页面标题。
Layout.jsp
<head th:fragment="headerfragment">
<title th:text="@{page-title}"></title>
<!-- Bootstrap Core CSS -->
<link th:href="@{/resources/css/bootstrap.min.css}" rel="stylesheet"
type="text/css" />
</head>
Run Code Online (Sandbox Code Playgroud)
Page.jsp
<head th:include="layout :: headerfragment"></head>
Run Code Online (Sandbox Code Playgroud)
呈现最后一页时,我看到标题是页面标题,而不是实际文本
在我的控制器中,我设置了page-title属性
modelMap.addAttribute("page-title", "Home");
Run Code Online (Sandbox Code Playgroud)
我可能不正确,因为我是百里香叶的新手。请帮助我找出解决方案。
我正在使用 mule 验证 JSON 架构组件来验证传入的 json 请求。它验证类型但不验证必需的字段属性
{
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema",
"properties": {
"Employees": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"BirthDate": {
"type": "string",
"format": "date-time"
},
"EmpNum": {
"type": "number"
},
"FirstName": {
"type": "string"
},
"Gender": {
"type": "string"
},
"LastName": {
"type": "string"
},
"LicenseNumber": {
"type": "string"
},
"ZipCode": {
"type": "string"
}
},
"required": ["EmpNum", "LastName", "FirstName", "Street", "ZipCode", "BirthDate" ]
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我有 json 如下所示:
{ …
Run Code Online (Sandbox Code Playgroud)