我有一个带有一些链接的网页,我需要通过jQuery拦截链接点击事件.任务完成得很好,但随后出现问题:如果用户在javascript未完成加载时单击链接,则链接到另一个页面(这是一个错误).
我试图找到一种方法来在页面加载完成之前禁用链接点击,但现在最好的解决方案是我必须添加onclick="return false;"到我的链接中,这不是很优雅.有没有更好的解决方案?
谢谢你的帮助,
我有一个域对象.
class Post {
User user
String subject
String body
Date dateCreated
}
Run Code Online (Sandbox Code Playgroud)
我该怎么做?直接GORM,HQL或标准是更好的方法吗?我不知道什么样的日期操作("今天eq")将在标准中起作用.
我得到如下响应:
<response>
<status code='200' server_time='xxx' />
<tests>
<test id='1' name='a!' status='Started' />
<test id='2' name='bb!' status='New' />
<test id='3' name='ccc!' status='New' />
<test id='4' name='dddd!' status='New' />
</tests>
</response>
Run Code Online (Sandbox Code Playgroud)
我已经在采样器中添加了一个 Xpath 提取器:
Reference name: mytest
XPath Query: //test[@id='1']
Run Code Online (Sandbox Code Playgroud)
但是返回变量(mytest)是错误的。
OUT.println(mytest) --> void
Run Code Online (Sandbox Code Playgroud)
我是 JMeter 的新手。我能做些什么来解决这个问题?
我有一个使用用户名/密码SpringSecurity配置的工作Web应用程序.现在我想把它移植到一个简单的Facebook应用程序中.出于某种原因,我想通过使用返回的facebook访问令牌进行身份验证,以及保留用户名密码验证器.
详细说明,我会检查用户的facebook访问令牌进行身份验证,返回者:
https://graph.facebook.com/oauth/access_token?client_id=[my_api_key]&redirect_uri=[my_redirect_uri]&client_secret=[my_api_secret]&code=[code]
用户不需要提供任何用户名/密码,因为他们已经使用Facebook登录.但我想保留(用户名/密码)spring安全配置,以便用户可以在我的原始网站上登录.
SpringSecurity是否支持这种身份验证?如果答案是肯定的,我想知道如何做到这一点?我是否需要编写自定义身份验证提供程序来执行此操作?
更新:最后,我们自定义了SpringSecurity的身份验证方式,以便通过扩展UsernamePasswordAuthenticationFilter(声明为formLoginFilter)来接受access_token作为身份验证参数
我对WPF很新,所以请理解这个问题是否过于简单.我要做的是设置背景图像MediaElement(作为容器盒播放).我试图为包含它的网格设置背景图像,但它不起作用.MediaElement也没有背景图片.
是否有任何优雅的方式来制作这样的背景?
我的MediaElement:
<MediaElement Name="mediaLessonImage" Grid.Column="1" Margin="50,78.01,7,159.99" Grid.Row="1"></MediaElement>
Run Code Online (Sandbox Code Playgroud)
我会感谢任何帮助.
更新: 基于Ioxxy答案,我已经检索了解决方案(只是稍作修改):
<Border Grid.Column="1" Margin="50,78.01,7,159.99" Grid.Row="1">
<Border.Background>
<ImageBrush ImageSource="BackImage.jpg" Stretch="Fill"/>
</Border.Background>
<MediaElement Name="mediaLessonImage" />
</Border>
Run Code Online (Sandbox Code Playgroud) 我注意到在某些网站如http://academia.edu/,注册表单在其文本输入字段中有一些"占位符".这样在文本框中,文本框内没有标签,而是一个相当轻微的字体"名字"字样.
使用Firebug进行调查时,我看到以下代码:
<input class="standard_text magic-default magic-default-on" id="user_first_name" name="user[first_name]" size="30" type="text" value="First Name">
Run Code Online (Sandbox Code Playgroud)
看起来场景后面会发生一些"神奇"的javascript.但由于我还不熟悉javascript调试,我无法追查他们是如何做到这一点的.
有谁知道如何产生这种效果?
我正在尝试将JUnit和Spring结合在一个Web项目中。由于这个问题,我成功将spring config文件加载到TestClass中:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class TwitterServiceTest {
@Resource
IRepository repository;
Run Code Online (Sandbox Code Playgroud)
但是当测试运行时,出现以下错误:
由以下原因引起:org.springframework.beans.factory.parsing.BeanDefinitionParsingException:配置问题:无法找到XML模式命名空间的Spring NamespaceHandler [ http://java.sun.com/xml/ns/javaee]
我想问题可能出在库文件不在类路径中。当前,我使用Sysdeo Eclipse Tomcat插件 DevLoader进行加载工作(将jar文件从M2_REPO加载到类路径)。
该项目取决于许多库。关于如何解决此错误有任何想法吗?任何帮助将不胜感激。
我多次遇到这个问题:有时当我命令:grails run-app时,编译器只是一次又一次地运行,即使我之后没有改变.看起来像:
Running Grails application..
Server running. Browse to http://localhost:8080/LiningTest
[groovyc] Compiling 1 source file to E:\workspace\W1\LiningTest\target\classes
[groovyc] Compiling 2 source files to E:\workspace\W1\LiningTest\target\classe
s
[delete] Deleting directory C:\Documents and Settings\Long\.grails\1.3.6\proj
ects\LiningTest\tomcat
Running Grails application..
Server running. Browse to http://localhost:8080/LiningTest
[groovyc] Compiling 1 source file to E:\workspace\W1\LiningTest\target\classes
[groovyc] Compiling 2 source files to E:\workspace\W1\LiningTest\target\classe
s
[delete] Deleting directory C:\Documents and Settings\Long\.grails\1.3.6\proj
ects\LiningTest\tomcat
Running Grails application..
Server running. Browse to http://localhost:8080/LiningTest
[groovyc] Compiling 1 source file to E:\workspace\W1\LiningTest\target\classes
...
Run Code Online (Sandbox Code Playgroud)
编译器在"服务器运行"时成功,但随后它会自动重新编译一些文件(我不知道哪个文件),然后重新运行,然后重新编译...
当我遇到语法错误时,我遇到过这个问题 …
我目前正在开发一个需要严格计时的WPF应用程序,据说,迟到2秒很重要.
我有一个MediaElement mediaPlayer,每当一个Dispatcher计时器被触发时,它会寻找新的位置并进行游戏.但我注意到mediaPlayer.Position与计时器没有很好的同步.在下面的示例中,我设置了在55秒后触发的dispatcherTimer,但是从Timer_Tick中的MessageBox接收的值是108.276746,这是晚2秒(55 + 55 = 110).
private void button1_Click(object sender, RoutedEventArgs e)
{
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(55);
timer.Tick += new EventHandler(timer_Tick);
mediaPlayer.Source = new Uri("test.wma", UriKind.Relative);
_currentPosition = 55;
mediaPlayer.Position = TimeSpan.FromSeconds(_currentPosition);
timer.Start();
}
void timer_Tick(object sender, EventArgs e)
{
MessageBox.Show("Position" + mediaPlayer.Position.TotalSeconds);// print around 108 seconds
}
Run Code Online (Sandbox Code Playgroud)
这是问题,因为我需要mediaPlayer位置与调度程序计时器完全同步.
有关更多信息,这里的根本问题是:调度程序计时器严格遵循mediaElement进度,因为我需要将其他控件与mediaPlayer的位置同步.迟到2秒是不可接受的.有谁知道如何实现这种效果?
更新目的:我正在尝试根据音频的播放位置"切换插图图像".例如,当叙述者在音频中读到"......我们有一个漂亮的房子"时,程序将显示一个漂亮建筑的图片.但是现在由于位置很晚,它会在音频提到它之前很久就显示出来.
我在加载jar时遇到了一些麻烦.我在Tomcat上部署了Struts2 Web应用程序,导致错误:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:....../Tomcat%206.0/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:....../Tomcat%206.0/webapps/Timesheet/WEB-INF/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
2011-03-31 14:33:48,302 DEBUG com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles:748 - Loading action configurations from: struts-default.xml
2011-03-31 14:33:50,592 DEBUG com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles:832 - Loaded action configuration from: struts-default.xml
...
2011-03-31 14:33:50,809 DEBUG com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register:202 - Loaded type:com.opensymphony.xwork2.util.XWorkConverter name:struts impl:com.opensymphony
.xwork2.util.AnnotationXWorkConverter
Mar 31, 2011 2:33:50 PM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Mar 31, 2011 2:33:50 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/Timesheet] startup failed due to previous errors
Run Code Online (Sandbox Code Playgroud)
我已经排除了所有jar冲突pom.xml,但它似乎是slf4j-log4j …
我正在使用Spring Security制作一个具有3种不同角色的Web应用程序:
目前我的应用程序允许SuperSupporter使用SwitchUserFilter "模拟"DivisionSupporter,让他充当DivisionSupporter.如果DivisionSupporter遇到一些问题 - 并且需要支持,这是必要的.这可能听起来很奇怪,但它有点使用TeamViewer来检查朋友的计算机问题.
此外,现在我们需要让DivisionSupporter "模仿"客户端,以便DivisionSupporter可以"支持"客户端.
但令我担心的是,如果我们给予DivisionSupporter访问权j_spring_security_switch_user,恶意的DivisionSupporter可能会使用它来冒充SuperSupporter(通过使用相应的用户名发布到链接).
我想到了解决这个案子的工作:
<bean id="switchUserFilter" class="org.springframework.security.web.authentication.switchuser.SwitchUserFilter">
<property name="userDetailsService" ref="userDetailsService" />
<property name="switchUserUrl" value="/j_spring_security_switch_user" />
<property name="exitUserUrl" value="/j_spring_security_exit_user" />
<property name="targetUrl" value="/checkRole.html" />
</bean>
Run Code Online (Sandbox Code Playgroud)
在/checkRole操作中(这是targetUrl),我再次检查:如果用户角色是SuperSupporter并且他冒充某人,则应用程序将发送给他/j_spring_security_exit_user(因为SuperSupporter不需要冒充他自己).
虽然它似乎有用,但我担心恶意用户可能会找到一种方法来绕过这堵墙,从而使我们的系统处于危险之中.
我认为SpringSecurity可能已经解决了这个需求,但仍然无法找到它.这种方式真的很安全吗?DivisionSupporter可以使用我当前的解决方案来模拟SuperSupporter吗?
更重要的是,有没有更好的方法来解决这个问题?
任何帮助,将不胜感激.
我只想验证一些数字后只接受3个三点的IP地址
例如:有效:191.123.121.202有效,在小数点后有3个点.无效:191..123.121.202无效,其中2个点依次排列
全点:想要一个强大的IP验证器
$("input.onlynumberdecimal").keydown(function (event) {
console.log(event.keyCode);
if (event.shiftKey == true) {
event.preventDefault();
}
if ((event.keyCode >= 48 && event.keyCode <= 57) ||
(event.keyCode >= 96 && event.keyCode <= 105) ||
event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 37 ||
event.keyCode == 39 || event.keyCode == 46 || event.keyCode == 190) {
} else {
event.preventDefault();
}
if($(this).val().indexOf('.') !== -1 && event.keyCode == 190)
event.preventDefault();
//if a decimal has been added, disable the "."-button
});
Run Code Online (Sandbox Code Playgroud)
在某种程度上,我得到了其他一些网站的帮助.并且还希望如果用户复制并粘贴正确的IP,那么它应该接受,否则它不应该允许他粘贴.
java ×4
javascript ×3
c# ×2
grails ×2
html ×2
security ×2
spring ×2
spring-mvc ×2
wpf ×2
.net ×1
beanshell ×1
classpath ×1
css ×1
date ×1
dispatcher ×1
facebook ×1
grails-orm ×1
hibernate ×1
jar ×1
jmeter ×1
jquery ×1
junit ×1
layout ×1
logic ×1
maven ×1
struts2 ×1
timer ×1
tomcat ×1
web-testing ×1
xpath ×1