Ext form 업로드 호환 브라우저

2639 단어 form
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=gbk">
        <title>form</title>
        <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
        <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
        <script type="text/javascript" src="../../ext-all.js"></script>
        <script type="text/javascript">
Ext.onReady(function(){

    var form = new Ext.form.FormPanel({
        labelAlign: 'right',
        title: 'form',
        labelWidth: 50,
        frame:true,
        fileUpload: true,
        url: 'form2.jsp',
        width: 280,

        items: [{
            xtype: 'textfield',
            fieldLabel: ' ',
            name: 'file',
            inputType: 'file'
        }],
        buttons: [{
            text: ' ',
            handler: function() {
                form.getForm().submit({
                    success: function(form, action){
                        Ext.Msg.alert(' ', action.result.msg);
                    },
                    failure: function(){
                        Ext.Msg.alert(' ', ' ');
                    }
                });
            }
        }]
    });
    form.render("form");

});
        </script>
    </head>
    <body>
        <script type="text/javascript" src="../examples.js"></script>
        <div id="form" style="margin:100px;"></div>
    </body>
</html>

 
 
대응하는form2.jsp를 위해response를 설정했습니다.setContentType("text/html;charset=UTF-8");화호와 iE를 겸용합니다.
<%@ page contentType="text/html;charset=utf-8"%>
<%
    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");

    String text = request.getParameter("text");
    System.out.println(text);
    response.setContentType("text/html;charset=UTF-8");
    response.getWriter().print("{success:true,msg:' '}");
%>

좋은 웹페이지 즐겨찾기