在我的JSF 2 Web应用程序中,我使用以下代码根据selectedStatus显示和切换rich:dataTable的内容:
<h:selectOneRadio id="statusSelection" value="#{backingBean.selectedStatus}" style="width:auto; float:left;">
<f:selectItem itemValue="AVAILABLE" itemLabel="Available" />
<f:selectItem itemValue="INACTIVE" itemLabel="Inactive" />
<f:ajax render="itemsDataTable" execute="#{backingBean.sortByTitel('ascending')}" />
<f:ajax render="itemsDataTable" event="click" />
</h:selectOneRadio>
Run Code Online (Sandbox Code Playgroud)
dataTable包含a4j:commandLink,在更改表内容后无意中需要在某些IE版本中双击 - 我发现,执行以下Javascript代码(在IE的调试控制台上,在表内容更改后)解决了问题:
document.getElementById(<dataTableClientId>).focus()
Run Code Online (Sandbox Code Playgroud)
我的问题是:在表格内容发生变化后,如何实现javascript代码的自动执行?
我一直在研究一个使用MongoDB作为存储形式的Java应用程序,但是我遇到了一个问题.当用户在我的应用程序中添加注释时,它会将文档添加到注释集合中,然后对统计数据执行upsert.但是,upsert仅在第一次添加(更新后没有调用或插入新数据).这是相关的代码:
public class CommentDAO implements ICommentDAO {
@Autowired
@Qualifier(value = "mongoDB")
MongoTemplate mongoTemplate;
public UserComment addComment(UserComment userComment) {
updateStats(userComment, 1L);
mongoTemplate.save(userComment);
return userComment;
}
public void updateStats(UserComment userComment, Long offset) {
Update update = new Update();
update.inc("total", offset);
Query query = query(where("entity").is(userComment.getEntity()));
WriteResult wr = mongoTemplate.upsert(query, update, CommentStat.class);
}
}
Run Code Online (Sandbox Code Playgroud)
以下是我的评论集合中的结果示例:
{
"_id" : ObjectId( "50ab0566e4b0ea8f74b82d48" ),
"_class" : "com.test.models.comment.UserComment",
"userId" : 4,
"ownerId" : 3,
"comment" : "Test comment",
"type" : "ART",
"entity" : "759446489112216656",
"date" : Date( 1353385318079 …Run Code Online (Sandbox Code Playgroud) 在具有 AngularJS 前端的 Spring Boot 应用程序中,序列化时必须将“Pin”字段值涂黑,即,如果 POJO 中的 Pin 字段值为 null,则相应的 JSON 字段必须保持为空;如果字段值包含数据,则必须将其替换为“***”字符串。
Jackson 是否提供了完成此任务的功能?
我在使用Hibernate 3和ojdbc7.jar的Tomcat 7上的应用程序中有一个非常奇怪的错误:在当前版本中,DB列已更改为CLOB,并按以下方式配置:
@Column(name = "BESCHREIBUNG")
@Length(min = 0, max = 4000)
@NotNull
@Lob
public String getBeschreibung() {
Run Code Online (Sandbox Code Playgroud)
这在我的本地环境(Oracle 11g XE)和测试环境(Oracle 12)中完全正常,但是在prelive环境(Oracle 12)中,我在应用程序启动期间收到以下错误:
org.hibernate.HibernateException: Wrong column type in XXXX.MYTABLE for column BESCHREIBUNG. Found: clob, expected: varchar2(4000 char)
at org.hibernate.mapping.Table.validateColumns(Table.java:283)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1343) at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:378)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:906)
Run Code Online (Sandbox Code Playgroud)
有什么暗示吗?我已经检查过tomcat的/ lib - 目录,如果有一个过时的ojdbc或hibernate jar,没有成功.
java ×3
ajax ×1
clob ×1
hibernate ×1
jackson ×1
javascript ×1
jsf ×1
json ×1
mongodb ×1
ojdbc ×1
spring-boot ×1
spring-mongo ×1
tomcat ×1