尝试使用JSTL但有以下问题:
Index.xhtml页面:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ice="http://www.icesoft.com/icefaces/component" xmlns:jsp="http://java.sun.com/JSP/Page">
<body>
<c:out value="Hello world!"/>
</body></html>
Run Code Online (Sandbox Code Playgroud)
POM:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
输出来源:
<html id="document:html" lang="en" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" xmlns:jsp="http://java.sun.com/JSP/Page"><head><meta content="Rendered by ICEFaces D2D" name="icefaces" />
.....
<c:out value="Hello world!"></c:out>
....</body></html>
Run Code Online (Sandbox Code Playgroud)
正如你可以看到它没有处理c:out而只是将它作为文本打印出来.
我有两个未知类型的数组...有没有办法检查元素是否相同:
public static boolean equals(Object a , Object b) {
if (a instanceof int[])
return Arrays.equals((int[]) a, (int[])b);
if (a instanceof double[]){
////etc
}
Run Code Online (Sandbox Code Playgroud)
我想在没有所有实例检查的情况下这样做....
有没有办法在eclipse项目中查看最近更改的所有文件(包括最近被其他CVS用户更改过的文件)?谢谢.
如何创建一个链接,您可以通过电子邮件发送给用户以确认他们的电子邮件地址是否被点击了JSF?即一旦他们点击链接,他们的帐户就会被激活.
"Java Concurrency in Practice"给出了以下不安全类的示例,由于Java内存模型的性质可能最终会永久运行或打印0.
这个类试图证明的问题是这里的变量不是线程之间的"共享".因此,线程看到的值可能与另一个线程不同,因为它们不是易失性或同步的.另外由于JVM ready = true允许的语句的重新排序可能在number = 42之前设置.
对我来说,这个类总是使用JVM 1.6正常工作.有关如何让这个类执行不正确的行为(即打印0或永远运行)的任何想法?
public class NoVisibility {
private static boolean ready;
private static int number;
private static class ReaderThread extends Thread {
public void run() {
while (!ready)
Thread.yield();
System.out.println(number);
}
}
public static void main(String[] args) {
new ReaderThread().start();
number = 42;
ready = true;
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用Spring注释,我想使用延迟初始化.
我遇到了一个问题,当我想从另一个类导入一个bean时,我被迫使用@Autowired它似乎没有使用lazy init.反正有没有强制这种懒惰的初始化行为?
在这个例子中,我不希望看到"正在加载父bean",因为我只加载childBean没有依赖关系lazyParent.
@Configuration
public class ConfigParent {
@Bean
@Lazy
public Long lazyParent(){
System.out.println("Loading parent bean");
return 123L;
}
}
Run Code Online (Sandbox Code Playgroud)
@Configuration
@Import(ConfigParent.class)
public class ConfigChild {
private @Autowired Long lazyParent;
@Bean
public Double childBean() {
System.out.println("loading child bean");
return 1.0;
}
@Bean
@Lazy
public String lazyBean() {
return lazyParent+"!";
}
}
Run Code Online (Sandbox Code Playgroud)
public class ConfigTester {
public static void main(String[] args) {
ApplicationContext ctx = new AnnotationConfigApplicationContext(ConfigChild.class);
Double childBean=ctx.getBean(Double.class);
System.out.println(childBean);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试预加载font-awesome以改善我的页面加载时间:
<link rel="preload" as="style" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"/>
<link rel="preload" as="font" type="font/woff2" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/fonts/fontawesome-webfont.woff2?v=4.3.0"/>
Run Code Online (Sandbox Code Playgroud)
但是...... Chrome似乎下载了两次字体并报告
资源 http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/fonts/fontawesome-webfont.woff2?v=4.3.0 是使用链接预加载预加载的,但是在窗口加载事件的几秒钟内没有使用.请确保没有预装任何东西.
什么是从Galileo升级到Helios同时仍然保留我的设置和插件的最佳方式?
谢谢
如何告诉Spring运行该init方法?我需要获取Proxied Async类并使用它进行一些初始化.
@Configuration
@EnableAsync
public class Config {
@Bean
public AsyncBean asyncProxyBean(){
return new AsyncBean();
}
public void init(){
doStuffWithProxy(asyncProxyBean());
}
@Bean
public String thisIsHack(){ //this runs the init code but bean is a bit hacky
doStuffWithProxy(asyncProxyBean());
return "";
}
}
Run Code Online (Sandbox Code Playgroud) java ×4
eclipse ×2
jsf ×2
spring ×2
annotations ×1
arrays ×1
concurrency ×1
cvs ×1
eclipse-3.5 ×1
eclipse-3.6 ×1
font-awesome ×1
javafx-2 ×1
jstl ×1
lazy-loading ×1
preload ×1
primitive ×1
spring-3 ×1
tableview ×1
upgrade ×1