jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark R. Diggory" <mdigg...@latte.harvard.edu>
Subject Re: NEW: Form Tag for receiving "multipart/form-data"
Date Mon, 11 Mar 2002 16:05:26 GMT
<fm:formObject file="file1" param="filename">
	<% myobject.needs(file1); %>
</fm:fornObject>


in Custom JSP tags you can define "scripting variables" so that you can 
do things like this.

<fm:formObject file="file1" param="filename">
	<% file1.someMethod(); %>
</fm:fornObject>

Basically, when it comes to variables. You can setup a variable to exist inside
the body of the tag or in the rest of the jsp as well. Its in the spec and there are TagextraInfo
classes to support it. I've never "hand coded" one. I've always used a tag generation tool,
like forte to accomplish all the coding.

Personally, I use Forte to do all my tag development as it does an 
excellent job of auto-generating allot of this stuff with its JSP/Sevlet 
Modules. Any taglib developer should look into using this as a tool. All 
the classes created by it are standalone taglib classes (no special 
libraries to carry around with your tags or anything). There are GUI 
interfaces to generate all different aspects of a taglib, tags, 
attributes and scripting variables in forte. This takes "weeks" off of 
taglib development. Best of all its all free!!!  I currently have 9 or 
10 independent taglibs (some which totally mirror apache taglib's 
functionality) which support our architecture. JAXP (parser and 
transformer), JNDI (with both read and write access), Validation, 
Conditionals, HTTP, Templates to control page layout, Custom Session 
History Managers, Content Managers etc...

What I don't have yet is a multipart-post manager. ;-)

In forte the tld file holds all the configuration information for 
generating the taghandler classes. You can always open it to see how 
they do things, you can always look at the source code to determine 
whats going on in the tags. Everything is in your face.

(Sorry didn't mean to make this sound like an advertisement)
-Mark Diggory
Software Engineer
Harvard MIT Data Center
(Virtual Data Center) an OpenSource project.








Abey Mullassery wrote:

>Hello,
>
>What you suggest is a useful feature but I did not understand the example
>you added.
>I can put the files in various scopes for access. Is that what you
>suggested?
>
>Regards,
>
>
>Abey M. Mullassery
>e: abey@mullassery.com
>w: http://www.Mullassery.com
>====================================
>Live; Don't just exist.
>
>>-----Original Message-----
>>From: Mark R. Diggory [mailto:mdiggory@latte.harvard.edu]
>>Sent: Sunday, March 10, 2002 8:08 PM
>>To: Tag Libraries Developers List
>>Subject: Re: NEW: Form Tag for receiving "multipart/form-data"
>>
>>
>>Just one comment, it might be good to provide a scripting variable
>>inside a tag that will allow the developer to grab a reference to
>>the file.
>>
>><fm:formObject file="file1" param="filename">
>>	<% myobject.needs(file1); %>
>></fm:fornObject>
>>
>>-Mark Diggory
>>
>>Abey Mullassery wrote:
>>
>>>Hello,
>>>
>>>I have developed a Tag to receive multipart form data.
>>>
>>>An example can be found at
>>>
>>>http://www.mullassery.com/formTag.jsp
>>>
>>>There are 3 tags
>>>1. formParse Tag which parses the data and puts the data into a FormData
>>>object.
>>>2. formObject Tag which helps getting data from the FormData as
>>>
>>if from the
>>
>>>request object.
>>>3. fileSave Tag to save a file to the server file system.
>>>
>>>Please take a look and post your comments and suggestions.
>>>
>>>
>>>Abey M. Mullassery
>>>e: abey@mullassery.com
>>>w: http://www.Mullassery.com
>>>====================================
>>>Live; Don't just exist.
>>>
>>>
>>>------------------------------------------------------------------------
>>>
>>>
>>><%@taglib prefix="fm" uri="http://www.apache.org/taglibs/form-1.0" %>
>>>
>>><html>
>>><head><title>Example for using Form Tag</title></head>
>>><body>
>>><h1>Examples using Form Tags</h1>
>>><a href="formTag.txt">Source</a> of this page.
>>><p>
>>><FORM method="POST" action="formTag.jsp" enctype="multipart/form-data">
>>>   Your Name : <INPUT type=TEXT name="name"><br>
>>>   Both files should be less than 100 KB<br>
>>>   Upload File #1 : <INPUT type=FILE name="file1"><br>
>>>   Upload File #2 : <INPUT type=FILE name="file2"><br>
>>>   <INPUT type=SUBMIT name="submit" value="submit">
>>></FORM>
>>><!--
>>><formParse> parses the form and stores it in a FormData object
>>>Its attributes are (none are mandatory)
>>>   name : a name to  store in the scope. formData is default.
>>>   bytes : maximum bytes to parse. 100000 is default
>>>   scope : the scope in ewhich to store (application, request,
>>>
>>page, session). default is request
>>
>>>-->
>>><fm:formParse />
>>><p>
>>><!--
>>><formObject> gets data stored in a FormData object
>>>Its attributes are (only param are mandatory)
>>>   name : a name to store in the scope. formData is default.
>>>   param : parameter name; the name of the form field.
>>>   index : index of the value if there are multiple values for
>>>
>>a param. default is 0
>>
>>>   file : field name of the file input field, if the details
>>>
>>required are specific to a file uploaded.
>>
>>>   scope : the scope from which to get FormData object
>>>
>>(application, request, page, session). default is request
>>
>>>-->
>>>Hello, <fm:formObject param="name" />
>>><hr>
>>><p>
>>><!-- One way of getting file details -->
>>>File #1 : <fm:formObject file="file1" param="filename" /><br>
>>>Content : <br>
>>><pre>
>>><fm:formObject file="file1" param="content" />
>>></pre>
>>><hr>
>>><p>
>>><!-- Another way of getting file details -->
>>>File #2 : <fm:formObject param="file2" /><br>
>>>Content : <br>
>>><pre>
>>><fm:formObject param="file2" index="1"/><br>
>>></pre>
>>><!--Saving file #1... -->
>>><!--
>>><formSave> saves data of an uploaded file into a file.
>>>Its attributes are (only file are mandatory)
>>>   name : a name to store in the scope. formData is default.
>>>   path : relative path from the context root.
>>>   fileName : fileName in which to save the file. default is
>>>
>>the uploaded file name itself.
>>
>>>   file : field name of the file input field/file uploaded.
>>>   scope : the scope from which to get FormData object
>>>
>>(application, request, page, session). default is request
>>
>>>-->
>>><%--<fm:fileSave file="file1" />--%>
>>></body>
>>></html>
>>>
>>>
>>>------------------------------------------------------------------------
>>>
>>>--
>>>To unsubscribe, e-mail:
>>>
><mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
>
>>For additional commands, e-mail:
>>
><mailto:taglibs-dev-help@jakarta.apache.org>
>
>
>
>
>
>--
>To unsubscribe, e-mail:
><mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail:
><mailto:taglibs-dev-help@jakarta.apache.org>
>




--
To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>


Mime
View raw message