我的应用程序中有一个添加用户选项.我想将哈希格式的用户传递存储在数据库中.密码以纯文本格式存储在框架附带的示例代码中.经过一些搜索,我发现在play2中实现了一个可用于保护密码的Crypto.encryptAES()函数.
我的问题是什么是最好的地方使用它?以及如何使用它来创建最易维护的代码?
我正在使用jQuery插件AutoNumeric,但是当我提交表单时,我无法删除之前字段的格式POST.
我试图使用$('input').autonumeric('destroy')(和其他方法),但它在文本字段上留下格式.
如何POST将未格式化的数据发送到服务器?如何删除格式?初始配置或其他地方是否有属性?
我不想将序列化的表单数据发送到服务器(使用AJAX).我想提交带有未格式化数据的表单,就像普通的HTML操作一样.
我有一个我想要编组的对象.
@XmlRootElement
public class BoxItem {
@XmlElement
Map<Integer, ArrayList<String>> intgerStringArrMap;
BoxItem() {
intgerStringArrMap = new HashMap<Integer, ArrayList<String>>();
for (int i = 0; i < 3; i++) {
ArrayList<String> stringArrayList = new ArrayList<String>();
for (int j = 0; j < 10; j++) {
stringArrayList.add(new BigInteger(130, new SecureRandom()).toString(32));
}
intgerStringArrMap.put(i, stringArrayList);
}
}
}
Run Code Online (Sandbox Code Playgroud)
现在让我们假设我们有一个boxItem = new BoxItem()
如果我调用jaxbMarshaller.marshal(boxItem,System.out);,则每个条目的值都为空.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<boxItem>
<intgerStringArrMap>
<entry>
<key>0</key>
<value/>
</entry>
<entry>
<key>1</key>
<value/>
</entry>
<entry>
<key>2</key>
<value/>
</entry>
</intgerStringArrMap>
</boxItem>
Run Code Online (Sandbox Code Playgroud)
如何在Map值中对ArrayList中的元素进行编组?
我的桌子是这样的
FROM TO DISTANCE ------ ---- ---------- A B 100 B C 100 Z A 120
我需要一个约束添加到不会让表中插入
B A 100或C B 100或A Z 120
我有一个PRIMARY KEY (from, to),CONSTRAINT const_u UNIQUE (to, from)但它没有按预期工作.
编辑:我也不能强制插入字母顺序正确,因为我无法访问插入逻辑编辑#2:你能添加BA 50吗? - 不,你不能.从A到B或B到A应该只有一个唯一的距离,但不能同时进行.
我有一个有很多变量的工作视图模型.
我使用autoNumeric(http://www.decorplanit.com/plugin/)在文本框中进行文本格式化.我想在计算的observable中使用输入字段的观察数据,但是如果具有格式的可观察文本字段被修改,格式化也会保存在变量中.
如何在没有格式化的情况下仅观察输入字段的值?
我认为最好的方法可能是observable的getter/setter,并在设置值时删除格式.我无法在knockout文档中找到为ko.observable()编写get/set方法的解决方案,而ko.computed()无法存储值.
我不想使用隐藏字段或额外变量.
没有它可能吗?
是否可以使用播放框架2呈现pdf文档?
(有一个模块可以渲染pdf播放1.x.有没有办法在播放2中渲染?)
我想将基于XML的配置用于Spring Security.第一个想法是使用SHA-256或任何其他散列函数用于用户密码.我找不到用普通java解决这个问题的好方法.所以我开始在xml中配置东西.当它开始变得有趣时,这就是重点.
我的配置:
弹簧security.xml文件:
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd>
<http pattern="/css/**" security="none"/>
<http pattern="/login.html*" security="none"/>
<http>
<intercept-url pattern="/**" access="ROLE_USER" />
<form-login login-page='/login.html'/>
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="admin" password="admin"
authorities="ROLE_USER, ROLE_ADMIN"/>
<user name="bob" password="bob"
authorities="ROLE_USER"/>
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>
Run Code Online (Sandbox Code Playgroud)
我在类中加载了xml文件,其中public static void main可以找到:
@Configuration
@ComponentScan
@EnableAutoConfiguration
@Order(HIGHEST_PRECEDENCE)
@ImportResource({
"/spring-security.xml"
})
public class PhrobeBootApplication extends SpringBootServletInitializer {
...
}
Run Code Online (Sandbox Code Playgroud)
但是我在任何pageload上都得到以下异常:
[ERROR] org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path …Run Code Online (Sandbox Code Playgroud) 我已经阅读了http://www.playframework.com/documentation/2.0/ScalaFormHelpers上的文档并搜索了解决方案,但我无法弄清楚.
我无法想象你必须创建自定义字段构造函数来设置类.
如何使用默认字段构造函数设置字段类?
感谢帮助!
编辑:如果有办法将其他(自定义属性,如data-*)attr-s设置为元素w/default构造函数,那将是很好的.
我需要编组一个包含String变量的对象.
String var.包含一个XML文档,它通过转义到XMLElement进行编组.
我想将String变量编组为base64格式,并在unmarshall上返回String.
这是可能的吗?
java ×6
javascript ×2
jaxb ×2
jquery ×2
knockout.js ×1
oracle ×1
scala ×1
spring ×1
spring-boot ×1
sql ×1