我学会了使用 Java 和 Seam(以及 JSF 1.2)构建 Web 应用程序
但现在我正在使用纯 Java EE 6 和 JSF (Mojara 2.0.9) - 没有任何额外的框架。
在Seam中我使用了forindex.xhtml限制index.page.xml:
<restrict>#{authorizationManager.isAdmin()}</restrict>
Run Code Online (Sandbox Code Playgroud)
有没有像page.xml一样的功能?
并且:
我还使用了index.page.xml拨打一些电话,例如:
<action execute="#{indexController.doSomething()}" on-postback="false"/>
Run Code Online (Sandbox Code Playgroud)
@PostConstruct现在是在控制器中为 .xhtml 执行此操作的唯一机会吗?
另外我如何在没有 的情况下做这样的事情page.xml?
<navigation>
<rule if-outcome="OK">
<redirect view-id="/pages/index.xhtml" />
</rule>
</navigation>
Run Code Online (Sandbox Code Playgroud)
在我看来,纯JavaEE的工作方式完全不同?
(你不必向我发送完整的代码,只需给我我必须谷歌搜索的关键词,谢谢!)
我正在使用JSF 2.0
这是我的faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file is not required if you don't need any extra configuration. -->
<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
<navigation-rule>
<from-view-id>/pages/test/test.html</from-view-id>
<navigation-case>
<from-outcome>write</from-outcome>
<to-view-id>/pages/test/test-write.html</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
Run Code Online (Sandbox Code Playgroud)
TestController.java
@ManagedBean(name="testController")
@SessionScoped
public class TestController implements Serializable {
private static final long serialVersionUID = -3244711761400747261L;
public String test() {
return "write?faces-redirect=true";
}
Run Code Online (Sandbox Code Playgroud)
在我的test.xhtml文件中
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition 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"
template="/WEB-INF/templates/default.xhtml">
<ui:define name="content">
<h:form>
<h:commandButton action="#{testController.test()}" value="test" />
</h:form>
</ui:define>
</ui:composition>
Run Code Online (Sandbox Code Playgroud)
这是我的web.xml
<web-app …Run Code Online (Sandbox Code Playgroud) 我们对某些Internet Explorer版本有一些奇怪的问题,所以我们有一个浏览器开关
<head>
<!--[if IE 6]>
<!-- load some IE6 stuff -->
<meta http-equiv="X-UA-Compatible" content="IE=6" />
<![endif]-->
<!--[if IE 7]>
<!-- load some IE7 stuff -->
<meta http-equiv="X-UA-Compatible" content="IE=6" />
<![endif]-->
<!--[if IE 8]>
<!-- load some IE8 stuff -->
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<![endif]-->
<!--[if IE 9]>
<!-- load some IE9 stuff -->
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<![endif]-->
</head>
Run Code Online (Sandbox Code Playgroud)
如果我像这样加载它,我在IE9 Developer附加组件中看到:
HTML1115:与X-UA兼容的META-Tag("IE = 8")被忽略,因为documentmodus已经加载.
(最初是德语,所以我应该翻译)
并且文档模式仍然是IE9
如果我在我的<head>标签中写得很难:
<meta http-equiv="X-UA-Compatible" content="IE=8" />
Run Code Online (Sandbox Code Playgroud)
IE9将作为IE8加载,所以这可行,但那时IE6的东西当然是错误的....
那么有没有办法像我第一次尝试那样做?
internet-explorer browser-detection internet-explorer-9 x-ua-compatible
我遇到了一些CSS的问题
我有N个外部div,具有可变的动态高度.
每个outside-div都有一个内部div,它应该位于外部div的底部.
所以,使用绝对位置的技巧,比如如何将内部div与外部div的底部对齐?不可能.
我为你做了一个jsfiddle:http:
//jsfiddle.net/xSTtp/4/
HTML:
<div class="outside">
<div class="inside">
xyz
</div>
</div>
<div class="outside">
<div class="inside">
xyz
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
.outside {
/* the height will be dynamic, 100px is just for the demo */
height: 100px;
border: 1px solid green;
}
.inside {
border: 1px solid red;
/* not working*/
/* display: table-cell;
vertical-align: bottom;
*/
/* i want the red at the bottom of the green, not in the page …Run Code Online (Sandbox Code Playgroud) 我在 Kotlin 中有一个这样的(数据)类。
在使用活动 Spring 配置文件运行应用程序时,live我只想返回name.
但是运行具有活动 Spring 配置文件的应用程序test,我想version显示出来,这样我就可以测试我是否得到了正确的版本。
data class MyClass(
val name: String
@JsonIgnore
val version: Number
)
Run Code Online (Sandbox Code Playgroud)
有可能吗?
java-ee-6 ×2
jsf-2 ×2
navigation ×2
css ×1
faces-config ×1
fasterxml ×1
html ×1
jackson ×1
java ×1
json ×1
kotlin ×1
restrictions ×1