Hashtable for multi part form to insert image and details to database:)

Hey guys do you have any samples on using hashtable in multipart form to insert image as well as details into database?:)
Oh it is because my form is using multipart from that enbales me to upload/Insert image into my database.
Howerver, I also need to insert other details into my database such as productid, ProdName, unitprice.....
Hence, My tutor suggested using hashtable.
However, I do not understnd.
Do you guys have any samples regarding on this?
Thanks
:D

Cathy_Latte wrote:
However, I do not understnd. More specifically: you do not understand how to use Maps? If so, just go through a book/tutorial on that subject. In fact you should have consulted your tutor or classmates for more information and you're here at a JSP/JSTL forum at the wrong place (you have a problem with Java in general, not with JSP), but OK, here's a link: [http://google.com/search?q=hashmap+tutorial+site%3Asun.com].

Similar Messages

  • Creating a cfhttp multi part form post for google docs upload

    Hey all,
    If you saw my last thread, you know I am working with google docs and uploading documents to it. Well I got basic document uploading working, but now I am trying to include meta data. Google requires you to include the metadata with the actual file data and seperate them by using a multi part form upload. I don't know exactly the process for doing so, but they have a handy code snippet of the desired results at
    http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#UploadingDoc s
    So I am basically trying to mimic that payload, however I am continually getting an error stating that there are no parts in a multi part form upload.
    <errors xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>InvalidEntryException</code><internalReason>No parts detected in multipart message</internalReason></error></errors>
    to be exact. I am not really sure what I am doing wrong here. I figure it is one of two things, either I am not including the actual data in the payload properly (I am currently using a body type param for the payload, but I have also tried a formfield named content to deliver it. Neither worked). So maybe I need to do something else tricky there? The other thing which I am not reallly sure about is the content-length attribute. I don't know exactly how to calculate that, and I read in another forum that a content length attribute was messing that guy up. Right now I am just taking the lenght of the payload string and multiplying by 8 (to get the number of bytes for the entire payload) but hell if I know if that is right. It could be I just don't know how to set up the parts for the message, it seems pretty straight forward though. Just define a boundary in the content-type, then put two dashes before it wherever you define a new part, and two dashes trailing the last part.
    Anyway, here is my code, any help is much appreciate. I'm a bit beyond my expertise here (not really used to trying to have to roll my own http requests, nevermind multipart post form data) so I'm kinda flailing around. Thanks again.
    <cffunction name="upload" access="public" returnType="any" hint="I upload the document." output="false">
        <cfargument name="filePath" type="string" required="false" hint="file to upload.">
        <cfargument name="docType" type="string" required="yes" hint="The document type to identify this document see google list api supported documents">
        <cfargument name="parentCollectionId" type="string" required="no" hint="the name of the collection/collection to create (include collection%3A)">
        <cfargument name="metaData" type="struct" required="no" hint="structure containing meta data. Keyname is attribute name, value is the value">
        <cfset var result = structnew()>
        <cfset result.success = true>
        <cftry>
            <cfif structkeyexists(arguments,"parentCollectionId")>
                      <cfset arguments.parentCollectionId = urlencodedformat(parentCollectionId)>             
                      <cfset result.theUrl = "https://docs.google.com/feeds/default/private/full/#arguments.parentCollectionId#/contents">
                <cfelse>
                        <cfset result.theUrl = "https://docs.google.com/feeds/default/private/full/">
            </cfif>
             <cfoutput>
                  <cffile action="read" file="#arguments.filePath#" variable="theFile">
                <cfsavecontent variable="atomXML">
                     Content-Type: application/atom+xml
                    <?xml version='1.0' encoding='UTF-8'?>
                    <entry xmlns="http://www.w3.org/2005/Atom" xmlns:docs="http://schemas.google.com/docs/2007">
                      <category scheme="http://schemas.google.com/g/2005##kind"
                          term="http://schemas.google.com/docs/2007###arguments.docType#"/>
                        <cfloop collection="#arguments.metaData#" item="key">
                            <#key#>#arguments.metadata[key]#</#key#>
                        </cfloop>
                    </entry>
                    --END_OF_PART
                    Content-Type: text/plain
                    #theFile#
                    --END_OF_PART--
                </cfsavecontent>       
            </cfoutput>      
            <cfset result.postData = atomXML>
            <cfhttp url="#result.theUrl#" method="post" result="httpRequest" charset="utf-8" multipart="yes">
                <cfhttpparam type="header" name="Authorization" value="GoogleLogin auth=#getAuth()#">
                <cfhttpparam type="header" name="GData-Version" value="3">
                <cfhttpparam type="header" name="Content-Length" value="#len(trim(atomXML))*8#">           
                <cfhttpparam type="header" name="Content-Type" value="multipart/related; boundary=END_OF_PART">
                <cfhttpparam type="header" name="Slug" value="test file --END_OF_PART">
                <cfhttpparam type="body" name="content" value="#trim(atomXML)#">
            </cfhttp>
            <cftry>
                   <cfset packet = xmlParse(httpRequest.fileContent)>
                <cfif httpRequest.statusCode neq "201 created">
                    <cfthrow message="HTTP Error" detail="#httpRequest.fileContent#" type="HTTP CODE #httpRequest.statusCode#">
                </cfif>
                <cfset result.data.resourceId = packet.entry['gd:resourceId'].xmlText>
                <cfset result.data.feedLink = packet.entry['gd:feedLink'].xmlText>
                <cfset result.data.title = packet.entry.title.xmlText>  
                <cfset result.data.link = packet.entry.title.xmlText>    
                <cfcatch>
                     <cfset result.data = httpRequest>
                </cfcatch>
            </cftry>       
            <cfcatch type="any">
                 <cfset result.error = cfcatch>
                <cfset result.success = false>
            </cfcatch>
        </cftry>   
        <cfreturn result>
    </cffunction>
    Also, this is what my atomXML data ended up looking like when it got sent to google. This isn't the WHOLE request (it doesn't include the headers, just the body).
    Content-Type: application/atom+xml
    <?xml version='1.0' encoding='UTF-8'?>
    <entry xmlns="http://www.w3.org/2005/Atom" xmlns:docs="http://schemas.google.com/docs/2007">
    <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/docs/2007#document"/>
    <TITLE>Woot Test</TITLE> </entry>
    --END_OF_PART
    Content-Type: text/plain
    I'm a test document lol!
    --END_OF_PART--

    Woot, I got it. I had to send the gData version number, and change the URL.
    Here is the working function.
    <cffunction name="upload" access="public" returnType="any" hint="I upload the document." output="false">
        <cfargument name="myFile" type="string" required="false" hint="file to upload.">
        <cfset var result = "">
        <cfset theUrl = "https://docs.google.com/feeds/default/private/full">
        <cffile action="read" file="C:\website\xerointeractive\testing\test.txt" variable="theFile">
        <cfset fileSize = createObject("java","java.io.File").init("C:\website\xerointeractive\testing\test.txt").length()>
        <cfhttp url="#theURL#" method="post" result="result" charset="utf-8" >
            <cfhttpparam type="header" name="Authorization" value="GoogleLogin auth=#getAuth()#">
            <cfhttpparam type="header" name="Content-Type" value="text/plain">
            <cfhttpparam type="header" name="Slug" value="test file">
            <cfhttpparam type="header" name="GData-Version" value="3">
            <cfhttpparam type="header" name="Content-Length" value="#fileSize#">
            <cfhttpparam type="body" value="#theFile#">
        </cfhttp>
        <cfreturn result>
    </cffunction>

  • Multi-part form problem (array & session help needed)

    I have a multi-part form that consists of 3 pages(forms) which each save data to the session. When the final form is complete, I insert the session variables to the DB via a FINISH button.
    I now want to take another step. Page 2 of this multi-part form allows users to add "items". Presently, they can add only 1 item, and move the page 3 by hitting a next button. I would like to add a "Add another item" button that goes to the page 2 form again, allowing more items to be entered. I believe I need an array/table to do this, but don't know how I might do this in the session.
    Is it possible to create an array in the session? If so, how? If not, how might I approach this?
    I am trying to avoid inserting to the database (a remote db) until after a "preview" page following the form.
    Any ideas? Thx in advance.

    Hi,
    This forum thread may help you:
    http://swforum.sun.com/jive/thread.jspa?forumID=123&threadID=50623
    Thanks,
    Creator Team.

  • How to create table and insert images and audio files ...

    hello to all , i am doing my b.e cse .
    at current v r studing DB and pl/sql codes ....
    i just need to know simple way of code to insert images and audio files in a table .
    i tried some of these ,
    CREATE TABLE myTable(Document varbinary(max))
    INSERT INTO myTable(Document)
    SELECT * FROM
    OPENROWSET(BULK N'C:\Image1.jpg', SINGLE_BLOB)
    but not workiing
    it shows some errors.
    i use oracle 10g. thank u :) and also i tried using blob and bfile datatypes , table created but cannot insert values !
    ROBOK

    hello to all , i am doing my b.e cse .
    at current v r studing DB and pl/sql codes ....
    i just need to know simple way of code to insert images and audio files in a table .
    i tried some of these ,
    CREATE TABLE myTable(Document varbinary(max))
    INSERT INTO myTable(Document)
    SELECT * FROM
    OPENROWSET(BULK N'C:\Image1.jpg', SINGLE_BLOB)
    but not workiing
    it shows some errors.
    i use oracle 10g. thank u :) and also i tried using blob and bfile datatypes , table created but cannot insert values !
    ROBOK

  • Insert Master and Detail in the same transaction

    I have 2 view objects : Students and Enrollments.
    Connecting those view objects, there is one view link :
    Cardinality : 1..* (One student can enroll several courses).
    This link is exposed in "Students" view object by the property "getEnrollments" and in "Enrollments" view object, by the property "getStudent".
    I am try to insert records first in Student table, and Enrollment table in the same transaction.
    The primary key for Student table is generatade by a sequence (database trigger)
    My code is :
    StudentListImpl studentView = getStudentList();
    StudentListRowImpl studentRow = (StudentListRowImpl) studentView.createRow();
    studentRow.setFirstname(student.getFirstName());
    studentRow.setLastname(student.getLastName());
    studentRow.setDatebirth(student.getDateBirth());
    studentRow.setStatusid("A");
    studentView.insertRow(studentRow);
    EnrollmentListRowImpl enrollmentRow = (EnrollmentListRowImpl) studentRow.getEnrollments().createRow();
    enrollmentRow.setCourseid("C-100");
    studentRow.getEnrollments().insertRow(enrollmentRow);
    The generated Student ID is not being retrieved by ADF and set up in Enrollment view object. So, database is firing foreign key violation (in Enrollment table - No student ID provided)
    How can achieve this goal? Insert in DETAIL table with the key generated for the PARENT table?

    Yes, ID attribute in Student EO is DBSequence.
    If I insert only Student it works. But when I try to insert an Enrollment for that just created Student (same transaction), the Student ID is not assigned to Enrollment EO.
    The code I use to insert Enrollment is :
    EnrollmentListRowImpl enrollmentRow = (EnrollmentListRowImpl) studentRow.getEnrollments().createRow();
    enrollmentRow.setCourseid("C-100");
    My question is :
    Since I am creating a new Enrollment row using view link acessors in Student VO (getEnrollments), will the Student ID (just generated by sequence) be automatically assigned to Enrollment VO?
    I am totally lost about this (inserting master and detail in same transaction) and I can't find documentation on this topic.

  • Master detail form initial insert issue on details sub-region

    Hello,
    I created a master detail form with report which should do insertion on master and detail region/subregion.
    On insert mode I enter with data master and detail block, when I press "Create" button, insertion happens only on master block (order table) not and on detail block (order_item table).
    On EDIT mode it does insertions/updates on master and detail block without problems.
    Application Express 4.2.1.00.08
    Oracle Database 11g Express Edition Release 11.2.0.2.0
    I appreciate your help.
    Regards

    Something like this should do the work:
    CREATE OR REPLACE TRIGGER order_item_table_tr
       BEFORE INSERT
       ON order_item_table
       FOR EACH ROW
    BEGIN
       IF :NEW.order_id IS NULL
       THEN
          :NEW.order_id := v ('P1_ORDER_ID');
       END IF;
    END order_item_table_tr;
    /Make sure the Automatic Row Processing (DML) of the order table returns key into item > Return Key Into Item > P1_ORDER_ID (or however the primary key of the order table is named)
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • How do i insert image and place it where i want to in the pdf

    hi
    i have converted a word to pdf.Now i have my text on the left and i have a image to be inserted on to the right. when i do insert the image just gets inserted in the center or on the top.

    Bill is correct that you have probably the most control by placing your image on a button.  However if you have Acrobat Professional you can use the Touch-up Object Tool to place a graphic.  Simply choose the Touch-up Object Tool i.e. Tools > Advanced Editing > Touch-up Object Tool and then right-click in the area you want to put your image and choose Place Image from the context menu.  If it is not in the exact place you should be able to move it around with the tool as well.
    Best of Luck!

  • Insert Image and Hyperlink

    After installing Dreamweaver CS3 a few months and having no
    real problems since, suddenly, whenever I click INSERT>IMAGE an
    image placeholder holder appears, rather than the usual dialogue
    window that used to pop up asking me to select my image. And at the
    same time, now when I click INSERT>HYPERLINK a"#" sign appears
    in my document. That's it! It just seemed to start out of the blue.
    Anybody else ever have Dreamweaver get sick like that?

    Jinifer,
    Fix by Hyperlinking with Text rather than the Graphic. If the graphic has a title, you can use that. Or, you can create a Text Box, create the Hyperlink in the text box text, and then set the text color to transparent and place it over the graphic. Then, when you click on the graphic, you will click the hyperlinked text first and your goal is achieved.
    Jerry

  • FORM. INSERT IMAGE(. JPG) IN A SQUARE

    Hello, anyone know how I can do a button to put a picture (.jpg) in that square for her.
    A greeting and thank you all in advance

    Hello, for a person who knows little about the team in overall is a bit complicated (I have no problem, I know how to do it) to insert the image in pdf, so I want to make it Easier on a form, and I Asked why if anyone knows how to do it in javascript.
    Note: Sorry for the translation, but I can not write well in English

  • PDF form to insert images

    Does the only way to have a form field to insert an image is by using LiveCycle Designer or is there a way to do it with some kind of hack using javascript or else? Something that would be possible to use using Adobe free Reader.

    It's possible with Reader 11 using a button, but the image has to be converted to PDF first. There are a number of threads here that talk about it:
    http://forums.adobe.com/thread/1072747
    http://forums.adobe.com/thread/743823

  • Form. Insert Image(. JPG) In a Square-Javascript

    Hello, anyone know how I can do a button to put a picture (.jpg) in that square for her.
    My intention is that it can be opened with adobe reader. No can do with javascript?
    A greeting and thank you all in advance

    If you want to allow a Reader user to add an mage, this is only possible in Reader if the image is first converted to PDF, and only in Reader 11. You'd use the buttonImportIcon field method: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.737.html
    It's not clear from your question whether you just want to add an image to a page or want to allow a user with Reader to add an image. Can you clarify?

  • Insert images and text in header for responsive design cc

    I am having a issue with inserting a logo, company name and Facebook graphic into my header.
    I started setup of a responsive design and added a responsive header along with other areas below.
    I want the Logo to stay on the left, the company name to the right of the logo and the Facebook graphic on the right side of the header.
    I keep making a mess and can't get anything to line up correctly.
    I am using Adobe Dreamweaver CC and trying to control with CSS.
    I am just starting to learn the new CSS Designer in CC. I liked the old CSS console better.

    Basically, you need to float all 3 elements left and give them a width of 33.33% (3-across).
    header #logo,
    header h1,
    header #fb {
         float:left;
         width: 33.33%;
    HTML:
    <div class="gridContainer fluid">
         <header>
              <div id="logo">Your logo here</div>
              <h1>Your Site Name</h1>
              <div id="fb">Facebook here</div>
         </header>
    Nancy O.

  • Inserting Images and Logos - works in the edit mode, but does not save nor show in final PDF format - help?

    I have tried several times - but when I load a logo or image in to a form template - it shows up on the template in edit mode but when I save it for PDF final format and use - the image or logo disappears. What I am doing wrong?

    Is this a form that you're creating in FormsCentral?

  • Insert Image and Load Image by VC# with Oracle 9i Database.

    I need save and load a Image to Database Oracle 9i, i use BLOB Datatype and VC#2003, i write code bellow:
    Load image data.
    m_Img is a parameter byte[], and :
    this.openFile.ShowDialog(this);
    string strFn=this.openFile.FileName;
    this.pcPerson.Image=Image.FromFile(strFn);
    FileStream fls;
    fls=new FileStream(@strFn,FileMode.Open,FileAccess.Read);
    m_Img=new byte[fls.Length];
    fls.Read(m_Img,0,System.Convert.ToInt32(fls.Length));
    fls.Close();
    //Add Parameter
    CnnOracle myBase = new CnnOracle();
    string reqSQL = "SP_PERSON_UPDATE";
    try
    OracleConnection myConn = myBase.OpenConnection(myBase.cnxString);
    OracleCommand myCommand = new OracleCommand(reqSQL,myConn);
    myCommand.Parameters.Add(new System.Data.OracleClient.OracleParameter("Faxno", System.Data.OracleClient.OracleType.NVarChar, 20));
    myCommand.Parameters["Faxno"].Value = myPerson.faxno;
    myCommand.Parameters.Add(new System.Data.OracleClient.OracleParameter("Email", System.Data.OracleClient.OracleType.NVarChar, 20));
    myCommand.Parameters["Email"].Value = myPerson.email;
    myCommand.Parameters.Add(new System.Data.OracleClient.OracleParameter("Photo", System.Data.OracleClient.OracleType.Blob));
    myCommand.Parameters["Photo"].Value = m_Img;
    myCommand.CommandType = CommandType.StoredProcedure;
    myCommand.ExecuteNonQuery();
    myBase.CloseConnection(myConn);
    catch(Exception myErr)
    throw(new Exception(myErr.ToString() + reqSQL));
    That code above don't run and have a error: "ORA-01460: unimplemented or unreasonable conversion requested\n",
    but i clear these row:
    myCommand.Parameters.Add(new System.Data.OracleClient.OracleParameter("Photo", System.Data.OracleClient.OracleType.Blob));
    myCommand.Parameters["Photo"].Value = m_Img;
    and modified StoreProcedure: clear parameter Photo, it run good
    Why? Help me, Please.
    Thank you very much.

    Can you post your table structure?

  • I am looking for a POS software for multi-users with mobility via 3G and Wi-Fi

    Our company distributes food products to grocery, convenient and pharmacy stores, etc. We currently have an old cumbersome hard to use PC system that interfaces with driver's handhelds, keeps records of sales and monitors inventories on trucks and several warehouses. All our company uses MAC systems with the exception of this PC system. The closest I've come to find a MAC software is Lightspeed but it lacks mobility. Does any one know a good reliable POS system with Mobility hopefully to utilize either iPhones with bar code readers?

    Pages can export documents in MS Word format. When I last did this (with Pages '09, the Mac version), the result was a .doc file.
    Note that this is a translation, and like most translations, it's not always a perfect one. Some features of Pages are not supported in MS Word, and some Word features are not supported in Pages.
    For a more precise answer wrt Pages for iOS, you should repost your question in the iWork For iOS community. The link will take you there.
    Regards,
    Barry

Maybe you are looking for

  • Sending report as an attachment to an email

    Hi, I need to send a report as an attachment via email using xml publisher. I created data definition, templates and could run a report. I do not know where to add the coding for sending the email? I found the following coding in developer guide: <?x

  • How to download Camera Raw 8.2 for CS6 only

    I don't want all the other updates, only Camera Raw 8.2. Where can I download the CR 8.2 updater only?

  • Type of transport vehicle in transaction VL02N

    Good night. I need to configure in the system the type of vehicle transport, a field that is present in the transaction VL02N but can not find where I set the SPRO that. To configure the type of vehicle transport, you need to activate something? If s

  • Versions of hierarchys

    hi versions of hierarchys?

  • Flash player not working after upgrade

    I recently upgarded flash player on my mac os 10.6.8. Safari 5.1.10 After the upgrade videos will not play. Is there a way to get older versions of flash player?