1 Reply Latest reply on Feb 27, 2009 11:09 AM by (Pierre_Chamoun)

    Help understanding this submit form servlet

    Clookes
      I am trying to convert a Submit form servlet (used in 7.2) to 8.2, but I have no idea what's going on in the following snipplet, can anyone explain it to me and how I should go about converting so that it works on 8.2.<br /><br />            String requestHeader = new String();<br />            String userAgent = new String();<br />            Enumeration hen = request.getHeaderNames();<br />            String ampsep = new String();<br />            while(hen.hasMoreElements()) {<br />                String hn = hen.nextElement().toString();<br />                requestHeader = requestHeader.concat(ampsep).concat(hn.toUpperCase()).concat("=").concat(request.getHeade r(hn));<br />                ampsep = "&";<br />                if(hn.toUpperCase().equals("USER-AGENT")) {<br />                    userAgent = request.getHeader(hn);<br />                }<br />                if(hn.toUpperCase().equals("USER-AGENT")) {<br />                    requestHeader = requestHeader.concat(ampsep).concat("HTTP_USER_AGENT").concat("=").concat(request.getHead er(hn));<br />                }<br />                if(hn.toUpperCase().equals("CONTENT-TYPE")) {<br />                    requestHeader = requestHeader.concat(ampsep).concat("CONTENT_TYPE").concat("=").concat(request.getHeader( hn));<br />                }<br />                if(hn.toUpperCase().equals("CONTENT-LENGTH")) {<br />                    requestHeader = requestHeader.concat(ampsep).concat("CONTENT_LENGTH").concat("=").concat(request.getHeade r(hn));<br />                }<br />            }<br />            <br />            IOutputContext formServerOutput = null;<br />            EJBClient formServerObject = new EJBClient();<br />            <br />            //formServerOutput = formServerObject.processFormSubmission(new com.adobe.idp.Document(request.getInputStream()), requestHeader, userAgent, "OutputType=0");<br />            formServerOutput = formServerObject.processFormSubmission(request, "OutputType=0");<br /><br />            byte[] theData  = formServerOutput.getOutputXML().getBytes();<br />            <br />            formName = formServerOutput.getFormQuery();<br />            String theForm = formServerOutput.getOutputString();<br />            String theParameters = theForm.substring(theForm.lastIndexOf("<pdf href="),theForm.indexOf("http://ns.adobe.com/xdp/pd" ));<br />            appID = theParameters.substring(theParameters.indexOf("appID=")+"appID=".length(),theParameters.i ndexOf("&amp;fileID="));<br />            status = theParameters.substring(theParameters.indexOf("status=")+"status=".length(),theParameters .indexOf("&amp;configFile="));<br />            configFile = theParameters.substring(theParameters.indexOf("configFile=")+"configFile=".length(),thePa rameters.indexOf("xmlns=")-2);<br />            fileID = "initvalue";<br />            try {<br />                fileID = theParameters.substring(theParameters.indexOf("fileID=")+"fileID=".length(),theParameters .indexOf("&amp;status="));<br />            }<br />            catch(Exception e) {<br />                // fileID isn't necessary, but can cause the substring() to exception out.<br />            }
        • 1. Re: Help understanding this submit form servlet
          I think it is better for you to start moving away from code used in LC7.x. The LC7.x API will not exist in LCES9.0. If you look at the following example, you will see that you will not have to do much changes in the code. So do it now better than later.
          Go to: http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/wwhelp/wwhimpl/js/html/ wwhelp.htm
          And search for "Handling a form containing a calculation script using the Java API" or search for "processFormSubmission"