@Entity
public class Zone {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToOne(mappedBy = "zone")
private ZoneDescription description;
// Геттеры и сеттеры не указаны для краткости
}@Entity
public class ZoneDescription {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToOne
private Zone zone;
@ManyToOne(optional = false)
private ZoneLanguage language;
// Геттеры и сеттеры не указаны для краткости
}@Entity
public class ZoneLanguage {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
/* Раскоментировать, если нужна двунаправленная связь
@OneToMany(mappedBy = "language")
private Set<ZoneDescription> descriptions = new HashSet<>();
*/
// Геттеры и сеттеры не указаны для краткости
}Zone zone = zoneRepository.getById(zoneId);
ZoneDescription description = zone.getDescription(); A special directory exists within the application hierarchy named WEB-INF. This directory contains all things related to the application that aren’t in the document root of the application. The WEB-INF node is not part of the public document tree of the application. No file contained in the WEB-INF directory may be served directly to a client by the container. However, the contents of the WEB-INF directory are visible to servlet code using the getResource and getResourceAsStream method calls on the ServletContext, and may be exposed using the RequestDispatcher calls.
@PostMapping("/add2Cart")
@ResponseBody
void addToCart(@RequestBody String str, HttpServletRequest request) {
...
}~{fragments/NavBar :: navbar (~{::body}, __${param.room}__,~{::head})}${param.room} во включаемом фрагменте. @RequestMapping(value = "/pet/update", method = RequestMethod.PUT)
@ResponseBody
public Pet updatePet(@Valid @ModelAttribute Pet pet) {
...
} <!-- Статический импорт с помощью директивы -->
<%@ include file="filename" %>
<!-- Динамический импорт с помощью тега -->
<jsp:include page="filename"/>
<!-- Импорт с помощью JSTL -->
<c:import url="filename" /><html>
<head>
<meta name="_csrf" content="${_csrf.token}"/>
<meta name="_csrf_header" content="${_csrf.headerName}"/>
...
</head>
...
</html>var csrfHeaderName = "X-CSRF-TOKEN";
var csrfTokenValue;
var metaTags = document.getElementsByTagName('meta');
for(var i = 0; i < metaTags.length; i++) {
var metaTagName = metaTags[i].getAttribute("name");
if(metaTagName === "_csrf_header")
csrfHeaderName = metaTags[i].getAttribute("content");
if(metaTagName === "_csrf")
csrfTokenValue = metaTags[i].getAttribute("content");
}
...
var xhr = new XMLHttpRequest();
xhr.open("POST", "userChangeTariff?tariffId=" + num1 + "&contractNumber=" + num2, false);
xhr.setRequestHeader(csrfHeaderName, csrfTokenValue);
xhr.send();