struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dakota Jack <dakota.j...@gmail.com>
Subject Re: Here's a question for yous...
Date Tue, 01 Mar 2005 06:51:48 GMT
I do this all the time without using the ActionForm at all,
unfortunately.  I don't know if the solutions I use would be helpful,
but here is one: I call an action setting up a page for uploads.  Then
I upload, setting up a listener/monitor in the the Upload object which
is buried in the commons multipart handling.  Then, on the page where
I did the uploads and to which I return, I provide an automatic popup
that accesses the monitor with a call back via a regular refresh with
a no-cache, etc. and with JavaScript closing the monitor page when
done.  I also have a button on the same page that will provide a
report after the fact of whatever happened and keeps whatever
histories are desired, short and long term.

Everything would be easier if I just overrided the RequestUtils, which
is the only place where the excitement happens in Struts upload.  I
have with limited success tried to discuss making these sorts of
options available without having to work around the Struts framework
without a lot of success, but lately seemingly some success with Niall
and Martin.

There really is nothing to modifying the upload application to allow
other optiosn besides the default upload application.  I have just
wanted to stay with the regular Struts framework so far as is
possible.  No real luck so far.  Lots of grief!  LOL  ///;-)

Here is the JavaScript function:


    <script Language="JavaScript">
      <!--
      function popup(url, name, width, height)
      {
          settings=
            "toolbar=no," +
            "location=yes," +
            "directories=no," +
            "status=no," +
            "menubar=no," +
            "scrollbars=yes,"+
            "resizable=yes," +
            "width="+ width + "," +
            "height=" + height;

          Information=window.open(url,name,settings);
      }
      //-->
    </script>

If this interests you, I would be happy to show you more code.  Heck,
here is some more if you are somewhat interested.

<%@ page language='java' %>
<%@ page errorPage="upload_exception.jsp" %>
<%@ page import='java.util.*' %>
<%@ page import='com.crackwillow.state.StateContainer' %>
<%@ taglib uri='jstl-core'      prefix='c' %>
<%@ taglib uri='struts-bean'    prefix='bean' %>
<%@ taglib uri='struts-html'    prefix='html' %>
<%@ taglib uri='struts-tiles'   prefix='tiles' %>
<%@ taglib uri='crackwillow'    prefix='crackwillow' %>

