【问题标题】:Internet Explorer destroys context on a:commandButtonInternet Explorer 破坏 a:commandButton 上的上下文
【发布时间】:2013-05-03 21:44:51
【问题描述】:

在 Internet Explorer 中使用 a:commandButton 时遇到一些问题。我正在使用 <a:commandButton> 和添加详细信息对象的操作。当我使用 Chrome 或 Firefox 时,这工作得很好。但是,当单击 Internet Explorer 中的添加按钮时,上下文将被销毁并创建一个新的。

一些代码:
ListPage.xhtml

<a:commandButton action="#{articleDetail.add}"
                            value="Add" id="PopadArticleBtn"
                            reRender="#{facesContext.maximumSeverity eq null ? 'ArticlePanel' : 'PopArticle, errorMsg'}"
                            oncomplete="#{facesContext.maximumSeverity eq null ? 'Richfaces.hideModalPanel(\'addArticle\');' : ''}">                                

最后是 ArticleDetail.java 类:(包括 Getter 和 setter)

@Name("articleDetail")
@Scope(ScopeType.CONVERSATION)
@AutoCreate
public class ArticleDetail extends EntityQuery<ArticleDetail> {
    private String fuuPm;
    private String fuuTm;
    private String fuuDc;
    private String fuuDn;
    private String fuuVc;
    private String fuuEc;
    private String fuuIc;
    private String fuuTc;
    private String fuuUc;

    public void add() {
    Boolean unique = Boolean.TRUE;
    Boolean empty = Boolean.FALSE;
    article = populateArticle(
            article,
            getEntityManager().find(
                    ArticleMaster.class,
                    new ArticleMasterId(Integer.parseInt(fuuPm), Integer
                            .parseInt(fuuTm), fuuDc, fuuDn, fuuVc, fuuEc,
                            fuuIc, fuuTc, fuuUc)));
}

所以问题:在chrome中,调试时,所有属性都有一个值,在Internet Explorer中所有值都是null,因为创建了nex上下文

我真的不知道为什么其他浏览器似乎完好无损地保留了对话上下文,而 IE 不知何故会导致新的上下文。

类似问题https://stackoverflow.com/questions/2906774/a4jcommandbutton-causes-full-page-reload-on-ie7

提前致谢!

【问题讨论】:

  • 我不明白 - 所以如果你点击 IE 中的链接,你会在 URL 栏中看到什么?
  • @dratewka 当我点击 IE、Chrome 或 FF 中的链接时,我得到了正确的 url (http://localhost:8080/oms/ArticleDetail.seam?fuuPm=201306&amp;fuuTm=201306&amp;fuuDc=94111&amp;fuuDn=G713067R0001&amp;fuuVc=FFSO+&amp;fuuEc=+EWP&amp;fuuIc=FR&amp;fuuTc=DO&amp;fuuUc=PCT0011869&amp;logic=and&amp;cid=16&amp;conversationPropagation=join)
  • 问题是,当我尝试持久化一个ArticleDetail时,文章属性是使用参数填充的,但是由于在IE中为null,所以这不起作用
  • 好吧,让我直截了当 - 1)每个浏览器上的 URL 都是相同的; 2) 这是一个 GET 请求,所以所有参数值都在 URL 中; 3) 在服务器端,在 IE 中单击时会得到空参数值。对吗?
  • 我的第一个猜测是它在服务器端 - 你有任何请求过滤器或类似的东西吗?您在 IE 上的其他 get 请求是否遇到同样的问题?

标签: java internet-explorer jsf get seam


【解决方案1】:

出现此问题是因为 &lt;a:commandButton&gt; 被放置在嵌套表单中。通过删除表单和它原来所在表单outside的commandButton,行为符合预期。

IE 对表单的 W3C 规范似乎比 Chrome 和 Firefox 更严格:W3C Forms Norms

每个表单都必须包含在一个 FORM 元素中。一个文档中可以有多个表单,但 FORM 元素不能嵌套。

【讨论】:

    猜你喜欢
    • 2012-04-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-20
    • 2011-08-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多