小编Mat*_*teo的帖子

使用Thymeleaf从Spring模型设置javascript变量

如何从__CODE__模型中读取模型变量并将其设置为Javascript?

请注意,我正在使用__CODE__模板引擎.

春方:

@RequestMapping(value = "message", method = RequestMethod.GET)
public String messages(Model model) {
    model.addAttribute("message", "hello");
    return "index";
}
Run Code Online (Sandbox Code Playgroud)

客户端:

<script>
    ....
    var m = ${message}; // not working
    alert(m);
    ...
</script>
Run Code Online (Sandbox Code Playgroud)

javascript spring thymeleaf

96
推荐指数
7
解决办法
12万
查看次数

log4j2 JDBC管理器无法连接到数据库

我正在尝试使用mysql配置log4j v2,但它返回此错误:

2014-08-01 15:35:24,819 ERROR Unable to write to database [jdbcManager{ description=databaseAppender, bufferSize=0, connectionSource=factory{ public static java.sql.Connection it.prisma.presentationlayer.webui.ConnectionFactory.getDatabaseConnection() }, tableName=logs, columns=[ { name=message, layout=%message, literal=null, timestamp=false } ] }] for appender [databaseAppender]. org.apache.logging.log4j.core.appender.AppenderLoggingException: Cannot write logging event or flush buffer; JDBC manager cannot connect to the database.

Caused by: java.sql.SQLException: Failed to obtain connection from factory method.

Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://10.41.1.68:3306/test
Run Code Online (Sandbox Code Playgroud)

我的配置类似于doc,唯一的区别是:

new PoolableConnectionFactory(connectionFactory, pool, null, "SELECT 1", false, false, Connection.TRANSACTION_READ_COMMITTED);
Run Code Online (Sandbox Code Playgroud)

我认为我的tomcat7配置得很好,因为我可以用log4j v1登录.

java mysql jdbc log4j2

6
推荐指数
1
解决办法
4384
查看次数

标签 统计

java ×1

javascript ×1

jdbc ×1

log4j2 ×1

mysql ×1

spring ×1

thymeleaf ×1