<html>
  <head>
    <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
  </head>
  <body bgcolor='<c:out value="${state.banMddlBgClr}"/>'>

    <script type='text/javascript'>

      function openMonitor()
      {
        if (document.realForm.uploadedFile1.value.length > 0)
        {
          window.open('monitor.jsp?nocache=<%=
System.currentTimeMillis()
%>','UploadStatus','scrollbars=no,status=no,width=300,height=200');
          document.realForm.submit();
        }
        else if (document.realForm.uploadedFile2.value.length > 0)
        {
          window.open('monitor.jsp?nocache=<%=
System.currentTimeMillis()
%>','UploadStatus','scrollbars=no,status=no,width=300,height=200');
          document.realForm.submit();
        }
        else if (document.realForm.uploadedFile3.value.length > 0)
        {
          window.open('monitor.jsp?nocache=<%=
System.currentTimeMillis()
%>','UploadStatus','scrollbars=no,status=no,width=300,height=200');
          document.realForm.submit();
        }
        else if (document.realForm.uploadedFile4.value.length > 0)
        {
          window.open('monitor.jsp?nocache=<%=
System.currentTimeMillis()
%>','UploadStatus','scrollbars=no,status=no,width=300,height=200');
          document.realForm.submit();
        }
        else if (document.realForm.uploadedFile5.value.length > 0)
        {
          window.open('monitor.jsp?nocache=<%=
System.currentTimeMillis()
%>','UploadStatus','scrollbars=no,status=no,width=300,height=200');
          document.realForm.submit();
        }
        else if (document.realForm.uploadedFile6.value.length > 0)
        {
          window.open('monitor.jsp?nocache=<%=
System.currentTimeMillis()
%>','UploadStatus','scrollbars=no,status=no,width=300,height=200');
          document.realForm.submit();
        }
        else if (document.realForm.uploadedFile7.value.length > 0)
        {
          window.open('monitor.jsp?nocache=<%=
System.currentTimeMillis()
%>','UploadStatus','scrollbars=no,status=no,width=300,height=200');
          document.realForm.submit();
        }
        else if (document.realForm.uploadedFile8.value.length > 0)
        {
          window.open('monitor.jsp?nocache=<%=
System.currentTimeMillis()
%>','UploadStatus','scrollbars=no,status=no,width=300,height=200');
          document.realForm.submit();
        }
        else if (document.realForm.uploadedFile9.value.length > 0)
        {
          window.open('monitor.jsp?nocache=<%=
System.currentTimeMillis()
%>','UploadStatus','scrollbars=no,status=no,width=300,height=200');
          document.realForm.submit();
        }
        else if (document.realForm.uploadedFile10.value.length > 0)
        {
          window.open('monitor.jsp?nocache=<%=
System.currentTimeMillis()
%>','UploadStatus','scrollbars=no,status=no,width=300,height=200');
          document.realForm.submit();
        }
        else if (document.realForm.uploadedFile11.value.length > 0)
        {
          window.open('monitor.jsp?nocache=<%=
System.currentTimeMillis()
%>','UploadStatus','scrollbars=no,status=no,width=300,height=200');
          document.realForm.submit();
        }
        else if (document.realForm.uploadedFile12.value.length > 0)
        {
          window.open('monitor.jsp?nocache=<%=
System.currentTimeMillis()
%>','UploadStatus','scrollbars=no,status=no,width=300,height=200');
          document.realForm.submit();
        }
        else
        {
          alert("Select a file to attach");
        }
      }

      function fillFacadeForm1()
      {
        document.forms['facadeForm'].myFileText1.value=
document.forms['realForm'].uploadedFile1.value;
      }

      function fillFacadeForm2()
      {
        document.forms['facadeForm'].myFileText2.value=
document.forms['realForm'].uploadedFile2.value;
      }

      function fillFacadeForm3()
      {
        document.forms['facadeForm'].myFileText3.value=
document.forms['realForm'].uploadedFile3.value;
      }

      function fillFacadeForm4()
      {
        document.forms['facadeForm'].myFileText4.value=
document.forms['realForm'].uploadedFile4.value;
      }

      function fillFacadeForm5()
      {
        document.forms['facadeForm'].myFileText5.value=
document.forms['realForm'].uploadedFile5.value;
      }

      function fillFacadeForm6()
      {
        document.forms['facadeForm'].myFileText6.value=
document.forms['realForm'].uploadedFile6.value;
      }

      function fillFacadeForm7()
      {
        document.forms['facadeForm'].myFileText7.value=
document.forms['realForm'].uploadedFile7.value;
      }

      function fillFacadeForm8()
      {
        document.forms['facadeForm'].myFileText8.value=
document.forms['realForm'].uploadedFile8.value;
      }

      function fillFacadeForm9()
      {
        document.forms['facadeForm'].myFileText9.value=
document.forms['realForm'].uploadedFile9.value;
      }

      function fillFacadeForm10()
      {
        document.forms['facadeForm'].myFileText10.value=
document.forms['realForm'].uploadedFile10.value;
      }

      function fillFacadeForm11()
      {
        document.forms['facadeForm'].myFileText11.value=
document.forms['realForm'].uploadedFile11.value;
      }

      function fillFacadeForm12()
      {
        document.forms['facadeForm'].myFileText12.value=
document.forms['realForm'].uploadedFile12.value;
      }

      function reset()
      {
        document.forms['realForm'].reset();
        document.forms['facadeForm'].reset();
      }

    </script>

    <style type='text/css'>
      .fileUpload {
      -moz-opacity:0 ;
      filter:alpha(opacity: 0);
      -khtml-opacity: 0;
      }
    </style>

    <span style='position: absolute; top: 30px; left: 200px;z-index: 1;'>
      <form
        name='realForm'
        action='/uploader.CRACKWILLOW'
        method='post'
        target='_top'
        enctype='multipart/form-data'>

        <input
          type='file'
          class='fileUpload'
          name='uploadedFile1'
          onkeyup='fillFacadeForm1();'
          onmouseout='fillFacadeForm1();'>
        <input type='file'
          class='fileUpload'
          name='uploadedFile2'
          onkeyup='fillFacadeForm2();'
          onmouseout='fillFacadeForm2();'>
        <input
          type='file'
          class='fileUpload'
          name='uploadedFile3'
          onkeyup='fillFacadeForm3();'
          onmouseout='fillFacadeForm3();'><br>

        <input
          type='file'
          class='fileUpload'
          name='uploadedFile4'
          onkeyup='fillFacadeForm4();'
          onmouseout='fillFacadeForm4();'>
        <input type='file'
          class='fileUpload'
          name='uploadedFile5'
          onkeyup='fillFacadeForm5();'
          onmouseout='fillFacadeForm5();'>
        <input
          type='file'
          class='fileUpload'
          name='uploadedFile6'
          onkeyup='fillFacadeForm6();'
          onmouseout='fillFacadeForm6();'><br>

        <input
          type='file'
          class='fileUpload'
          name='uploadedFile7'
          onkeyup='fillFacadeForm7();'
          onmouseout='fillFacadeForm7();'>
        <input type='file'
          class='fileUpload'
          name='uploadedFile8'
          onkeyup='fillFacadeForm8();'
          onmouseout='fillFacadeForm8();'>
        <input
          type='file'
          class='fileUpload'
          name='uploadedFile9'
          onkeyup='fillFacadeForm9();'
          onmouseout='fillFacadeForm9();'><br>

        <input
          type='file'
          class='fileUpload'
          name='uploadedFile10'
          onkeyup='fillFacadeForm10();'
          onmouseout='fillFacadeForm10();'>
        <input type='file'
          class='fileUpload'
          name='uploadedFile11'
          onkeyup='fillFacadeForm11();'
          onmouseout='fillFacadeForm11();'>
        <input
          type='file'
          class='fileUpload'
          name='uploadedFile12'
          onkeyup='fillFacadeForm12();'
          onmouseout='fillFacadeForm12();'><br><br>
        <img src='resource.CRACKWILLOW?file=clear.gif' width='50' height='1'>
        <crackwillow:image
          button='Upload.gif'
          plain='false'
          mapBean='state'
          bgClrCode='banMddlBgClr'
          txtClrCode='banLftTxtClr'
          font='Tork Bold'
          italic='false'
          bold='true'
          size='25'
          onclick='openMonitor()'
          property='upload.method'/>

        <html:img src='resource.CRACKWILLOW?file=clear.gif' width='30'
border='0'/>

        <crackwillow:image
          button='Reset.gif'
          plain='false'
          mapBean='state'
          bgClrCode='banMddlBgClr'
          txtClrCode='banLftTxtClr'
          font='Tork Bold'
          italic='false'
          onclick='reset()'
          bold='true'
          size='25'
          property='reset.method'/>

        <html:img src='resource.CRACKWILLOW?file=clear.gif' width='30'
border='0'/>

        <crackwillow:image
          button='Delete_Uploaded_Files.gif'
          plain='false'
          mapBean='state'
          bgClrCode='banMddlBgClr'
          txtClrCode='banLftTxtClr'
          font='Tork Bold'
          italic='false'
          bold='true'
          size='25'
          property='deleteRepository.method'/>
      </form>
    </span>
    <span style='position: absolute; top: 30px; left: 200px; z-index: 0;'>
      <form name='facadeForm'>

        <input
          type='text'
          name='myFileText1'>
        <crackwillow:img
          button='browse.gif'
          plain='false'
          mapBean='state'
          bgClrCode='banMddlBgClr'
          txtClrCode='banLftTxtClr'
          font='Bookman Old Style'
          italic='false'
          bold='true'
          size='15'/>&nbsp;&nbsp;&nbsp;

        <input
          type='text'
          name='myFileText2'>
        <crackwillow:img
          button='browse.gif'
          plain='false'
          mapBean='state'
          bgClrCode='banMddlBgClr'
          txtClrCode='banLftTxtClr'
          font='Bookman Old Style'
          italic='false'
          bold='true'
          size='15'/>&nbsp;&nbsp;&nbsp;

        <input
          type='text'
          name='myFileText3'>
        <crackwillow:img
          button='browse.gif'
          plain='false'
          mapBean='state'
          bgClrCode='banMddlBgClr'
          txtClrCode='banLftTxtClr'
          font='Bookman Old Style'
          italic='false'
          bold='true'
          size='15'/><br>

        <input
          type='text'
          name='myFileText4'>
        <crackwillow:img
          button='browse.gif'
          plain='false'
          mapBean='state'
          bgClrCode='banMddlBgClr'
          txtClrCode='banLftTxtClr'
          font='Bookman Old Style'
          italic='false'
          bold='true'
          size='15'/>&nbsp;&nbsp;&nbsp;

        <input
          type='text'
          name='myFileText5'>
        <crackwillow:img
          button='browse.gif'
          plain='false'
          mapBean='state'
          bgClrCode='banMddlBgClr'
          txtClrCode='banLftTxtClr'
          font='Bookman Old Style'
          italic='false'
          bold='true'
          size='15'/>&nbsp;&nbsp;&nbsp;

        <input
          type='text'
          name='myFileText6'>
        <crackwillow:img
          button='browse.gif'
          plain='false'
          mapBean='state'
          bgClrCode='banMddlBgClr'
          txtClrCode='banLftTxtClr'
          font='Bookman Old Style'
          italic='false'
          bold='true'
          size='15'/><br>

        <input
          type='text'
          name='myFileText7'>
        <crackwillow:img
          button='browse.gif'
          plain='false'
          mapBean='state'
          bgClrCode='banMddlBgClr'
          txtClrCode='banLftTxtClr'
          font='Bookman Old Style'
          italic='false'
          bold='true'
          size='15'/>&nbsp;&nbsp;&nbsp;

        <input
          type='text'
          name='myFileText8'>
        <crackwillow:img
          button='browse.gif'
          plain='false'
          mapBean='state'
          bgClrCode='banMddlBgClr'
          txtClrCode='banLftTxtClr'
          font='Bookman Old Style'
          italic='false'
          bold='true'
          size='15'/>&nbsp;&nbsp;&nbsp;

        <input
          type='text'
          name='myFileText9'>
        <crackwillow:img
          button='browse.gif'
          plain='false'
          mapBean='state'
          bgClrCode='banMddlBgClr'
          txtClrCode='banLftTxtClr'
          font='Bookman Old Style'
          italic='false'
          bold='true'
          size='15'/><br>

        <input
          type='text'
          name='myFileText10'>
        <crackwillow:img
          button='browse.gif'
          plain='false'
          mapBean='state'
          bgClrCode='banMddlBgClr'
          txtClrCode='banLftTxtClr'
          font='Bookman Old Style'
          italic='false'
          bold='true'
          size='15'/>&nbsp;&nbsp;&nbsp;

        <input
          type='text'
          name='myFileText11'>
        <crackwillow:img
          button='browse.gif'
          plain='false'
          mapBean='state'
          bgClrCode='banMddlBgClr'
          txtClrCode='banLftTxtClr'
          font='Bookman Old Style'
          italic='false'
          bold='true'
          size='15'/>&nbsp;&nbsp;&nbsp;

        <input
          type='text'
          name='myFileText12'>
        <crackwillow:img
          button='browse.gif'
          plain='false'
          mapBean='state'
          bgClrCode='banMddlBgClr'
          txtClrCode='banLftTxtClr'
          font='Bookman Old Style'
          italic='false'
          bold='true'
          size='15'/><br><br><br>
      </form>
    </span>
  </body>
</html>


Jack


On Mon, 28 Feb 2005 23:40:39 -0500, Frank W. Zammetti
<fzlists@omnytex.com> wrote:
> It is of course possible to turn of form validation on a per-mapping
> basis... Is it possible to turn off auto-population?
> 
> It's never come up for me before a few minutes ago... I'm doing a file
> upload project, and when I upload the files I'd like an ActionForm to be
> created but NOT populated with anything... I want to use it simply to
> return some status information back to the view.  I can think of about 5
> other ways to accomplish this, but simply turning off auto-population
> would be the easiest.
> 
> I don't see a way to do it... am I missing something?  Thanks!
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message