Calling a method with a html Submit button

hi guys,
is it possible to call a method from a JSP file using a HTML submit button. I know i can call another website easily doing it this way, is there a similar way available to call a method once the button is clicked?
FYI
The method is in a bean file named jdbc. The methods name is getUsername.
Nice one.
<form action = <%jdbc.getUsername()%> <input type="submit" value="Submit">

Dear friend,
you mentioned that u need to call a method when submit button is clicked. Is the method dynamically created. If not so, then you can include the method on the submit button html file itself.
Regards,
Rengaraj.R

Similar Messages

  • Call BADI  on click of a submit button in ESS

    Hi All,
    I am trying to call a function module ( i.e through BADI ) in a different browser by clicking on a submit button in Travel & Expenses Iview in ESS ( EP 6.0 ) but i didn't see any new window/ browser opened when i clicked on submit button.
    The BADI is activated and its working fine because the same functionality is working good when i tested this through trans. code  PR_WEB_1200. When i clicked on a submit button, a new browser was opened and the form was displayed the way we want in a different browser.
    But when i tested the same in ESS, i couldn't see any new browser or window opened. If the BADI was called when i clicked on the submit button atleast a new browser has to open with a blank page.
    Please guide me, If anybody knows, how to call a function module in a new browser by clicking on a button in ESS - Portal.
    Thanks.
    Anil

    Hi Jayesh,
      You can use the BADI BBP_CUF_BADI_2 to change the display from customer-defined fields to the SAP standard screen. This BAdI enables you to control whether the fields can be edited, and how they are displayed.
    MODIFY_SCREEN method will Show/hide field display and restrict edit options.
    For more information on BADI please go to SPRO -> BADI.
    OR  View the information on BADI's.
    http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e10000000a11402f/content.htm
    Hope above proves helpful to you.
    Regards,
    Rajeshree.

  • HTML submit button within PHP

    Hello,
    The first section of code below returns a message that says "The topic 'x' has not been added." if a user enters a topic that is not in my database.  I would like to give the user the option to add "x" to the database by clicking on an HTML submit button.  So I guess my problem is that I don't know how to add an HTML submit button within PHP that would post $name=$find to tprocess.php and then trigger the code in tprocess.php.  How do I do that?
    Thanks,
    John
    $anymatches=mysql_num_rows($result);
    if ($anymatches == 0)
    print "<p class=\"topic2\">The topic \"$find\" has not been added.</p>\n";
    print "<p class=\"topic2\">Add the topic \"$find\".</p>\n";
    <form action="tprocess.php" method="post">;
    $name=$find;
    <input type="submit" value="Submit">";
    </form>;
    Below is what I have on tprocess.php.  It is code that adds a topic to my database:
    if (isset($_POST['name']) && !empty($_POST['name'])) {
    mysql_connect("mysqlv10", "username", "password") or
    die(mysql_error());
    mysql_select_db("database") or die(mysql_error());
    $table = mysql_real_escape_string($_POST['name']);
    $query = "CREATE TABLE `$table` (id INT(11) NOT NULL auto_increment, site VARCHAR(150) NOT NULL, votes_up BIGINT(9) NOT NULL, votes_down BIGINT(9) NOT NULL, PRIMARY KEY(id), UNIQUE (site))";
    $result = mysql_query($query) or die(mysql_error());

    Just add it to a hidden field in the form. Sorry I don't know php, but in ASP you would use something like this:
    <% If  MyTestCondition = 1 Then %>
    <form action="tprocess.php" method="post">
    <input name="Find type="hidden" id="Find" value=<%=Find%> >
    <input type="submit" value="Submit">"
    </form>
    <%End If%>
    So I'm sure you could do something similar with PHP.
    Now, unrelated to your question, I am curious about this:
    $query = "CREATE TABLE `$table` (id INT(11) NOT NULL auto_increment, site VARCHAR(150) NOT NULL, votes_up BIGINT(9) NOT NULL, votes_down BIGINT(9) NOT NULL, PRIMARY KEY(id), UNIQUE (site))";
    Are you creating new tables for each new topic and the bigger question, why    ??

  • Calling a method with a string

    Here's the question:
    I want to call a method with the name equal to a string variable.
    For example, if the string variable contains "hellojava" , i'd like the hellojava() method to be called..
    if the string contains "error", the error() method should be called..
    and so on..:)

    Here is an example I had thrown together for this
    purpose of the exact demonstration, Ar'nt you in luck.:-). If there is anything you don't understand,
    I can be reached at [email protected] and will be happy to help....
    import java.lang.reflect.*;
    import java.io.*;
    class Test {
         String name = "Default";
            public Test(String name) {
                    this.name = name;
            public void test() {
                    System.out.println("Hello");
         public void count() {
              for(int i=0; i<10; i++) {
                   System.out.println(i);
           public static void main(String[] args) {
                 try {
                         Test myObject = new Test("test1");
                             Class myClass = myObject.getClass();
                   BufferedReader bRead =
                        new BufferedReader(
                        new InputStreamReader( System.in ));
                   String bufStr = null;
                   while( (bufStr = bRead.readLine()) != "exit") {
                         Method noParams = myClass.getDeclaredMethod(bufStr, new Class[] {});
                              noParams.invoke(myObject, new Object[] {});
                }catch(Exception e) {
                   System.out.println("No Such Method.");
    }Good Luck,
    -- Ian

  • Calling a method with parameters in jstl?

    i need to call a method with a series of String parameters what am i doing wrong?
    the java
        public ArrayList getEmployeeSkills(String ename, String snmae, String yearsexp)the jstl
        <jsp:useBean id="empskill" class="com.Database.EmployeeSkill"/>
        <c:forEach var="emp" items="${empskill.EmployeeSkills(null, null, null)}">
        </c:forEach>

    this works:
         <jsp:useBean id="empskill" class="com.Database.EmployeeSkill" scope="page">
             <jsp:setProperty name="empskill" property="ename" value="Helen Smith"/>
             <jsp:setProperty name="empskill" property="sname" value="Java"/>
         </jsp:useBean>but this part isnt:
         <c:forEach var="empskill" items="${empskill.EmployeeSkillsReport}">
         </c:forEach>ive removed the get part from the method as i have done before from the java class it is calling:
    public ArrayList getEmployeeSkillsReport()
    but it produces:
    org.apache.jasper.JasperException: Exception in JSP: /main.jsp:146
    143:      </jsp:useBean>
    144:      
    145:
    146:      <c:forEach var="empskill" items="${empskill.EmployeeSkillsReport}">
    147:      </c:forEach>
    148:                          
    149:    
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.ServletException: An error occurred while evaluating custom action attribute "items" with value "${empskill.EmployeeSkillsReport}": Unable to find a value for "EmployeeSkillsReport" in object of class "com.Database.EmployeeSkill" using operator "." (null)
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:776)
         org.apache.jsp.main_jsp._jspService(main_jsp.java:244)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "items" with value "${empskill.EmployeeSkillsReport}": Unable to find a value for "EmployeeSkillsReport" in object of class "com.Database.EmployeeSkill" using operator "." (null)
         org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:109)
         org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:129)
         org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate(ExpressionEvaluatorManager.java:75)
         org.apache.taglibs.standard.tag.el.core.ForEachTag.evaluateExpressions(ForEachTag.java:155)
         org.apache.taglibs.standard.tag.el.core.ForEachTag.doStartTag(ForEachTag.java:66)
         org.apache.jsp.main_jsp._jspx_meth_c_forEach_3(main_jsp.java:590)
         org.apache.jsp.main_jsp._jspService(main_jsp.java:232)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

  • Htmls:submit buttons and links in struts

    Hello,
    I am developing a struts web application. In the course of that I have two questions:
    How can I define an image to display for a html:submit button instead the traditional visualization of the html:submit button?
    The same for links - How can I define an image for a link?
    thanks in advance
    Kind Regards
    pat

    How can I define an image to display for a
    html:submit button instead the traditional
    visualization of the html:submit button?
    The same for links - How can I define an image for a
    link?
    <html:image>

  • How to use Spry validation with link styled submit buttons..??

    I'm working with a theme package that comes with a bunch of button styles that work with basic links.  For example:
    <a href='page.html' class='small-button smallblue'><span>Button Label</span></a>
    I've got a basic form setup with Spry validation, but the submit button needs some styling to make it look nice with the site.  Since there are already styles ready for me to turn links into buttons I figured I'd use the same thing for my submit buttons.
    To accomplish that, I'm using the following javascript...
    <script type="text/javascript">
    function submitForm() {
        document.getElementById("form_name").submit();   
    </script>
    And then I'm updating my submit button to something like this...
    <a href='javascript: submitForm()' class='small-button smallblue'><span>Button Label</span></a>
    When I do this, the form submits as expected, but the Spry validation doesn't work.  Is there a way I can make the Spry stuff work with these types of buttons?  I know I could create separate styles for the submit buttons themselves, or I could use an image type button, but I'd really like to figure out how to get these existing styles to work for me since the theme already has so many of them done for me.
    Any information on this would be greatly appreciated.  Thanks!

    Save yourself a lot of trouble and style the normal submit button as per
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">
    <style>
    .Standout {
        font-family: Geneva, Arial, Helvetica, sans-serif;
        text-transform: uppercase;
        color: #FFFFFF;
        font-size: 16px;
        background-color: #CC0000;
        font-weight: bold;
        border-style: none;
        padding-top: 6px;
        padding-bottom: 5px;
        padding-right: 64px;
        padding-left: 64px;
        letter-spacing: 1px;
    .Standout:hover {
        background-color: #000000;
    </style>
    </head>
    <body>
    <form action="" method="get" name="myform">
      <span id="sprytextfield1">
      <label for="text1"></label>
      <input type="text" name="text1" id="text1">
      <span class="textfieldRequiredMsg">A value is required.</span></span>
      <input name="input" type="submit" class="Standout">
    </form>
    <script>
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur"]});
    </script>
    </body>
    </html>
    Gramps

  • HTML submit button in a folio won't generate an email.

    I have an HTML page with a form and submit button that creates an email with the results of the form.
    In Safari on the iPad the form and submit button work, but when the HTML link is viewed in a folio page the submit button will not work, even though all the fields are fillable and working. The code is following.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
              <title>mailto Example</title></head>
    <body>
    <form action="mailto:[email protected]" method="post" enctype="text/plain" >
      FirstName:
      <input type="text" name="FirstName">
    Email:<input type="text" name="Email">
    <input type="submit" name="submit" value="Submit">
    </form>
    </body>
    </html>

    First, the page is down, I just get a generic page.  Second you may need to reach out to your web host.  I see that you are using hosting from Intuit.  Being that they have a proprietary setup, some custom scripts may not work.
    Third, once that is confirmed, if you are making this script I would recommend changing the $_REQUEST text in the sendmail to $_POST.  $_REQUEST means that your form can get spammed because they can pass the data via GET or POST.  The $_POST is just the first step to ensure the data came from your form.

  • Using onFocus method with embedded html

    Hi,
    I have embedded html in a servlet. I am using a text field to call the onFocus method with the following code:
    out.println("<input type='text' name='name' value='0' onFocus='if(this.value=='0')this.value=';'>");
    If I was using straight html with no servlet this works fine. When the user clicks on the field the default value is automatically erased.
    Why will this not work in a servlet?
    I have also tried calling a javascript function. Please note that I successfully use javascript with input type 'button' to render a pop up window with dimensions. So my javascript inside a servlet works elsewhere.
    Thanks VERY MUCH for your time
    Rick

    I don't think it's the same as I'm doing. Essentially, I have a JEditorPane subclass, which just has a few custom tags in it. I don't need them to be recognized by java, since it will be uneditable, but I just need to know how to convert from the getText() locations to the actual displayed text locations.
    Also, when I set the text as text/html, it creates a bunch of extra HTML tags, so it's larger than the original String used to create it.

  • Working with HTTP-POST Submit Button

    I've created a form that uses a submit button with HTTP-POST.   I've tested this against a script that displays the fields, however, I'd like to table the posted data to SQL.   Can someone show me some code to parse this data with CGI, or PHP?

    Yes. At some point you will need to prarse the requests and treat them differently - because a POST is NOT the same as a GET.
    Anyway, just place the variables or script-links to the variables in an HTML Form.
    Very easy stuff.

  • Can not keep drawable signature option in reader on a form with a mailto: submit button added.

    I hope someone has run into this.  I have acrobat 11.0.10 to create fill-able forms and reader 11.0.10 to view and fill them.  Do to the nature of the forms a drawn signature is required and is available right up until I add a submit button with a mailto: action.  Then all that is available in the reader is the digital certificate.  I should add that I save the form without reader extensions.  Is there a way to add the auto-adressed mailto function for the person filling the form and still keep the drawable signature option for signing?

    - is it possible to have more than one form on the page. If so how do
    I determine which form is submitted isDefined('form1'),
    isDefined('form2') does not seem to work,
    /quote
    Yes.
    - if there are two buttons in the form how can I tell which one was
    preses as both seem to return true when tested with isDefined()
    /quote
    Give the buttons different name attributes. On your action page check
    with StructKeyExists(Form, "name_of_first_button") and
    StructKeyExists(Form, "name_of_second_button") which one was pressed.
    Mack

  • Call a method with complex data type from a DLL file

    Hi,
    I have a win32 API with a dll file, and I am trying to call some methods from it in the labview. To do this, I used the import library wizard, and everything is working as expected. The only problem which I have is with a method with complex data type as return type (a vector). According to this link, import library wizard can not import methods with complex data type.
    The name of this method is this:   const std::vector< BlackfinInterfaces::Count > Counts ()
    where Count is a structure defined as below:
    struct Count
       Count() : countTime(0) {}
       std::vector<unsigned long> countLines;
       time_t countTime;
    It seems that I should manually use the Call Library Function Node. How can I configure parameters for the above method?

    You cannot configure Call Library Function Node to call this function.  LabVIEW has no way to pass a C++ class such as vector to a DLL.

  • Calling arbitrary method with expression language

    I'm new to JSP, but have a strong background in Java. I've created a bean that I've included on a JSP page that is meant to manage access to a database. On this bean I have a method
    public int createNewRecord();which will create a new record and return its id. I then want to embed this id in a link within my webpage by using something like:
    <jsp:useBean id="dbBean" scope="application" class="com.myDomain.DatabaseIfaceBean"/>
    <html>
    <body>
    Link to <a href="relativePage.jsp?recordId=${dbBean.createNewRecord}">record page</a>
    </body>
    </html>However, this doesn't work. Is there a way to call this method? If this method accepted arguments, is there some way I could pass arguments to it?

    Its a bit long winded, but EL functions would be the way to go. [url http://www.sitepoint.com/article/java-6-steps-mvc-web-apps/6]Here's  a link (search for EL functions in the page)
    ram.

  • Dynamic Imagelink Component - Calling Impl method with input parameter

    Hi All,
    I have requirement where Imagelinks are created dynamically on the pageload. Generated the components and the components are displayed on the jspx.
    Now when I click the image link, a method in AMImpl should invoke and this method takes some input parameters.
    I am able to call the method successfully in AMimpl with the help of below code. But I could not understand how to pass the input parameters to that method.
                               RichCommandImageLink lockimageLink =
                                new RichCommandImageLink();
                            lockimageLink.setIcon("icon.png");
                            lockimageLink.setId("icon" + index);                   
                            MethodExpression me =
                                JSFUtils.getMethodExpression("#{bindings." +
                                                             "MyMethodName" +
                                                             ".execute}");
                            lockimageLink.addActionListener(new MethodExpressionActionListener(me));
      public static MethodExpression getMethodExpression(String name) { 
       Class [] argtypes = new Class[1]; 
       argtypes[0] = ActionEvent.class; 
       FacesContext facesCtx = FacesContext.getCurrentInstance(); 
       Application app = facesCtx.getApplication(); 
       ExpressionFactory elFactory = app.getExpressionFactory(); 
       ELContext elContext = facesCtx.getELContext(); 
       return elFactory.createMethodExpression(elContext,name,null,argtypes); 
      } Can some one please suggest how to pass input parameters to the Impl method.
    Jdeveloper Version : 11.1.1.4.0
    Thanks,
    Morgan.
    Edited by: 900114 on May 12, 2012 11:23 PM

    You can use the below method to call an AMImpl method. You can pass parameters as well to the AMImpl method.
    DCBindingContainer bindings = getDCBindingContainer();
    OperationBinding ob = bc.getOperationBinding("MyMethodName");
    Map m = ob.getParamsMap();
    ob.put("paramName", "paramValue"); paramName is the parameter in AMImpl and paramValue is the value to be passed.
    ob.execute();
    Where getDCBindingContainer() is:
    public DCBindingContainer getDCBindingContainer() {
    ExpressionFactory exprFactory;
    ELContext elContext;
    ValueExpression valueExpression;
    DCBindingContainer dcBindingContainer;
    FacesContext facesContext = FacesContext.getCurrentInstance();
    exprFactory = facesContext.getApplication().getExpressionFactory();
    elContext = facesContext.getELContext();
    valueExpression =
    exprFactory.createValueExpression(elContext, "#{bindings}",
    Object.class);
    dcBindingContainer =
    (DCBindingContainer)valueExpression.getValue(elContext);
    return dcBindingContainer;
    Hope this helps
    Edited by: umesh.agarwal on May 13, 2012 12:10 AM
    Edited by: umesh.agarwal on May 13, 2012 12:10 AM

  • Using Java Reflection to call a method with int parameter

    Hi,
    Could someone please tell me how can i use the invoke() of the Method class to call an method wiht int parameter? The invoke() takes an array of Object, but I need to pass in an array of int.
    For example I have a setI(int i) in my class.
    Class[] INT_PARAMETER_TYPES = new Class[] {Integer.TYPE };
    Method method = targetClass.getMethod(methodName, INT_PARAMETER_TYPES);
    Object[] args = new Object[] {4}; // won't work, type mismatch
    int[] args = new int[] {4}; // won't work, type mismatch
    method.invoke(target, args);
    thanks for any help.

    Object[] args = new Object[] {4}; // won't work, type
    mismatchShould be:
        Object[] args = new Object[] { new Integer(4) };The relevant part of the JavaDoc for Method.invoke(): "If the corresponding formal parameter has a primitive type, an unwrapping conversion is attempted to convert the object value to a value of a primitive type. If this attempt fails, the invocation throws an IllegalArgumentException. "
    I suppose you could pass in any Number (eg, Double instead of Integer), but that's just speculation.

Maybe you are looking for

  • Error in the input config file

    Continue message previous. I need deploy my application "notitia". Return message: Failed to deploy web application "notitiancm". Error in the input config file. Attribute Options is a single value attribute.

  • Report Painter in ECC 6.0

    Dear Viewers, My client is using the report painter in classic GL account. Recently, they migrated to New G/L ECC 6.0. All the report painters also migrated from old system. When i tried to execute the report in the new system there is no output. Sin

  • Why won't Firefox stay installed?

    When I log into Firefox, it keeps telling me I'm not on the most current version. I download it, install it, and when I come back to it after an IE session, it's gone. Also, it is not staying "stuck" even though I've tried to make it my default brows

  • Selecting specific values

    Hi, thank you for viewing my discussion. I have two pdf forms, Order Form and Invoice Form. On the Order Form I have a submit button that submits an FDF file. I then will open the FDF file with the Invoice Form and it populates the form fields. Howev

  • Schema View Data LRU Manager Statistics without results

    Hi, I'm tried to improve the behaviour of my application SiteStudio and I'm working with "System Audit". I saw two sections "Schema View Data LRU Manager Statistics" and "Schema View Data Cache Details" that they always don't have values. ¿ Are there