blaithe
blaithe
<s:submit << submete o form pela tag do struts, isso acontece pq quando vc usa enctype=“multipart/form-data” o strus intecepta o form.
Exemplo do interceptador que esta sendo chamado quando submete este form:
<!-- INTERCEPTORS -->
<interceptors>
<interceptor name="preExcecuteInterceptor"
class="br.com.....interceptor.PreExecuteInterceptor" />
<interceptor name="exception" class="com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor"/>
<interceptor name="fileUpload" class="org.apache.struts2.interceptor.FileUploadInterceptor"/>
<interceptor-stack name="defaultAuthStack">
<interceptor-ref name="i18n"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="exception"/>
<interceptor-ref name="prepare"/>
<interceptor-ref name="fileUpload" />
<interceptor-ref name="preExcecuteInterceptor" />
<interceptor-ref name="params">
<param name="excludeParams">dojo\..*,^struts\..*</param>
</interceptor-ref>
</interceptor-stack>
</interceptors>
Estendeu??? rs rs
Sem_Nome
blaithe:
<s:submit << submete o form pela tag do struts, isso acontece pq quando vc usa enctype=“multipart/form-data” o strus intecepta o form.
Exemplo do interceptador que esta sendo chamado quando submete este form:
<!-- INTERCEPTORS -->
<interceptors>
<interceptor name="preExcecuteInterceptor"
class="br.com.....interceptor.PreExecuteInterceptor" />
<interceptor name="exception" class="com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor"/>
<interceptor name="fileUpload" class="org.apache.struts2.interceptor.FileUploadInterceptor"/>
<interceptor-stack name="defaultAuthStack">
<interceptor-ref name="i18n"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="exception"/>
<interceptor-ref name="prepare"/>
<interceptor-ref name="fileUpload" />
<interceptor-ref name="preExcecuteInterceptor" />
<interceptor-ref name="params">
<param name="excludeParams">dojo\..*,^struts\..*</param>
</interceptor-ref>
</interceptor-stack>
</interceptors>
Estendeu??? rs rs
Eu não uso Struts. Você conhece alguma outra forma?
blaithe
não está usando nenhum framework?
Sem_Nome
blaithe
manda então por javascript...
<script>
url = "/servlet/Upload?campo1" + window.document.forms[0].campo1.value
window.document.forms[0].action = url
window.document.forms[0].submit();
</script>
blaithe
Exemplo:
<script>
function createURL() {
var _form = document.getElementById("form1");
_form.action += "InsertPortofolio.jsp?ra="+<%=request.getParameter("ra")%>+"&disciplina="+<%=request.getParameter("disciplina")%> + "&descricao=" + _form.descricao.value;
alert(_form.action);
_form.submit();
}
</script>
</head>
<body >
<form id="form1" action="" enctype="multipart/form-data" method="post" >
<div class="form">Descrição</div>
<div class="form1"><input name="descricao" type="text" class="fmcampost" id="descricao" size="40"/></div><br />
<div class="form">Arquivo</div>
<div class="form1"><input type="file" name="Filename" id="confbtproc" class="fmcampost" size="40" /> <input type="submit" name="confupload" onclick="createURL()" id="confupload" value="Upload" class="btcampos" /></div>
</form>
Sem_Nome
blaithe:
Exemplo:
<script>
function createURL() {
var _form = document.getElementById("form1");
_form.action += "InsertPortofolio.jsp?ra="+<%=request.getParameter("ra")%>+"&disciplina="+<%=request.getParameter("disciplina")%> + "&descricao=" + _form.descricao.value;
alert(_form.action);
_form.submit();
}
</script>
</head>
<body >
<form id="form1" action="" enctype="multipart/form-data" method="post" >
<div class="form">Descrição</div>
<div class="form1"><input name="descricao" type="text" class="fmcampost" id="descricao" size="40"/></div><br />
<div class="form">Arquivo</div>
<div class="form1"><input type="file" name="Filename" id="confbtproc" class="fmcampost" size="40" /> <input type="submit" name="confupload" onclick="createURL()" id="confupload" value="Upload" class="btcampos" /></div>
</form>
Aee, isso ai mesmo. Obrigado.
MarcolaLipe10
Sem_Nome …
Aii como ficou o seu controle ???