struts 2 firefox Internet Explorer

时间:2011-09-13 22:28:25

标签: javascript html struts

我有一个使用struts 2的应用程序。我的问题是每当我使用IE时,我从HTML页面到我的动作类的属性值都很好,但是当我使用firefox时,我得到一个空值

我正在使用javascript动态创建textarea,我在其中映射了我的动作类属性“说明”的值。

function showExplain(){

    if(document.getElementById("equivalentExp").checked){
        document.getElementById('explaintxt').style.display = "inline";

        var taspan = document.getElementById("taSpan");

        var ta = document.createElement('textarea');
        ta.setAttribute("name", "explanation");
        ta.setAttribute("id", "explanation");
        ta.setAttribute("cols", "45");
        ta.setAttribute("rows", "5");
        ta.setAttribute("class", "textAreaField");
        ta.innerHTML = '<%if(explanation != null){%><%= explanation %><%}%>';
        taspan.appendChild(ta);
    }else{
        document.getElementById('explaintxt').style.display = "none";
        if(document.getElementById("explanation") != null){
            var taspan = document.getElementById("taSpan");
            taspan.removeChild(document.getElementById("explanation"));
        }
    }
}

我的动作类中有“explain”属性的getter / setter,所以我知道这不是问题所在。我也尝试提醒(“document.getElementById(”说明“)。值);它在IE和firefox中显示我在textarea中的正确值,但当它到达控制器时,它在我的时候为空使用firefox。

我也尝试使用html中声明的常规textarea,它在两种浏览器中都能正常工作。

令人困惑的是,为什么值不会到达我的动作类,在提交表单之前,当我尝试显示它时,我有正确的值。

我被困了,有没有人对此有答案?

谢谢,

0 个答案:

没有答案