我有一个jstl循环,我想格式化表单的日期:输入.我已经尝试了许多我喜欢在线的建议的排列,但是我无法让它工作..有人可以看一下吗?
我已经为上下文包含了完整的循环,但问题出在最后一个<td></td>
块中.
<c:forEach items="${valueTransactionsModel.transactions}" var="transaction" varStatus="loopStatus">
<tr class="${loopStatus.index % 2 == 0 ? 'even' : 'odd'}">
<spring:message code="valueTransactions.transactionType" var="transactionTypeLbl" />
<tags:dropdown id="transactionTypeId${loopStatus.index}" path="transactions['${loopStatus.index}'].valueTransactionType.id"
fieldName="${transactionTypeLbl}" classStyle="mandatory" items="${transactionTypes}" itemLabel="value"/>
</tr>
<tr class="${loopStatus.index % 2 == 0 ? 'even' : 'odd'}">
<spring:message code="valueTransactions.transactionAmount" var="valueTransactionAmountLbl${loopStatus.index}" />
<tags:input id="transactionAmountId${loopStatus.index}"
path="transactions['${loopStatus.index}'].valueTransactionAmount"
fieldName="valueTransactionAmountLbl${loopStatus.index}"
maxlength="30" classStyle="mandatory" />
<spring:message code="valueTransactions.transactionDate"
var="valueTransactionDateLbl${loopStatus.index}" />
<td>
<form:input type="text" path="transactions['${loopStatus.index}'].valueTransactionDate" cssClass="mandatory" value="<fmt:formatDate value="transactions['${loopStatus.index}'].valueTransactionDate" type="date" pattern="yyyy-MM-dd"/>" />
</td>
</tr>
</c:forEach>
Run Code Online (Sandbox Code Playgroud)
我最近的问题是:
JSPG0055E:无法从name [transactions [] value [$ {loopStatus.index}]创建xml属性
是否可以以一种不被一组配置文件使用的方式配置bean?目前我可以这样做(我相信):
@Profile("!dev, !qa, !local")
Run Code Online (Sandbox Code Playgroud)
是否有更简洁的符号来实现这一目标?我们假设我有很多个人资料.另外,如果我有一个Mock和一些服务(或其他)的具体实现,我可以只注释其中一个,并假设另一个将用于所有其他情况?换句话说,这是必要的:
@Profile("dev, prof1, prof2")
public class MockImp implements MyInterface {...}
@Profile("!dev, !prof1, !prof2") //assume for argument sake that there are many other profiles
public class RealImp implements MyInterface {...}
Run Code Online (Sandbox Code Playgroud)
我可以只注释其中一个,并@Primary
在另一个上添加注释吗?
本质上我想要这个:
@Profile("!(dev, prof1, prof2)")
Run Code Online (Sandbox Code Playgroud)
提前致谢!
我没有特别的原因对此进行过F3,并且惊讶地发现这种方法实现如下:
public static boolean isTrue(Boolean bool) {
if (bool == null) {
return false;
}
return bool.booleanValue() ? true : false;
}
Run Code Online (Sandbox Code Playgroud)
为什么不?
public static boolean isTrue(Boolean bool) {
if (bool == null) {
return false;
}
return bool.booleanValue();
}
Run Code Online (Sandbox Code Playgroud)
这并不重要,所以我想知道它有什么好处吗?可读性是一个足够弱的论点,我认为这是噪音.除非我遗失了一些其他好处.
我已经看到已经提出了一些这个问题的实例.但是,我相信我满足这些解决方案中列出的标准.即我很确定我的课程路径上有所需的罐子+我的原理配置地址按顺序查看.
一个解决方案提到该问题可能是由于在类路径上有另一个XML解析器引起的.我在我的类路径上有dom4j,但我已将其删除以进行测试,问题仍然存在.
这是我的类路径:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/mysql-connector-java-5.1.18-bin.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/jaxen-1.1.3.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.aop-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.asm-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.aspects-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.beans-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.context.support-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.context-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.core-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.expression-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.instrument.tomcat-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.instrument-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.jdbc-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.jms-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.orm-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.oxm-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.test-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.transaction-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.web.portlet-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.web.servlet-3.1.0.RC1.jar"/>
<classpathentry kind="lib" path="C:/Users/user/workspace/rugby-project/lib/org.springframework.web.struts-3.1.0.RC1.jar"/>
<classpathentry …
Run Code Online (Sandbox Code Playgroud) 好的,我有许多io.swagger.models.Swagger对象,我将它们合并到一个新的超级Swagger中。现在我想要超级HTML。我怎么能得到这个?注意,为了获得每个Swagger定义,我使用了新的SwaggerParser()。read(“ pathToSwagger”)。因此,这是从Swagger源获取Swagger对象的示例,现在我需要相反的操作,即从io.swagger.models.Swagger对象生成Swagger源。你能帮我吗?
我试过了,不行,我哪里出错了?
application.properties(工作正常)
document-contact={name:'joe',email:'joe.bloggs@gmail.com'}
Run Code Online (Sandbox Code Playgroud)
application.yml(不起作用;下面的堆栈跟踪)
document-contact:
name: 'joe'
email: 'joe.bloggs@gmail.com'
Run Code Online (Sandbox Code Playgroud)
爪哇:
@Value("#{${document-contact}}")
private Map<String, String> contact;
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'consolidatedSwaggerDocumentationController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'document-contact' in value "#{${document-contact}}"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:403) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1429) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
Run Code Online (Sandbox Code Playgroud) 例如,是否可以使用 RecursiveAction 与虚拟线程池(而不是 fork/join 池)结合使用(在我尝试设计不良的自定义工作之前)?
我对存储过程相当陌生。我天真地认为我可以建立如下的 select 语句。我不能,你们中的一些人会因为我的想法而咧嘴笑。
一个人如何做我想做的事?
提前致谢。
CREATE PROCEDURE GET_CUSTOMER_FOR_BORROWER_LETTER (
IN APPLICATION_ID INTEGER,
IN GET_GUARANTOR INTEGER,
IN GET_PREFERRED_CONTACT INTEGER
)
DYNAMIC RESULT SETS 1
READS SQL DATA
P1:BEGIN
DECLARE selectStmt VARCHAR(800);
DECLARE selectStmtPreferred VARCHAR(400);
DECLARE selectStmtApplicants VARCHAR(400);
DECLARE selectStmtGuarantor VARCHAR(400);
DECLARE cursor1 CURSOR WITH RETURN FOR
selectStmt -- will define this later, conditionally (babe in the woods :) )
OPEN cursor1;
set selectStmtPreferred = 'select "preferred applicant" as recipient_type, app.APPLICATION_ID, cust.KEY from application app, customer cust, application_detail appd where app.application_id = …
Run Code Online (Sandbox Code Playgroud) 使用Lambdaj,我试图从列表中隔离满足2个单独条件的对象.以下两个都将实现我的目标.一个)
List<SomeObject> someObjectsWithMatchingSomeObjectIds = select(foo.getSomeParentObject().getSomeObjects(), having(on(
SomeObject.class).getId(), equalTo(123)));
SomeObject someObject = selectFirst(someObjectsWithMatchingSomeObjectIds, having(on(SomeObject.class).getLoanTerm(),
notNullValue()));
Run Code Online (Sandbox Code Playgroud)
B)
SomeObject someObject = selectFirst(select(foo.getSomeParentObject().getSomeObjects(), having(on(SomeObject.class)
.getId(), equalTo(123))), having(on(SomeObject.class).getLoanTerm(), notNullValue()));
Run Code Online (Sandbox Code Playgroud)
第一个似乎更具可读性,特别是对于不熟悉API的人.第二个似乎利用了lambdaj的函数式编程方面,哪个最好?
我认为可读性赢了.但是,我想知道,使用LambdaJ过滤集合时是否有更简洁的方法来处理两个独立的条件?
我想知道为什么这个断言在JUnit中有效:
assertEquals("[String1, String2, String3]", Arrays.asList("String1", "String2", "String3").toString());
Run Code Online (Sandbox Code Playgroud)
我看不到在List或Collection上的任何地方覆盖toString().
我很高兴它有效,但仍然很好奇.
谢谢,Declan
java ×8
spring ×2
spring-boot ×2
aspectj ×1
collections ×1
config ×1
date-format ×1
db2 ×1
filtering ×1
fork-join ×1
jsp ×1
jstl ×1
junit4 ×1
lambdaj ×1
maps ×1
merge ×1
project-loom ×1
readability ×1
spring-aop ×1
spring-mvc ×1
springfox ×1
swagger ×1
swagger-ui ×1
yaml ×1