这里,这里和这里以及其他地方有几个问题/答案,但它们都看起来特定于JQuery并且似乎不适用于此(例如,我不是创建一个新的Form对象,这是一个现有的表单,同时我根本不使用Jquery.
我有一个表单,由于IE7兼容性的原因,在提交之前必须进行修改.我必须BUTTON从表单中删除所有标记,然后添加一个隐藏字段,但这都是现有HTML页面上的现有表单.此代码在IE和Chrome中正常运行,但在Firefox中不起作用(版本23和24都经过测试).
buttonClickFunction(formName, buttonObject) {
var formObject = document.forms[formName];
var i = 0;
// Strip out BUTTON objects
for (i=0;i<formObject.length;i++) {
if (formObject[i].tagName === 'BUTTON') {
formObject[i].parentNode.removeChild(formObject[i]);
i--;
}
}
// Create new field
var newField = document.createElement('input');
newField.type = 'hidden';
newField.id=buttonObject.id;
newField.name = buttonObject.name;
if (buttonObject.attributes['value'] != null) {
newField.value = buttonObject.attributes['value'].value;
} else {
newField.value = buttonObject.value;
}
// Submit form
formObject.appendChild(newField);
document.forms[formName].appendChild(newField);
document.forms[formName].submit();
}
Run Code Online (Sandbox Code Playgroud)
除了document.forms[formName].submit() …
我需要在我的Web应用程序的Spring Application Context启动后运行一个方法.我看了这个问题,但是它指的是Java Servlet启动,并且当时没有Spring的东西运行.
有没有我可以挂钩的"SpringContext.onStartup()"方法?
我有一个多模块(聚合器)Maven项目,它也从父pom继承属性.所以在我的父pom.xml中我有这个:
<groupId>com.something.project</groupId>
<artifactId>MyProject</artifactId>
<packaging>pom</packaging>
<version>1.0.123</version>
<modules>
<module>ModuleA</module>
<module>ModuleB</module>
<module>ModuleC</module>
</modules>
Run Code Online (Sandbox Code Playgroud)
我想让所有子模块继承父版本号1.0.123,但是孩子pom.xml要求我继续硬编码父版本号(ModuleA pom.xml示例):
<artifactId>ModuleA</artifactId>
<name>Some Amazing Thing</name>
<parent>
<relativePath>../</relativePath>
<artifactId>MyProject</artifactId>
<version>1.0.123</version>
<groupId>com.something.project</groupId>
</parent>
Run Code Online (Sandbox Code Playgroud)
我怎样才能将版本号放在父pom中,让模块继承它而不必在多个地方更新它?到目前为止,我已经尝试了$ {project.version}和$ {project.parent.version},Maven似乎对此非常不满意.我也不能完全删除版本参考.
有没有人对此有一个好的答案?
由于POODLE漏洞,最新版本的Chrome和Firefox默认禁用了SSLv3.0 .当我尝试打开我已经设置的网站(并且工作正常)时,这会导致以下错误:
使用Chrome:
A secure connection cannot be established because this site uses an unsupported protocol.
Error code: ERR_SSL_VERSION_OR_CIPHER_MISMATCH
Run Code Online (Sandbox Code Playgroud)
使用Firefox:
Cannot communicate securely with peer: no common encryption algorithm(s). (Error code: ssl_error_no_cypher_overlap)
Run Code Online (Sandbox Code Playgroud)
我已经使用Chrome,Firefox,Tomcat和更多Tomcat文档研究了这个问题.我理解这个问题,但我找不到配置Tomcat 7的文档,只使用现在安全的TLS密码和协议.我不确定是否需要创建新的cert/keypair,更改我的server.xml,或安装新版本的Tomcat,或者是什么.我甚至不确定这些浏览器现在认为哪些版本的密码/协议是"可接受的".任何人都可以指向我的文档或示例设置吗?
我在使用Tomcat 7的Ubuntu 14.04上使用OpenJDK 1.7.
这是我的证书文件(编辑):
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: something
Creation date: May 4, 2013
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=something, OU=something, O=something, …Run Code Online (Sandbox Code Playgroud) 我正在使用 Intellij 和命令行 Git,但我们遇到了看不到提交的问题,因为 Git 默认不显示“无趣的”更改。
例如,如果开发人员“A”更改某些内容并推送更改,然后开发人员“B”将其更改回原样(在“A”更改之前)并推送该更改,那么这些提交将不会显示在历史记录中因为它们会相互抵消(至少这是向我解释的方式。)这使得很难找到问题并导致很多“我的更改去哪里了?”
理想情况下,Intellij 和命令行都会在默认情况下显示完整的历史记录、所有提交,包括合并。
任何人都知道在 .gitconfig 中完成此操作的设置?
编辑:以下部分来自git-log 文档,并解释了我所说的“无趣的变化”是什么意思
默认模式 将历史简化为解释树最终状态的最简单历史。最简单,因为如果最终结果相同,它会修剪一些侧分支(即合并具有相同内容的分支) --full-history 与默认模式相同,但不会修剪一些历史记录。
编辑:哎呀,我想如果我发布删除代码会有所帮助.抱歉.
// delete from permanent store and local list
int index = get_record_to_delete();
if (entityList.getEntities().get(index).getEntityId() != null ) {
// existing persisted record
entityService.delete(entityInfo.getEntities().get(index).getEntityId());
}
//remove from local list
entityList.getEntities().remove(index);
return ownersInfo;
// entityService called by above code
public void delete(MyEntity entity) {
repository.delete(entity); // subclass of org.springframework.data.jpa.repository.JpaRepository
}
Run Code Online (Sandbox Code Playgroud)
我正在使用Spring Data/JPA V 1.4.2.RELEASE和hibernate 3.6.10.Final.
我有一种情况,我正在删除一个实体,删除似乎工作,但当我刷新我的网页时,实体重新出现.因此,它不会产生错误,但记录不会被删除.
该实体包含其中的子实体.我怀疑某种实体依赖问题是让实体不被真正"删除",但我不知道它可能是哪种实体依赖,而Hibernate没有告诉我.包含的实体是否被删除无关紧要,但需要删除此实体.不知道为什么没有发生这种情况.这是我要删除的实体:
public class MyEntity implements java.io.Serializable {
@Id
@GeneratedValue
@Column(name = "MYID", unique = true, nullable = false)
private Long myId;
@Column(name = "MY_NAME", nullable …Run Code Online (Sandbox Code Playgroud) 编辑:我没有对这个问题有所了解,所以我补充一点细节.
我有一个Spring Webflow应用程序(版本2.3.2).我需要从其中一个步骤(不在流程本身内部)的验证中访问多个FlowScope对象.你会认为这很简单,但我无法破解它.
Spring Webflow提供了一系列特殊的EL变量,可用于访问各种范围,但仅限于流本身.在自定义Spring验证器中,似乎没有任何方法可以访问它们:
@Component
public class MyObjectValidator {
@Autowired
ApplicationContext context;
public void validateMyObject(MyObject myObject, Errors errors) {
FlowScope flowScope = context.someMagicFunction(); // <---- UNKNOWN
MyOtherObject otherObject = flowScope.get("otherObject");
if (incrediblyComplexValidation(myObject, otherObject) {
errors.rejectValue("myField","validation.fail","Your object failed validation.");
}
}
}
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,在Spring Webflow Validator中,除了您应该验证的对象之外,没有任何直接的外部链接.我需要访问flowScope中的其他对象.理想情况下,无论是通过ApplicationContext其他环境特征还是其他环境特征,都必须有一种方法来获取这些其他对象.
有人知道答案吗?
如何从 JSP 页面访问环境变量?隐式对象之一是否可以访问它们?我找不到解决此特定问题的示例。理想情况下,我正在寻找类似的东西:
<c:set var="where" value="${myEnvironment.machineName}">
Run Code Online (Sandbox Code Playgroud) 我正在Spring MVC控制器中构建一个新的URL,以传递回客户端.目前我正在尝试这个:
// httpRequest is the current HttpServletRequest
new URL(httpRequest.getProtocol(),
httpRequest.getServerName(),
httpRequest.getServerPort(),
httpRequest.getContextPath().concat("/foo/bar.html"));
Run Code Online (Sandbox Code Playgroud)
问题是httpRequest.getProtocol()给我"HTTP/1.1"而不仅仅是"HTTP".我可以修剪它,但想知道是否有更优雅的方式.
我需要诊断Chrome中CSS问题的帮助。我什至不知道如何诊断这个问题。我只是想知道下一步应该做什么。
就解决方案而言,我已经检查了这个问题,但不是很清楚。我也尝试过这种解决方案(先禁用所有样式,然后再启用一种样式),但是它不起作用。我认为这个问题不适用,因为我们没有从外部域中撤出,因此这不是跨域问题。
问题:
Chrome似乎忽略了我们的替代样式表定义。在我们的应用程序中,我们使用替代样式表和Javascript例程来更改背景颜色。这段代码可以正常工作,并且在Firefox和IE中仍然可以使用,但是在某些时候,它已停止在Chrome中运行。样式表的定义如下:
<link type="text/css" rel="stylesheet" title="white" property="stylesheet" href="/myapp/css/layer.css" />
<link type="text/css" rel="alternate stylesheet" title="silver" property="stylesheet" href="/myapp/css/medium.css" />
<link type="text/css" rel="alternate stylesheet" title="grey" property="stylesheet" href="/myapp/css/dark.css" />
<link type="text/css" rel="alternate stylesheet" title="beige" property="stylesheet" href="/myapp/css/beige.css" />
<link type="text/css" rel="alternate stylesheet" title="green" property="stylesheet" href="/myapp/css/green.css" />
Run Code Online (Sandbox Code Playgroud)
原始的身体定义在这里:
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #282828;
height: 100%;
background: #fff url(../images/header-bg.jpg) center top no-repeat;
min-width: 1024px;
}
Run Code Online (Sandbox Code Playgroud)
应该在替代样式表之一中用(例如)对此进行覆盖:
body {
background: url("../images/header-bg-dark.jpg") …Run Code Online (Sandbox Code Playgroud)