View Full Version : Problema with jsp

27 Dec 2010, 11:00 AM
Hi guys, I have a problem with upload.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<!-- Inicio CSS -->
<link rel="stylesheet" type="text/css" href="js/ext-3.1/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="js/ext-3.1/examples/shared/examples.css" />
<link rel="stylesheet" type="text/css" href="js/ext-3.1/examples/ux/fileuploadfield/css/fileuploadfield.css" />

<!-- Início da biblioteca EXTjs -->
<script type="text/javascript" src="js/ext-3.1/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="js/ext-3.1/ext-all.js"></script>
<script type="text/javascript" src="js/ext-3.1/examples/ux/fileuploadfield/FileUploadField.js"></script>

<!-- file upload form -->
<script src="js/uploadDeArquivos/formPanelPopupArquivo.js"></script>

<div id="formUpload"></div>


Ext.onReady(function() {
var btnCancelar = new Ext.Button( {
text : 'Cancelar'

var btnSalvar = new Ext.Button( {
text : 'Salvar'

// Fields
var fieldCodigo = new Ext.form.TextField( {
fieldLabel : 'Codigo',
disabled : true,
name : 'codigo',
anchor : '100%'

var fieldArquivo = new Ext.ux.form.FileUploadField({
fieldLabel : 'Arquivo',
name : 'arquivo_upload',
id: 'form-file',
anchor : '100%'

var fieldComplemento = new Ext.form.TextField( {
fieldLabel : 'Complemento',
name : 'complemento',
allowBlank : true,
anchor : '100%'

// form

var form = new Ext.form.FormPanel( {
id : 'formArquivo',
renderTo : 'formUpload',
fileUpload : true,
monitorValid : true,
items : [ fieldCodigo, fieldArquivo, fieldComplemento],
//items : [ fieldCodigo, fieldComplemento],
buttons : [ btnCancelar, btnSalvar ]


If I try to acess it direct, it is work.
But when I call it from jsp with a include, it isn't work.

Appears this error: Uncaught TypeError: Cannot read property 'FileUploadField' of undefined
Could someone help me?

27 Dec 2010, 11:05 AM
And you don't get a 401 error on your FileUploadField.js (check Firebug Net tab)?

27 Dec 2010, 11:13 AM
No Condor, it isn't appears a 401 error in the firebug.
In the Google Chrome appears the error that I spoke above.
And in the Mozila appears Ext.ux.form is undefined
var fieldArquivo = new Ext.ux.form.FileUploadField({

When I access it direct, it is work.
But when I access it from my application, it is work.
It doens't see more the script:

<script type="text/javascript" src="js/ext-3.1/examples/ux/fileuploadfield/FileUploadField.js"></script>

I don't understand.

28 Dec 2010, 12:06 AM
The error is clear enough: "Ext.ux.form is not defined".

This clearly means that FileUploadField.js is not loaded. Are you sure the path is correct and this file is present on your server?

28 Dec 2010, 5:42 AM
Yes Condor, Iam sure the path is correct and this file is present on my server.
The problem is that in the jsp Iam using the TLD's tag to facilitate me.

<ext:window id="popupProdutoArquivos" layout="form" closable="false" resizable="true"
draggable="true" modal="true" shadow="true" width="400" autoHeight="true">
<s:include value="popupWindow_produtoArquivo.jsp" />

The TLD's tag encapsulates the EXTjs' library.
But the ux library is different, because is the special library and it isn't normal from EXTjs.
The TLD isn't recognizing this library =(
Condor, do you know how I could resolve this problem?

28 Dec 2010, 6:27 AM
I don't know how ExtTLD works exactly, so I can't answer that.

28 Dec 2010, 10:57 AM
It was work.
I just add this script:

<script type="text/javascript" src="js/ext-3.1/plugins/FileUploadField.js"></script>

Thank's Condor