小编Joe*_*erg的帖子

相当于 page.xml 中的限制、操作执行和导航规则(Java EE + JSF 2.0 - 来自 Seam)

我学会了使用 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的工作方式完全不同?

(你不必向我发送完整的代码,只需给我我必须谷歌搜索的关键词,谢谢!)

navigation restrictions java-ee-6 jsf-2

3
推荐指数
1
解决办法
2754
查看次数

Faces Navigation在JSF2中没有真正起作用

我正在使用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)

navigation faces-config java-ee-6 jsf-2

1
推荐指数
1
解决办法
7885
查看次数

Browserswitch然后使用meta http-equiv ="X-UA-Compatible" - Documentmodus已经完成

我们对某些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

1
推荐指数
1
解决办法
4327
查看次数

在外部div的底部设置div

我遇到了一些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)

html css vertical-alignment

1
推荐指数
1
解决办法
2618
查看次数

仅将 @JsonIgnore 用于生产,但在测试中它应该在那里

我在 Kotlin 中有一个这样的(数据)类。
在使用活动 Spring 配置文件运行应用程序时,live我只想返回name.
但是运行具有活动 Spring 配置文件的应用程序test,我想version显示出来,这样我就可以测试我是否得到了正确的版本。

data class MyClass( 

 val name: String

 @JsonIgnore
 val version: Number

)
Run Code Online (Sandbox Code Playgroud)

有可能吗?

java json jackson kotlin fasterxml

0
推荐指数
1
解决办法
54
查看次数