Submit a html:form with a link

Hey everyone I have a html:form which am I correctly submitting with html:submitt buttons. But I was told to submit with links and not buttons :S So I'm trying to do it. I'm trying to do it like this:
<html:form action="/UpdateDeleteColecao.do" method="post" focus="colecao"> 
      <table border="0" align="center">
          <tr><td width="50%"> Cole��o </td><td width="50%"><html:text property="colecao" value="${requestScope.col.colecao}" readonly="true"/></td></tr>     
          <tr><td width="50%"> Descric�o </td><td width="50%"><html:text property="descricao" value="${requestScope.col.descricao}"/></td></tr>
          <tr>
             <td width="50%" align="center">
               <html:link action="/UpdateDeleteColecao.do"> <bean:message key="button.add"/> </html:link>
             </td>
             <td width="50%" align="center">
               <html:link action="/UpdateDeleteColecao.do"> <bean:message key="button.delete"/></html:link>
             </td>
          </tr>     
       </table><br/>
    </html:form> It is not working. I get the following error:
java.lang.NullPointerException
auge.form.AddColecaoForm.validate(AddColecaoForm.java:39)It works perfectly with the html:submit buttons. My action is a LookupDispatchAction. Is there a way to do it? Oh, a second question. What if I wanted to put the submit links to this form in a second frame, would that be possible?
I wouldn't wanna use Javascript, because if it's disabled everything will fail terribly. SO, I wanna know if there's any other way.
Thanks

I cannot use the typical regular HTML "a href",
because I have to call a struts action.No... you said you have to submit the form with a link. A link is an "a href", it's exactly what <html:link> generates. But a link cannot be used for form submitting except by invoking Javascript to do it programatically.
Using an action in <html:link>, presuming that's really refering to an action and not just the href value, which is what I'm not really sure of. It's been a while since I've used Struts. So maybe the action is the href part, and you can put "javascript:void(0);" there?
But I'm absolutely positive about the HTML/Javascript aspect. Struts tags don't alter how HTML works. They just make generating some HTML content easier. But in this case, I'm not sure that's helpful because I never found a simple way to get the actual form name that the <html:form> creates.

