Submit a form using class

Hello Guys,
I have a project where I need to pass a form using my class to online APIs.
I read about JAXB and XML Schema, they can do that (I guess). But I don't know where to start.
Thanks,
Dreamcaster

Yup, the request is made via HTTP POST and the response like that but in XML format. I found an example on the documentation.
<form method="post" action="https://api.payment.com/deposit">
     Username: <input type=text value="userone"/>
     Password: <input type=text value="P@ssw0rd"/>
     Amount: <input type="text" value="50"/>
     <input type="submit" value="deposit" />
</form>This will return a XML response. What I need to do is not that kind of form from my JSP, instead a class that will pass the same parameters to the URL and then the resulting XML will be parsed.

Similar Messages

  • How is submit a form using ahref  in a JSP

    I have a form inside a iframe. It has 2 buttons. On clicking one button resultant page should open in the parent window(i.e target = parent). On clicking another button resultant page should open in same window (i.e target = self).
    In bith case i need to submit the details in that form. I need to do this when java script is disabled. When java script is enabled changing of target window is possible.

    I have written a few applications that required this kind of function, and what I ended up with was an applet.
    First, I submit to the usual ACTION-URL and after processing the data, my code would determine whether the response should capture the full screen, or appear just withing the frame.
    For redirects that capture the full browser window, I would call a page (still within the frame) that would run a Java applet whose only funtion is to send the browser to the new URL, which would be sent to the applet as a param. The applet just needs to know how to send the user to the new URL.
    package com.redeye.core.utils;
    import java.applet.Applet;
    import java.net.MalformedURLException;
    import java.net.URL;
    * Redirect the user agent to a new URL.
    * Usage:
    * <xmp>
    * <applet
    *   code="package.to.Deflector"
    *   codebase="path/to/applet/codebase"
    *   name="Deflector"
    *   height="1" width="1"
    *   mayscript>
    *     <param
    *       name="targeturl"
    *       value="http://target.url.here/">
    *     <param
    *       name="targetframe"
    *       value="_self|_top|ANYTHING_ELSE">
    * </applet>
    * </xmp>
    * Parameters:
    * <b>targeturl:</b> The target to which the user agent is redirected
    * <b>targetframe:</b> name of the frame/window to be redirected
    * @author http://redeye.no
    public class Deflector extends Applet
         private static final long serialVersionUID = -878236489812416561L;
          * Constructs a new Deflector applet
         public Deflector()
              // Default contructor
          * Initializes the Deflector applet
         public void init()
              super.init();
              try
                   String url = getParameter("targeturl");
                   String target = (getParameter("targetframe") != null) ? getParameter("targetframe") : "_top";
                   if (null != url)
                        getAppletContext().showDocument(new URL(url), target);
              catch (MalformedURLException mue)
                   System.out.println("Error in target URL: " + mue.getMessage());
    }

  • Submit Interactive Form using button on Wed Dynpro page instead of in PDF

    Say I've a Web Dynpro page with an interactive form embedded. Is it possible to have on the page an HTMLB button, when clicked, submit the interactive form to an iView on EP? I haven't found any tutorials showing something like this. Please advice.  Basically I need to make this adobe form/web dynpro app interact with the portal (passing the completed form to the portal)? any help will be greatly appreciated. thanks again.

    Hi Mick,
    I don't get your exact requirements.
    What i get is, you want submit to SAP button outside the adobe forms and on the webdynpro page.
    Yes, you can do this thing. Whenever webdynpro page has any events at that time whatever the values on the adobe form are reflected into the node which you have bound with the Interactiveform UI element.
    So, you can place your button outside adobe form also.
    Now, for "submit the interactive for to an iView or EP" I can't get exactly what you want. But i can say that you can manipulate your adobe form in code using pdfObject.
    Check the SAP tutorial for manipulating pdfObject.
    Regards,
    Bhavik

  • [SOLVED] Using wget to submit a form

    Edit: Figured out I was using the wrong URL and needed some necessary POST/GET data I wasn't filling out.
    Hm, I am trying to be able to submit a form using wget. I am able to actually put data in <textarea> like I want, but I fail to submit it through wget.
    I was able to login to the site by cheating a little bit. I came up with two methods to do it, the first one is easy which is just going to ~/.mozilla/firefox/<xxxx>/cookies.sqlite, and converting it to a *.txt. Easy. Or you can do it the slightly more complicated way by going to page you want, typing the url bar javascript:document.write(document.cookie); document.close(); and manually create the cookies.txt file using the information from that. Anyhow, that is how I am able to go into the site without having to submit my username/password in the first place (I kept failing to do that, it didn't even return the page with my username and password typed in like what's going on below). Anyhow, now I am stumped at actually submitting the post I want to. I execute:
    wget --cookies=on --keep-session-cookies --load-cookies=cookie.txt --post-data="Post=test" http://www.url-to-the-site.com/
    and the end result is:
    ^This is what wget returns and what it looks like when I open it in Firefox.^
    Which is what it returns. I checked the website and it didn't post it (I expected that since it returns that and not the post itself). I know you can't see it in the image there, but there is a submit button at the bottom of the page.
    The form looks something like this (stripped down):
    <form action='<url of website>' method='post' name='REPLIER' onsubmit='return ValidateForm()'>
    <input type='hidden' name='act' value='Post' />
    <input type='hidden' name='s' value='xxxxxx' />
    <input type='hidden' name='f' value='24' />
    <input type='hidden' name='auth_key' value='xxxxxx' />
    <input type='hidden' name='CODE' value='09' />
    <input type='hidden' name='t' value='41457' />
    <input type='hidden' name='p' value='514135' />
    <input type='hidden' name='st' value='0' /><br />
    <input type="submit" name="submit" value="Add Reply" tabindex='4' class='forminput' accesskey='s' />
    <input type="submit" name="preview" value="Preview Post" tabindex='5' class='forminput' />
    </form>
    Any idea?
    **Meh, in my experience of posting here, helpers/answers/whatever usually like an answer of why I have to do this the difficult way instead of just going there and posting myself in the first place (after all, it might help you answer the question). Well, we are playing a little game in there and I wrote a little script that keeps track of the points in the game... It makes a nice little pretty table that I use cron to update every hour, but then people have to wait until I actually post the table to see how they are doing in the game. So... I'd like to have it automatically post each update.
    Then I have a second use: If I am able to successfully post this, I am trying to get into a class at college. I already wrote a script that detects whether there is available space or not in the class. I'd like to be able to have it monitoring for an open spot in the class and if so... to check it [x] and submit so I can get in the class without having to sit at the computer refreshing all day hopelessly.
    And plus I learned programming, how to use so much utilities to do whatever... why stop now?
    In advance, thank you for taking the time to help me with this.
    Last edited by Aprz (2009-12-05 11:25:51)

    have you considered using curl? Submitting forms in curl is very easy. and saving cookies is easy as well.
    for example:
    curl -s -D lccookie -d "login=$login&password=$password" http://somepage.com/index.php?
    to log in (which also is submitting a form), and
    curl -s -b lccookie -e http://somepage.com/index.php --data-urlencode "EntryEffect%3A=$entryeffect" --data-urlencode "ClosingEffect%3A=$closingeffect" --data-urlencode "Color%3A=$colour" --data-urlencode "messagefield=$OPTARG" -d "Submit=Submit" http://somepage.com/index.php?
    to reuse the cookie and submit a form. (This is from a script I wrote that sends formated messages to a page which shows them on a ledbar.)
    Last edited by Shapeshifter (2009-12-03 14:09:36)

  • Using Enter key to submit a form, Attn: Didier

    Hi,
    I have an ADF form on my page and want to use Enter key to submit the form. I submit the form using a CommandLink which has a method bound to it as its action in a managed bean. I have set submitCL as the Id of this CommandLink and has set this in my form:
    <af:form defaultCommand="submitCL">
    but the Enter does not work. I'm using IE 7.0 and JDeveloper 10.1.3.2.
    Thanks in advance,
    S/\EE|)

    Hi Saeed,
    not sure if this is related or not, but I would test it with another browser as IE is not supported. See http://www.oracle.com/technology/products/jdev/htdocs/10.1.3.3/install.html#browsers
    Also, when the command button is in the header facet of a table or treeTable, the value of defaultCommand must also contain the table or treeTable ID.
    For example: <af:form defaultCommand="theTreeTableId:submitCL" ...>Regards,
    Didier.

  • Can I submit form using app.launchURL

    I want to submit a pdf form without replacing my page. I need it open in new tab.
    The script below is work, but it replaces my old page
    this.submitForm({
    cURL:
    "http://localhost:8080/project/TestServlet",
    cSubmitAs:
    "PDF",
    cCharset:
    "utf-8"
    This script is open a new tab but I have no idea how can I submit a form using this
    app.launchURL("http://localhost:8080/project/TestServlet", true);
    Can anyone guide me how to submit form with open new tab on the web browser?
    Thanks.

    No, you can't submit the form like that. You could submit some form data as
    a URL parameter, though.

  • Submittin form using javascript

    Hi friends
    I have used the following javascript method to submit a form using an href from my
    JSP
    <a href="# onClick="return submitMe(document.item,<%=activeWhse.getBowhse()%">)"
    Javascript function is like this
    function submitMe(myform,whse){
              myform.powhse.value=whse;
              myform.submit();
              return true;
    It does not work on IE 5 but works on IE 5.5 .
    Is there any thing wrong on how I am doing it ?
    Please advise
    Thanks in advance
    </a>

    Try using
    submitMe(document.item,<%=activeWhse.getBowhse()%)
    Thanx and Regards
    Aruneesh

  • Strange behaviour on Safari when trying to submit form using iframe

    Hi All,
    Not sure if this is the correct forum to raise this question
    I am using iframe based mechanism to submit my login from and it is working fine on each and every browser except Safari.Here is the HTML form I am using to submit the information
    <iframe height="0" width="0"  name="loginFrame" hidden="true"> </iframe>
    <form:form action="${loginActionUrl}" method="post" commandName="loginForm" id="header-signin" target="loginFrame" name="header-signin">
      <input type="text"   name="j_username" id="header-signin_j_username">
      <input type="password" name="j_password" id="header-signin_j_password">
      <input type="button" class="btn1" value="Sign In" id="login" formnovalidate="formnovalidate"/>
    </form:form>
    and here is the java-script code
    $(document).ready(function(){
    $("#login").live('click',function(e) {
          if(validateSigninForm('header-signin')){
              $("#header-signin").submit();
    there are some additional JS code which is being used
    if($('#header-signin_j_password').length){
        document.getElementById('header-signin_j_password').onkeydown = function(event) {
            if (event.keyCode == 13) {
             triggerSigin(this.form.id);
    triggerSignin is simple using Jquery submit method to submit the form.
    When I fill the password filed and press the enter button, everything is working fine and page is getting refreshed with the help of the iFrame, but if I click on the sing in button, Safari is opening a new browser window and sending null values to the back end server.
    This behavior is only noticeable for the first time and if I click on the signin button second time, It will be working perfectly fine till I close the browser and open it again.
    I am not sure what is going wrong here and this approach is working fine on all other browsers.
    Can any one help me in this?

    Okay I tried something new.  I changed the email address listed under my account in the Server app, and then went back to add the short name again.  This time it allowed the save.  Then I went back to Server and changed the listed address back to what I entered as the short name, and it let me do that, too. I guess the order you do this in matters.  Odd.

  • How can recipients submit completed PDF forms using a MAC?

    We have created fillable PDF forms using LiveCycle Designer 8.0.  They include
    submit buttons that are set to submit the completed forms as PDFs.  Rights have been extended for Adobe Reader users.  They work great when the recipient is using a PC, but when they are using a MAC we have a number of problems:
    1) the Print and Submit buttons do not work
    2) when the recipient saves and e-mails the file manually, the data they entered is only visible when you click on that field
    Help!  How can our MAC recipients submit their completed form as a PDF that displays all of the data!
    Thanks!

    Thanks Niall.  This information proved really helpful in confirming the problem.  We ran some tests and the problem does seem to only occur when MAC recipients are using Preview.
    We recieved this link from Adobe, which provides a solution if you have access to all the recipients:
    http://blogs.adobe.com/pdfdevjunkie/script_to_fix_mac_osx_previewa.html
    Thanks to Niall and Paul for all your help!

  • Manually submit a form without using javascript?

    i'm trying to automate registration of a site by using java (no gui). However there is no direct submit button or form.submit() present in its registration url. Checked the javascript codes and it opens a window, and checks if the window opener is present .
    if (window.opener && !window.opener.closed)
    window.opener.document.theForm.submit();
    window.close();               
    }Is there a solution for this problem?

    I'm trying to access an http url (not mine).
    (1) By setting post variables , I can retrieve the html of the url as string. Here's the code.
         static String getHtml(String url_nm, HashMap variables)
              String html = "";
              String data = "";
              boolean firstRun = true;
              if (variables != null)
                   Set keys = variables.keySet();
                   Iterator iterator = keys.iterator();
                   while (iterator.hasNext())
                        if (firstRun)
                             firstRun = false;
                        else
                             data += "&";
                        String name = iterator.next().toString();
                        try
                             data += URLEncoder.encode(name, "UTF-8") + "=" +
                                  URLEncoder.encode(variables.get(name).toString(), "UTF-8");
                        catch (Exception e1)
              try {
                 URL url = new URL(url_nm);
                 URLConnection conn = url.openConnection();
                 conn.setDoOutput(true);
                 OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
                 wr.write(data);
                 wr.flush();
                 BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                 String line;
                 while ((line = rd.readLine()) != null) {
                      html += line;
                 wr.close();
                 rd.close();
             } catch (Exception e) {
                  e.printStackTrace();
              return html;
    [/code
    (2) The problem is even if i set the post variables, i cannot submit the form since the form can only be submitted if i was actually browsing it in a web browser. The html displays a window where the actual submit  form is set (as you can see in my later post) .                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Problem using javascript to submit jsf form, values not submitted

    Greetings!
    I have a t:selectOneMenu where I want the page to be submitted when they change the selected value. At this point, I am able to get the form to submit and reload the page, which is all fine. The problem is that none of the values from the page are not set in the backing bean. I have break points on the setter methods that are not being hit.
    I have tried a number of things from searching multiple forums, but here are snippets from my latest version...
    <h:form>
    <t:commandLink id="hiddenLink" forceId="true" value="test link"
    action="#{pc_PageX.doBtnHiddenLinkAction}"></t:commandLink>
    <t:selectOneMenu id="pageList_top" forceId="true" value="#{pc_PageX.ValueX}"
         onchange="jspellSync(); submitPageX();">
         <f:selectItems value="#{pc_PageX.ListX}" />
    </t:selectOneMenu>
    </h:form>
    function submitPageX(){
         var hiddenLink = document.getElementById("hiddenLink");
         hiddenLink.click();
    }Note that the <t:commandLink> is not hidden, though it will be in the final version if I can get this to work.
    If I click the commandLink myself, the page is submitted with all the page values as expected. If I change the list value, thus using javascript to fire the commandLink's click event, the page is submitted with NO values.
    Can anyone come up with an explanation for this behavior? Or better yet, a solution?
    A couple other things I've tried...
    - Not using a commandLink and using jsf's submit function -> onchange="jspellSync(); submit();"
    - Clicking the link using other ways -> hiddenLink.fireEvent('onclick');
    If all else fails, I'll just add a button that they have to click to submit the form.

    snotmare wrote:
    BalusC wrote:
    I recall this problem in one of the ancient JSF versions. Which JSF version do you use? Do you have any room to upgrade to latest? We're using an IBM implementation of JSF, which is at version 7.0. The IBM implementation appears to be built on the JSF base 1.1.That's not an IBM JSF implementation, they do not have any one, they just have some component libraries which runs on top of some JSF implementation. RAD/WSAD ships by default with Sun JSF RI. Try upgrading to at least 1.1_02 which you can download from the aforementioned link. There's a gap of 2 years (and inherently a lot of bugfixes) compared to 1.1. If the application server used supports Servlet 2.5, you could even upgrade to the latest 1.2.
    We've had other issues with the IBM implementation, which could be the cause in this case too. We've been talking about switching to MyFaces, but there is one feature of the IBM version that we like. It's basically a script collector (hx:scriptCollector) that allows us to do pre-processing on the page.As said before, IBM does not have a JSF implementation. So replacing RI by MyFaces wouldn't make any difference.

  • Using CFHTTP to submit a form directly to a google docs form

    Ok so here is some background
    Google has a service where you can create forms using google docs and embed them into your webpage, Results are automatically stored in a google spreadsheet upon submission.
    I want to use my own form to submit to to the google form processing page which I can get to work however the default generic google hosted thank you page appears upon submissing.
    I know you can use cfhttp to submit a form from a coldfusion server so I was thinking that I could simply pass my form variables to a action page that resubmitted them via cfhttp and thus bypass the thank you page altogether
    however when I try this it does not work and the results do not show up in the google spreadsheet. I figured that mabye the google processing page could tell that it was not submitted from a browser so I tired adding a useragent string but still no luck.
    Here is the code I was trying to use
    <cfhttp method="POST" url="https://spreadsheets.google.com/formResponse?key=tlo4FjygqMuUGmvuOb2_Gjw" redirect="yes" useragent="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)">
         <cfhttpparam type="Formfield" name="entry.0.single" value="testValue1" >
         <cfhttpparam type="Formfield" name="entry.1.single" value="testValue2" >
    </cfhttp>
    And the online spread sheet can be viewed here
    http://spreadsheets.google.com/pub?key=tlo4FjygqMuUGmvuOb2_Gjw&single=true&gid=0 &output=html
    Does anyone know why this is not working?
    To recap I am able to use the following form on my own comptuer to directly submit to the processing page and this works
    <form action="https://spreadsheets.google.com/formResponse?key=tlo4FjygqMuUGmvuOb2_Gjw" method="POST">
    <input type="text" name="entry.0.single" value="" >
    <input type="text" name="entry.1.single" value="">
    <input type="submit" name="submit" value="Submit">
    </form>
    Any help would be greatly appreciated

    YES!!!!!!!!!!!!!!!!!!!!!! This did it final code is as follows thanks for you help
    <cfhttp method="POST" url="https://spreadsheets.google.com/formResponse?key=tlo4FjygqMuUGmvuOb2_Gjw" useragent="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)">
         <cfhttpparam type="Formfield" name="entry.0.single" value="final test">
         <cfhttpparam type="Formfield" name="entry.1.single" value="final test">
          <cfhttpparam type="Formfield" name="submit" value="Submit">
    </cfhttp>
    Man this is great! and has eliminated half my database requirements! now only if you could pull the results back out!

  • Using JavaScript to submit a form with multiple submit buttons

    I am a newbie to JavaScript, so hopefully someone can answer
    this for me.
    On my user registration form, I have two buttons that submit
    the form, 'check_availability' (to check if the username is
    available) and 'register'. In my PHP script, I check which button
    was pushed by checking which POST value is set,
    $_POST['check_availability'] or $_POST['register'].
    If I set the 'register' button to a JavaScript function that
    validates the form and then submits it, how do I get my PHP script
    to think 'register' was pushed?

    Sorry I used my old captcha script there.
    [php]
    <?
    session_start();
    if(isset($_POST['button_name'])){
    //DO SOMETHING HERE
    } else {
    //Add the page data
    ?>
    [/php]
    "east99" <[email protected]> wrote in
    message
    news:fepqr8$2mr$[email protected]..
    > Firstly name your buttons then use this script:
    >
    > [php]
    > <?
    > session_start();
    > if(isset($_POST['button_name'])){
    > if ($_POST['vercode'] != $_SESSION['vercode'] OR
    $_SESSION['vercode']=='')
    > {
    > // echo '<strong>Error
    Message</strong><br>';
    > $error = '<strong><font
    color="#FF0000">Error
    > Message</font></strong><br>';
    > } else {
    >
    > //Add the page data
    >
    > }
    > ?>
    > [/php]
    >
    >
    >
    > "AngryCloud" <[email protected]> wrote
    in message
    > news:fecu6r$cl5$[email protected]..
    >>I am a newbie to JavaScript, so hopefully someone can
    answer this for me.
    >>
    >> On my user registration form, I have two buttons
    that submit the form,
    >> 'check_availability' (to check if the username is
    available) and
    >> 'register'. In
    >> my PHP script, I check which button was pushed by
    checking which POST
    >> value is
    >> set, $_POST['check_availability'] or
    $_POST['register'].
    >>
    >> If I set the 'register' button to a JavaScript
    function that validates
    >> the
    >> form and then submits it, how do I get my PHP script
    to think 'register'
    >> was
    >> pushed?
    >>
    >
    >

  • How to submit a form in jsp from tag handler class

    I have a form in jsp.I created some more links in the tag handler class.Based on the link we click form action will take place.Now how can i submit the form in tag handler class for the links i created in that class.

    I have a form in jsp.I created some more links in the tag handler class.Based on the link we click form action will take place.Now how can i submit the form in tag handler class for the links i created in that class.

  • Emailing a completed active PDF form using a Submit buttom? (Acrobat XI Pro.)

    I have created a very large active PDF form with hundreds of fields, with text boxes, drop downs, radio buttons, check boxes and I think the kitchen sink. But for the life of me I cannot figure out how to create a Submit button that will send the completed form to an email address that is set to print anything that hits it.
    I have read so much on it that I'm thoroughly confused. Do I need a script, is there a method through Acrobat menus I'm missing, or am I barking at the moon? Any help just getting me going in the right direction would be appreciated more than I could even say. Thanks!

    Simply add a button and set it's Mouse Up action to "Submit a Form" and use a mailto type URL and specify that the complete PDF is sent. If it needs to work with Reader prior to version 11, it will additionally need to be Reader-enabled: File > Save As Other > Reader Extended PDF > Enable More Tools
    Note that emailing is unreliable compared to submitting to a web server, and it's difficult to make secure, which is relatively easy with a web server.

Maybe you are looking for

  • Infopath not working After migrating site to HTTPS

    I have infopath installed as client and I publishes it on the server. I dont have infopath on the server and I cannot install there. Developed infopath form with a dataconnection via webservice "GetUserProfileByName". It was working fine with HTTP Af

  • Inserting a hyperlink displays HTM extension

    I just noticed that when inserting a hyperlink: If the Topic List pod is set to View by File Name, the hyperlink displays the filename (with the HTM extension). If the Topic List pod is set to View by Topic Title, the hyperlink displays the topic tit

  • Junk e-mail help

    I have three e-mail accounts sent to my phone from GMail. One of them keeps letting all the junk mail through. How can I stop it?

  • PDFs won't save in iBooks

    I used to be able to open in iBooks and my PDFs would save into iBooks.  It was a great system.  It appears ios5 has created issues with this. I try at least 4-5 times per PDF and it still doesn't work.  It for a split second appears to work then it

  • Markview - Help

    Markview - Help (Web Inbox) I need to populate the field say "Work Order" List of Values against the InvoiceID or InvoiceNum (displaying in the top of the markview screen). Problem is while clicking the list of values, InvoiceID value is considering