submitForm() not defined for myfaces.JSF_JS_MODE 'minimal-modern'

妖精的绣舞 提交于 2019-12-24 15:36:49

问题


I tried to set up a simple JSF 2.2 application using MyFaces 2.2.8. Since MyFaces has some context parameters that I never used before, I tried to get familiar with those.

So I got to use org.apache.myfaces.JSF_JS_MODE for the first time and ran into problems with h:commandLink. The commandLink is trying to call myfaces.oam.submitForm() which is not defined if I set the mode to minimal-modern. If I set the mode to minimal or normal it works.

From reading some internet articles I assume this is a bug because submitForm is neither part of jsf-legacy.js nor jsf-i18n.js nor jsf-experimental.js and it apparently is needed by h:commandLink. Also the source code comment of org.apache.myfaces.shared.renderkit.html.util.ResourceUtils.markScriptAsRendered(FacesContext, String, String) tells me

oamSubmit script is included inside jsf.js

here:

public static void markScriptAsRendered(FacesContext facesContext, String libraryName, String resourceName)
{
    getRenderedScriptResources(facesContext).put(
            libraryName != null ? libraryName+'/'+resourceName : resourceName, Boolean.TRUE);
    if (JAVAX_FACES_LIBRARY_NAME.equals(libraryName) &&
        JSF_JS_RESOURCE_NAME.equals(resourceName))
    {
        // If we are calling this method, it is expected myfaces core is being used as runtime and note
        // oamSubmit script is included inside jsf.js, so mark this one too.
        getRenderedScriptResources(facesContext).put(
                MYFACES_LIBRARY_NAME+'/'+MYFACES_JS_RESOURCE_NAME, Boolean.TRUE);
    }
}

What am I missing here? Thanks in advance!


回答1:


I can confirm it is a bug. Solved in MYFACES-4034 for 2.2.10



来源:https://stackoverflow.com/questions/34270601/submitform-not-defined-for-myfaces-jsf-js-mode-minimal-modern

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!