Similar Messages

  • How to submit a html form using java

    hi friends,
    i have a html form with some input fields, when ever a user submit the form the user information is stored in the database. is it possible to pass the user information in the url(url rewriting) and submit it by a java program so that the data will be stored in the database, as like as, user submit it manually.
    for eg:
    /*sample.html*/
    <form action="store.jsp" method="post">
    User Data:<input type="text" name="userdata">
    <input type="submit">
    </form>
    in my java is it possible to store the record as below:
    URL url=new URL("http://localhost:7001/webapp/store.jsp?userdata=AutomaticDatasave");
    URLConnection con=url.openConnection();
    int i=0;
    while((i=con.getInputStream().read())!=-1)
    System.out.print(i);/*it has to print the data that store.jsp is returned like information stored or error storing data(what ever)*/
    }Edited by: rajaram on Oct 27, 2007 1:01 AM

    hi Drclap,
    Thanks for your reply, which is helpful to me....
    tried what you said, what i did is modified the code like below
    con.setDoOutput(true);
    BufferedWriter br=new BufferedWriter(new InputStreamWriter(con.getOutputStream()));
    String str="userdata=AutomateDataSave\n";
    br.write(str,0,str.length());
    br.flush()But
    Iam Getting Internal Server Error
    Exception in thread "main" java.io.IOException: Server returned HTTP response code: 500 for URL
    Edited by: rajaram on Oct 27, 2007 1:24 AM

  • Submiting HTML Forms with JavaFX Webview

    I've long been searching for a good web robot framework. And I also need a gui for my robot.
    So w/ the advent of JAVAFX Webengine it seemed my needs have been met finally. Specially because on the webview tutorial here , Alla Redko says: "+It supports user interaction such as navigating links *and submitting HTML forms*+".
    But after looking at the api it doesn't seem that webengine supports submiting forms, only loading pages w/ the load() method. I guess I could populate the form fields and submit them w/ executeScript() but that's just sloppy.
    Is there a way to actually submit forms w/ webengine? Are there plans to implement this feature, analogous to the load() method?
    Thanks,
    JC

    Yea, as I mentioned in the first post, I could do all that w/ JS but it's just sloppy, since I'm using Java language, not JS.
    The finding certain fields part is easy w/ the Document model and xpath, it's the populating the fields and submiting the form along w/ its hidden input fields that is the missing part.
    Does anyone know if these things are planned for the future of Webview/Webengine?You can already do this in Java today using the existing APIs if you so wished.
    import javafx.application.Application;
    import javafx.beans.property.*;
    import javafx.beans.value.*;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.*;
    import javafx.scene.layout.*;
    import javafx.scene.web.*;
    import javafx.stage.Stage;
    import org.w3c.dom.*;
    import org.w3c.dom.html.*;
    public class WebViewFormPost extends Application {
      public static void main(String[] args) { launch(args); }
      @Override public void start(Stage stage) {
        final TextField fxUsername = new TextField();
        final TextField fxPassword = new PasswordField();
        final BooleanProperty loginAttempted = new SimpleBooleanProperty(false);
        final WebView webView = new WebView();
        final WebEngine engine = webView.getEngine();
        engine.documentProperty().addListener(new ChangeListener<Document>() {
          @Override public void changed(ObservableValue<? extends Document> ov, Document oldDoc, Document doc) {
            if (doc != null && !loginAttempted.get()) {
              if (doc.getElementsByTagName("form").getLength() > 0) {
                HTMLFormElement form = (HTMLFormElement) doc.getElementsByTagName("form").item(0);
                if ("/oam/server/sso/auth_cred_submit".equals(form.getAttribute("action"))) {
                  HTMLInputElement username = null;
                  HTMLInputElement password = null;
                  NodeList nodes = form.getElementsByTagName("input");
                  for (int i = 0; i < nodes.getLength(); i++) {
                    HTMLInputElement input = (HTMLInputElement) nodes.item(i);
                    switch (input.getName()) {
                      case "ssousername":
                        username = input;
                        break;
                      case "password":
                        password = input;
                        break;
                  if (username != null && password != null) {
                    loginAttempted.set(true);
                    username.setValue(fxUsername.getText());
                    password.setValue(fxPassword.getText());
                    form.submit();
                    System.out.println("Submitted login for user: " + username);
        engine.getLoadWorker().exceptionProperty().addListener(new ChangeListener<Throwable>() {
          @Override public void changed(ObservableValue<? extends Throwable> ov, Throwable oldException, Throwable exception) {
            System.out.println("Load Exception: " + exception);
        GridPane inputGrid = new GridPane();
        inputGrid.setHgap(10);
        inputGrid.setVgap(10);
        inputGrid.addRow(0, new Label("Username: "), fxUsername);
        inputGrid.addRow(0, new Label("Password: "), fxPassword);
        Button fxLoginButton = new Button("Login to Oracle Forums");
        fxLoginButton.setOnAction(new EventHandler<ActionEvent>() {
          @Override public void handle(ActionEvent t) {
            if (notEmpty(fxPassword.getText()) && notEmpty(fxPassword.getText())) {
              loginAttempted.set(false);
              engine.load("https://forums.oracle.com/forums/login!withRedirect.jspa");
        final VBox layout = new VBox(10);
        layout.setStyle("-fx-background-color: cornsilk; -fx-padding: 10;");
        layout.getChildren().addAll(
          new Label("Enter your Oracle Web Account credentials"),
          inputGrid,
          fxLoginButton,
          webView
        stage.setScene(new Scene(layout));
        stage.show();
      private boolean notEmpty(String s) {
        return s != null && !"".equals(s);
    }Personally, I think using JavaScript via engine.executeScript calls in combination with jquery might be a less messy solution (as I don't like writing against the raw dom apis), but I understand that there are valid reasons why you might prefer to use a Java only solution.
    https://gist.github.com/jewelsea/3077942 "Embeds jQuery in a document loaded into a WebView."

  • Populating a html form with fields from a database

    Ok, basically ive got fields in a db, for example:
    name
    decription
    time
    weather
    mood
    Ive got a html form that also has these fields.
    When the user clicks a button the homepage of the site, it should bring up a form in a popup window that has all the fields in based on the entries in the database - lets pretend there is only 1 entry in the database, so the form will be the same for every user.
    Any ideas how i could do this?
    BTW I'm using jsp and mysql as db.
    Thx peeps

    Hi,
    Are all the fields from the same table? if so you can construct a class say Test.java with the follwing attributes.
    <code>
    public string m_strName=null;
    get and set methods
    </code>
    You can repeat for all the fields in the DB. If you have primary key for the table you can set the ID of the class as the primary key. so in your JSP you get the class with ID (whichever you wish to) and use the class in the JSP like this
    <code>
    Test test = JDBCAccess.get("ID of the table");
    <%=test.getName();%>
    </code>
    This is an example of OR(object relational mapping).
    Hope this helps.
    thanks
    shyam

  • Html form with 2 pages

    I have created a form with designer that has 2 pages.
    In pdf, all works ok.
    But when i render it to html, i only can display the first page.
    How can i navigate between pages?
    Thanks in advance

    Hi,
    If your rendering your form as HTML then you are probably using LiveCycle Forms. To navigate between pages you will have to create a IOutputContext object and assign it the value returned by the call to the EJBClient.processFormSubmission(...)in your servlet. You will then need to call the IOutputContext.getFSAction() method to determine what action was performed on the form. If the value returned by getFSAction() is 3 then the output of the processFormsubmission method is the Next page in the form. If the value is 4 then the output is the previous page in the form. If getFSAction returns either 3 or 4 then you can write just the data returned by the call to IOutputContext.getOutputContent() back to the web browser.
    Trevor.

  • How can i fill selection box on html form with data on the clientside?

    hi
    i want to make a html form that reads option values from the client.
    Because there are too many data, it's not reasonable for me to design a page which connects to server each time to fill the selection boxes.Instead i want to check if data resides at the clientside, if so fill selection boxes with that data, if not download it for the first time and store it on the client for later local retrieval.In addition i must be able to update that data residing on the client when i want.

    Don't see where Java comes into this. Sounds like you'd be using JavaScript on the client.
    A cookie would probably be the only way to save data on the client.

  • Unable to submit podcasts to iTunes, with iWeb links.

    Everytime I submit the RSS link to iTunes I get this message.
    Error parsing feed: Invalid XML
    I'm copying the link straight from the published iWeb page, .mac site.
    I'm so confused. Any help would be appreciated.

    Libsyn.com is just a hosting service? But my clients want to be searchable on iTunes. I'll email you if I found out anything. Thanks

  • I can't open a HTML file with flash linked

    I have Flash CS3.  I have created a flash file.  If I click on the SWF file I have no problems opening it.  It plays.  It looks nice.  I'm the man.
    However, now when I try to publish it, the HTML file will not work.  It says "windows cannot find this file, please ensure you have typed the location correctly".
    I am double clicking directly on the file and not typing anything, in fact I was considering checking on Ebay to see if I could upgrade my PC to have eyes.
    The feature has worked previously, which leads me to the conclusion that something else has changed.  I have tried using the publish setting, I have also tried using Dreamweaver to embed the file, and have also tried manually inserting the necessary code after seeing some on a website.
    All of these things produce the same result, windows cannot (or will not) find the necessary file.
    It's an odd one, and very frustrating, can anyone help me at all?
    Cheers in advance,
    Eoin

    Nope this doesn't work.  I wasn't using the default names previously but I can't see that it should make a difference, although Flash can be quirky.
    I tried putting them in a new location to no avail.
    Attached is a screenshot of the error message.

  • Submit fdf data to php to pupulate a html form text box

    okay i have no idea if this can be done because I always see it the other way around....
    I want to give my clients some instructions to type in an account number that is taken from the pdf, submitted to my web server in php or asp, and generates the information into a text box field...
    can anyone help me in the right direction?

    I cannot use the typical regular HTML "a href",
    because I have to call a struts action.No... you said you have to submit the form with a link. A link is an "a href", it's exactly what <html:link> generates. But a link cannot be used for form submitting except by invoking Javascript to do it programatically.
    Using an action in <html:link>, presuming that's really refering to an action and not just the href value, which is what I'm not really sure of. It's been a while since I've used Struts. So maybe the action is the href part, and you can put "javascript:void(0);" there?
    But I'm absolutely positive about the HTML/Javascript aspect. Struts tags don't alter how HTML works. They just make generating some HTML content easier. But in this case, I'm not sure that's helpful because I never found a simple way to get the actual form name that the <html:form> creates.

  • Editing a PDF form- How to link fields in a text

    I am trying to create a basic form for a medical practice which has various sections [e.g "history of presenting illness"] that have several lines of text each. When I try and create the form and write on the previewed highlighted fields, my cursor continuously stays on the line/field until the end and never returns to the next line/field below it. Instead it seems only to decrease the size of the font. How do I link the fields in a section of text?

    You create a multiline field and then let it wrap. Your approach is wrong. If you insist on having separate entry lines, basically having a separate field for each line, then you might be able to do it with JavaScript. However separate fields for each line is not very consistent such a form.
    Be careful about how you submit such a form with patient data. I assume you are just planning on saving it to a file and not submitting. The submission to an e-mail is not secure and thus not appropriate for such data. Also, you really only need to save the data for most uses other than viewing, and so saving as the data as FDF or XML (if Designer is used) is probably more appropriate to the application.

  • Forms with JSP

    I want to use the return values of an HTML form with a post method to a .jsp file:
    <input type="text" name="xxx">...
    In my .jsp that submit the information, how could i define the requested parameters from the form and how could i manage to use them to insert or compare the informations to the database ??
    Maybe they are special classes ?
    Thanks for all the help you could bring me.
    NICO

    Nico,
    I would also recommend posting this to the JSP discussion forum since it is a 'generic' JSP question.
    WEbsites to try for more JSP info include:
    http://htmlguru.com http://www.insidedhtml.com
    Good luck.
    Laura

  • HTML forms --- Why so complicated?

    Creating a fully functional HTML form with MS Frontpage was a
    very simple task. It took minutes to do by someone with no
    programming knowledge. However, with Dreamweaver it's a nightmare
    of a project unless you're a hardcore server-side programmer.
    How can this be? How can something as simple and half-hearted
    as MS Frontpage 2003 be better than Dreamweaver CS3? Why does Adobe
    not add a fully functional form builder to Dreamweaver? This is a
    critical feature for any HTML design program. To not have it is
    just foolish.
    Anyone know why Adobe has been so negligent on this matter?

    A couple scripting links to check out...
    http://www.hotscripts.com/
    http://www.scriptarchive.com/
    Also... As well as the links below - another way to learn
    (including anyone else's bad habits) is to find a page you like,
    and then tell your web browser to show you the code view for the
    page and/or do a "Save As" and save the page to your computer to
    then copy & paste code segments into your file (in IE click
    View at the top, select Source from the options)
    HTML and/or DW Tutorials, and other information links that I
    have saved
    http://validator.w3.org/
    http://www.visibone.com/
    http://www.w3schools.com/
    http://www.hotscripts.com/
    http://www.projectseven.com/
    http://www.adobe.com/devnet/
    http://www.scriptarchive.com/
    http://www.htmldog.com/guides/
    http://www.htmlcodetutorial.com/
    http://alistapart.com/topics/code
    http://www.how-to-build-websites.com/
    http://css.maxdesign.com.au/floatutorial/
    Download User Guide as PDF for easy search
    http://www.adobe.com/support/documentation
    http://www.ianr.unl.edu/internet/mailto.html
    http://lynda.com/ Hours of videos.
    (must pay)
    http://apptools.com/examples/pagelayout101.php
    http://www.thesitewizard.com/archive/css.shtml
    http://www.projectseven.com/tutorials/index.htm
    If not PDF (link above) an online guide to read
    http://livedocs.adobe.com/en_US/Dreamweaver/9.0/
    Customizing the layouts that come with CS3 (VIDEO)
    http://www.adobe.com/designcenter/video_workshop/?id=vid0155
    FormMail
    http://www.bebosoft.com/products/formstogo/index.php
    For those using MySQL - Installing PHP and MySQL on Windows
    XP
    http://www.webassist.com/professional/products/solutionrecipes.asp
    Community MX lessons
    http://www.communitymx.com/abstract.cfm?cid=3D074
    http://www.adobe.com/cfusion/designcenter/search.cfm?product=Dreamweaver&go=Go
    The Contact Form Solution Pack is only $29.99. To learn more,
    visit
    http://www.webassist.com/go/cfsp

  • Render html form & send forms's input values as params via HTTP POST

    Hello,
    I'm using appache commons http client to send HTTP post queries to a given url and receive HTTP response then process it.
    one of the requirements of my Application is the following: one of these HTTP Post requests is supposed to return an HTML form with different html types (text filed, text area etc..) that i will need to display in my swing application. one important requirement is that i can't know in advance what the html form field types will be.. it depends on a given parameters that my application send as part of HTTP Post method (using apache http client).
    I Longly searched for a simple solution to this problem . There are many solutions but each one has it's limitations :
    1-i can render the html form inside a JEditorPane .but how can I collect the user entered data inside JEditorPane ? i'm not sure this swing component offers the capability to detect its html contents and more it will be difficult to know what are the values entered by user inside html form rendered by JEditorPane.
    2-are there any Java Embedded browsers that offer some API to enable me detect the html form fields ,capture the data entered by user inside the html form ?
    3-the solution i currently opted for is : parse html & convert html form to swing dialog. currently this solution i use works well but the cost of implementing it is high : it involves difficult parsing logic. this makes me worried .I'm not sure if i'm now using the right & easiest solution.
    I need some advice on What is the simplest and clean solution to render a html form & yet be able to collect user entered inputs & send the user input values as params via java HTTP POST request ?

    dragzul wrote:
    In my opinion, your actual solution is what you need to do. You're trying to "merge" two different kinds of view. Actually, the "easiest" way may be: if you have your data to display, you decide to show it on html or swing.Yes i believe that my current solution may be the unique one for my special requirements. when doing research about this problem i found a multitude of java libraries to convert xml to swing (ex: www.swixml.org) .However i was surprised there are no java libraries to convert HTML forms to swing dialogs -as far as i know-. this is a bit strange. The Limitation is that the developers of the server API are not Java guys and are reluctant to use an xml format that i can easily convert to swing . probably they have their own reasons as they might be using the HTML Response for some other server side work. So I was obliged to deal with an HTML stream that i need to display in my client application and process its data. in my opinion the only way to do this is by developing a HTML form to swing converter package. that's what i did now. i was only worried if i'm complicating things and if there are some easier solutions to this issue.
    thanks

  • Html form - java applet

    Hi friends
    I have an html form with an editable textfield on it. Next to it is an Java Applet with an Button on it. If you klick the button, a Popup aperars where the textfield can be modified. There is also an OK Button on this Popup. If you klick the Button, I want that the value of my string will be plased into the html form.
    If anyone knows how that works. Please help me.
    thanks kendiman

    Sweet, I was wondering how to do that.
    So if one was to design a menu using java, the external Java Script can access the public variables within the applets?
    So if we had
    public class applet extends Applet {
       public int test;
       public applet() {
          test = 6;
    }then the javascript command
    document.applet.test
    would return a 6?
    Do I have this correctly?
    Dale M

  • Displaying images in HTML Forms inside Servlets

              Dear friends
              How are you?
              I am developing Servlets in WebGain Studio Pro V4.1 VisualCafe
              V4.1 to display dynamic HTML forms with embedded
              images (*.jpg and *.gif).
              Please see the following sample code -
              "<DIV ID=\"Logo\" STYLE=\"position:absolute; left: 4%; top: 4%;
              width: 25%; height: 12%; z-index:1; visibility:visible\">" +
              "<IMG SRC=\"FigLogo.gif\" WIDTH=\"100%\" HEIGHT=\"100%\">" +
              "</DIV>"
              Then I deploymed servlets to BEA WLS 6.0 by including Servlets
              in the Web.xml file. However, I do not see the images when
              viewed in IE5.0 browser.
              I appreciate all comments and suggestions.
              Thanking you
              Very truly yours
              Sriram (Ram) Peddibhotla, PhD
              

              Dear Friends
              How are you?
              I moved all images (*.jpg, *.gif) to the subdirectory
              /myDomain/applications/DefaultWebApp_myServer/images
              and they are displaying now in the servlets with HTML forms.
              Thanking you
              Very truly yours
              Sriram (Ram) Peddibhotla, PhD
              "Sriram (Ram) Peddibhotla" <[email protected]> wrote:
              >
              >Dear Friends
              >
              >How are you?
              >
              >When the Servlet displays in the browser (IE5.0), when I click on where
              >the image
              >should be, I see the path
              >http://localhost:7001/servlet/FigureName.jpg (????). Why did it add
              >the /servlet
              >part to the path, I thought that was exclusively for deploying servlets
              >in web.xml
              >file.
              >
              >Thanking you
              >Very truly yours
              >Sriram (Ram) Peddibhotla, PhD
              >
              >
              >"Xiang Rao" <[email protected]> wrote:
              >>
              >>Check access.log to see the status of your image request (status code
              >>and response
              >>size). You can also check weblogic.log. On the other hand, IE cache
              >setup
              >>(e.g.,
              >>"Never") could cause this problem.
              >>
              >>"Sriram (Ra) Peddibhotla" <[email protected]> wrote:
              >>>
              >>>Dear friends
              >>>
              >>>How are you?
              >>>
              >>>I am developing Servlets in WebGain Studio Pro V4.1 VisualCafe
              >>>V4.1 to display dynamic HTML forms with embedded
              >>>images (*.jpg and *.gif).
              >>>
              >>>Please see the following sample code -
              >>>"<DIV ID=\"Logo\" STYLE=\"position:absolute; left: 4%; top: 4%;
              >>>width: 25%; height: 12%; z-index:1; visibility:visible\">" +
              >>>"<IMG SRC=\"FigLogo.gif\" WIDTH=\"100%\" HEIGHT=\"100%\">" +
              >>>"</DIV>"
              >>>
              >>>Then I deploymed servlets to BEA WLS 6.0 by including Servlets
              >>>in the Web.xml file. However, I do not see the images when
              >>>viewed in IE5.0 browser.
              >>>
              >>>I appreciate all comments and suggestions.
              >>>
              >>>Thanking you
              >>>Very truly yours
              >>>Sriram (Ram) Peddibhotla, PhD
              >>>          
              >>
              >
              

Maybe you are looking for

  • How do I copy the full email address including the name (in the "First Last email@server.tld " format)?

    Right-click menu gives me the address itself, [email protected], but I would like to get the full thing without going back and manually copying the name.

  • HELP, Wireless Issues Very Strange!!

    I'll make this quick. I work in a home office for a church. We have 3 macs (2 ibooks, 1 pbook), and a junky PC running windows XP. We recently had an awesome new copy machine installed (Gestetner DSc-428). here's the issue... As soon as we plug in th

  • External Sound C

    I am a laptop user and am looking for an upgrade to the internal sound card. I would like to be able to make use of 5. output using softwear ex: adobe audition, fl studio, ect. I was looking at: Audigy 2 NX SB Li've! 24-bit external - I noticed that

  • Tables of long texts

    Hi Gurus: I need to know the tables where the long texts are saved for the following: 1. Code description 2. Inspection method 3. Documentation when the result is rejected N.B: I need the long text itself, not the indicator that a long text exist. Re

  • Sales Commission Report for All Employees

    I'm trying to make a couple smartforms that will do the following tasks (each task is a separate smartform): 1. Display the total sales amount for ALL employees over one month in a table format 2. Display the total sales amount and commission for ONE