我正在使用弹簧mvc控制器.在内部控制器我正在放一些值让我们说模型中的字符串.现在我想重温那个值,或者只是说在javascript中打印这个值.我该怎么做?这是我的控制器类.我正在添加"电影"作为关键.现在我想在java脚本中显示该电影的名称(不在JSP内部.但是在JavaScript中)
@Controller
@RequestMapping("/movie")
public class MovieController {
@RequestMapping(value="/{name}", method = RequestMethod.GET)
public String getMovie(@PathVariable String name, ModelMap model) {
model.addAttribute("movie", name);
return "list";
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的JSP
<html>
<head>
//I want to print movie name inside java script not inside jSP body tag.
<script type="text/javascript">
var movie_name = ${movie};
alert("movies name"+ movie_name);
</script>
</head>
<body>
<h3>Movie Name : ${movie}</h3>//When i print here its working fine.
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 根据 Spring 文档,如果您需要通过数据库管理 Spring 安全性,您应该有一些标准的表架构。例如。
create table users(
username varchar(256) not null primary key,
password varchar(256) not null,
enabled boolean not null
);
create table authorities (
username varchar(256) not null,
authority varchar(256) not null,
constraint fk_authorities_users foreign key(username) references users(username)
);
create unique index ix_auth_username on authorities (username,authority);
Run Code Online (Sandbox Code Playgroud)
我面临的问题如下。1)无法理解如何使用 JPA 实现这种表模式?
我尝试过如下。
@Entity
@Table(name="USERS")
public class UsersPersistence extends Users implements Serializable{
private static final long serialVersionUID = 1009548075747154488L;
public UsersPersistence() {
super();
}
public UsersPersistence(long id, String userName, String …Run Code Online (Sandbox Code Playgroud)