How to call a set method from within a constructor

Hello,
I want to be able to call a set method from within a Scanner, to be used as the argument to pass to the Scanner (from a source file). Here's what i tried:
private void openFiles()
        input = new Scanner( setSource );              
    and here is the set method:
public String setSource( String in )
        source = in;
        return source;
    }obviously there will be more code in this method but i'm trying to tackle one problem at a time. Thanks in advance..

The "String in" declaration says: "Nobody may ever invoke setSource() without specifying a certain String. The content of the String is known at run-time only."
In no place in your code you say the compiler: "I want the 'in' variable (actually, parameter) of method setSource() to contain the first arg which is passed to the application".
This is exactly the same mechanism allowing you to write "new Scanner" with something inside the two parentheses.

Similar Messages

  • How to call jpf controller method from javascript

    Can any one help me how to call pageflow controller method from JavaScript.\
    Thanks.

    Accessing a particular pageflow method from Javascript is directly not possible unless we do some real funky coding in specifying document.myForm.action = xyz...Heres what I tried and it did not work as expected: I found another workaround that I will share with you.
    1. In my jsp file when I click a button a call a JavaScript that calls the method that I want in pageflow like this: My method got invoked BUT when that method forwards the jsp, it lost the portal context. I saw my returned jsp only on the browser instead of seeing it inside the portlet on the page of a portal. I just see contents of jsp on full browser screen. I checked the url. This does make the sense. I do not see the url where I will have like test1.portal?_pageLabe=xxx&portlet details etc etc. So this bottom approach will notwork.
    document.getElementById("batchForm").action = "/portlets/com/hid/iod/Batches/holdBatch"; // here if you give like test1.portal/pagelable value like complete url...it may work...but not suggested/recommended....
    document.getElementById("batchForm").submit;
    2. I achieved my requirement using a hidden variable inside my netui:form tag in the jsp. Say for example, I have 3 buttons and all of them should call their own action methods like create, update, delete on pageflow side. But I want these to be called through javascript say for example to do some validation. (I have diff usecase though). So I created a hidden field like ACTION_NAME. I have 3 javascript functions create(), update() etc. These javascripts are called onclick() for these buttons. In thse functions first I set unique value to this hiddent field appropriately. Then submit the form. Note that all 3 buttons now go to same common action in the JPF. The code is like this.
    document.getElementById("ACTION_NAME").value = "UPDATE";
    document.getElementById("batchForm").submit.
    Inside the pageflow common method, I retriev this hidden field value and based on its value, I call one of the above 3 methods in pageflow. This works for me. There may be better solution.
    3. Another usecase that I want to share and may be help others also. Most of the time very common usecase is, when we select a item in a drop bos or netui:select, we want to invoke the pageflow action. Say we have 2 dropdown boxes with States and Cities. Anytime States select box is changed, it should go back to server and get new list of Cities for that state. (We can get both states and cities and do all string tokenizer on jsp itself. But inreality as per business needs, we do have to go to server to get dynamic values. Here is the code snippet that I use and it works for all my select boxes onChange event.
    This entire lines of code should do what we want.
    <netui:anchor action="selectArticleChanged" formSubmit="true" tagId="selectPropertyAction"/>                    
    <netui:select onChange="document.getElementById(lookupIdByTagId('selectPropertyAction',this )).onclick();" dataSource="pageFlow.selectedArticleId" >
    <c:forEach items="${requestScope.ALL_ARTICLE}" var="eachArticle">
    <%-- workshop:varType="com.hid.iod.forms.IoDProfileArticleRelForm" --%>
    <netui:selectOption value="${eachArticle.articleIdAsString}">${eachArticle.articleItemName}</netui:selectOption>
    </c:forEach>               
    </netui:select>
    See if you can build along those above lines of code. Any other simpler approches are highly welcome.
    Thanks
    Ravi Jegga

  • How to call a bean method from javascript event

    Hi,
    I could not find material on how to call a bean method from javascript, any help would be appreciated.
    Ralph

    Hi,
    Basically, I would like to call a method that I have written in the page java bean, or in the session bean, or application bean, or an external bean, from the javascript events (mouseover, on click, etc...) of a ui jsf component. I.e., I would like to take an action when a user clicks in a column in a datatable.
    Cheers,
    Ralph

  • How to call an ejb method from jsp?

    Hi, everyone!
    Inside my JSP, I4m using scripts in order to show and receive information, that is, a form.But I don4t Know if I can use the same variables from the script in order to call the 'set' methods from my EJB.
    Could anyone show me an example?
    Thanks in advance,
    Silvia

    InitialContext ctx = new InitialContext();
         GeneralEditor editor = (GeneralEditor) ctx
                        .lookup("GeneralEditorBean/remote");
              GeneralService service = (GeneralService) ctx
                        .lookup("GeneralServiceBean/remote");
              LanMu lm = new LanMu();
              lm.setName("shdfkhsad");
              editor.add(lm);

  • How to call backing bean method from java script

    Hi,
    I would like to know how to call backing bean method from java script.
    I am aware of serverListener and [AjaxAutoSuggest article|http://www.oracle.com/technology/products/jdev/tips/mills/AjaxAutoSuggest/AjaxAutoSuggest.html]
    but i am running in to some issues with [AjaxAutoSuggest article|http://www.oracle.com/technology/products/jdev/tips/mills/AjaxAutoSuggest/AjaxAutoSuggest.html]
    regarding which i asked for help in other thread with subject ....Question on AjaxAutoSuggest article (Ajax Transactions Using ADF and J...)
    The reason why i posted is ( though i realise both are duplicates) .. that threads looks as a specific question to that article hence i would like to ask the quantified problem is asked in this thread.
    So could any please letme know how to call backing bean method from java script
    Thanks
    Murali
    Edited by: mchepuri on Oct 24, 2009 6:17 PM
    Edited by: mchepuri on Oct 24, 2009 6:20 PM

    Hello,
    May know how to submit a button autoamtically on onload of page with clicking a welcome alert box. the submit button has managed button too to show a message on console using SOP.
    the problem is.
    1. before loading the page a javascript comes on which i clicked ok
    2. the page gets loaded and the button is there which gets automatically clicked and the managed bean associated with prints a message on console using SOP.
    I m trying to do this through server listener and click listener. the code is(adf jspx page)
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1" binding="#{backingBeanScope.backing_check4.d1}">
    <af:form id="f1" binding="#{backingBeanScope.backing_check4.f1}">
    <af:commandButton text="commandButton 1"
    binding="#{backingBeanScope.backing_check4.cb1}"
    id="cb1" action="#{beanCheck4.submit1}"/>
    <af:clientListener type="click" method="delRow"/>
    <af:serverListener type= "jsServerListener"
    method="#{backingBeanScope.backing_check4.submit1}"/>
    <f:facet name="metaContainer">
    <af:resource type ="javascript">
    x=confirm("hi");
    // if(x){
    delRow = function(event){
    AdfCustomEvent.queue(event.getSource(), "jsServerListener", {}, false);
    return true;
    </af:resource>
    </f:facet>
    </af:form>
    </af:document>
    </f:view>
    <!--oracle-jdev-comment:auto-binding-backing-bean-name:backing_check4-->
    </jsp:root>
    the backing bean code is -----
    public class classCheck4 {
    public classCheck4() {
    public String submit1() {
    System.out.println("hello");
    return null;
    }

  • How to call a Oracle Form from within the APEX

    Hi,
    I have a requirment where need to call a oracle form from within the Oracle APEX application?
    I will appriciate if can someone help me out.
    Thanks

    Hi,
    are you working with Forms 6i or 10g?
    If you want to call a forms 10g page. Just use a button with javascript:
    - Target type: URL
    - URL Target: javascript:window.open ('http://<server>:<port>/forms/frmservlet?config=<conf>','Forms window');
    With Forms 6i you can open the directory where your forms file is inside (works just with IE):
    <script type="text/javascript">
    function fnc_window()  {w = open('C:\\FormsFiles', "winLov","scrollbars=yes,resizable=no,width=600,height=400");
    if (w.opener == null)
    w.opener = self;
    </script>Or execute the forms file with vbscript (IE only):
    <script language = "vbscript">
    sub fnc_forms()
    dim progName
    progName = "c:\FormsFiles\myForm.exe"
    set oShell = createobject("wscript.shell") 'create a shell
    '***use the line below to call your app, defined above with the "progName" variable:
    oShell.run(progName)
    end sub
    </script>

  • How to call a EJB method from Session bean method

    Hi all,
    I'm new to J2EE programming. I have a simple doubt .
    I have already created a lookup method for EJB bean in Session bean .
    My question is how to call a method of an ENTITY bean (say insertRow) from SESSION bean method(Say invoke_insertRow) .
    Please provide me an example code .
    Thanks in advance.

    InitialContext ctx = new InitialContext();
         GeneralEditor editor = (GeneralEditor) ctx
                        .lookup("GeneralEditorBean/remote");
              GeneralService service = (GeneralService) ctx
                        .lookup("GeneralServiceBean/remote");
              LanMu lm = new LanMu();
              lm.setName("shdfkhsad");
              editor.add(lm);

  • How to call a static method from an event handler

    Hi,
       I'm trying to call a static method of class I designed.  But I don't know how to do it.  This method will be called from an event handler of a web dynpro for Abap application.
    Can somebody help me?
    Thx in advance.
    Hamza.

    To clearly specify the problem.
    I have a big part code that I use many times in my applications. So I decided to put it in a static method to reuse the code.  but my method calls functions module of HR module.  but just after the declaration ( at the first line of the call function) it thows an exception.  So I can't call my method.

  • How to call Backing Bean method from href tag in JSF. -- URGENT

    Hi guys,
    i am new to JSF. i want one option. how to call a backing bean method from href.
    I searched a lot. i found one component <commandLink>, but i cann't use <commandLink> i have to use only href which is client instructions.
    If anyone knows pls help me. Its Urgent. If u can, give me the code also.
    Suggestions will be appreciated.
    Thanks
    Rajesh

    You can make use of the constructor of the backing bean or the @PostConstruct annotation if you want to use managed properties.
    You may get some ideas out of this: [http://balusc.blogspot.com/2006/06/communication-in-jsf.html].

  • How to call a Oracle Form from within the oracle APEX application

    Hi,
    I am new for Oracle APEX. I have a requirment where need to call a Oracle form (.fmx file) from within the Oracle APEX application.
    Can someone help me out ?
    it would be a great help.
    Thanks

    This might help you...
    http://roelhartman.blogspot.com/2008/11/integrate-oracle-forms-with-apex.html

  • How to call a bean method from html component in jsf

    hi all
    i need a solution for this problem of mine.. actually em working on a jsf application with contains a jsf-jsp having a span containg html button inside my javascript. i want to call a method on click of this button and fetch some data which i have already populated in my bean.how do i do this??? i hv attached a piece of code of d same...
    <script language="JavaScript" type="text/javascript">
    function test(form){
    var Title="DEBIT, gift, Request, TICK";
    var Span=document.createElement("Span");
    Span.style.position="absolute";
    Span.style.left=(parseInt(110)-5)+"px";
    Span.style.top=(+parseInt(274)-5)+"px";
    Span.style.backgroundColor='Red';
    var next=document.getElementById("forImage");
    next.innerHTML="<img src='http://127.0.0.1:9000/action=clusterserve2dmap&sourcejobname=myjob_clusters' />";
    Span.innerHTML="<[input type='button' >";
    document.getElementById("forImage").appendChild(Span);
    any help is highly appreciated

    Hi,
    this gonna be a hack, but here's how it could work
    - you create a Servlet that accesses the FacesContext to obtain a managed bean
    - you issue a XmlHttpRequest from the button to your servlet to obtain the payload
    - show the retrieved values in your HTML
    see http://www.thoughtsabout.net/blog/archives/000033.html for the middle part
    Frank

  • HOW TO CALL A JSP METHOD FROM ANOTHER JSP

    Hi all, I have to JSP1 and JSP2 and i would like to call a method of JS1 from JSP2. Is that possible ??
    Example:
    JSP2 Code
    somewhere in the code ...
    String s = JSP1.getName();
    out.println("EL NOMBRE ES " +s );
    thanks in advance for your help

    No, it is not possible. Infact you cannot write your own methods in JSP. What ever you write in a jsp page is part of _jspService() method. Secondly how can you instantiate another class(generated by JSP), until or unless you know the name of the class that resulted from your JSP. Your JSP page is first converted into .java file which is stored in some package e.g.
    pagecompile.jsp._yourJSPfile.
    I couldnot understand why you need to invoke a method of another JSP in your JSP.
    Hope this helps

  • How to call a class method from a jsp page?

    Hi all,
    i would like to create a basic jsp page in jdev 1013 that contains a button and a text field. When clicking the button, i would like to call a method that returns a string into the text field.
    The class could be something like this:
    public class Class1 {
    public String getResult() {
    return "Hello World";
    How do i go about this?
    Thanks

    Here is a sample:
    HTML><HEAD><TITLE>Test JDBC for Oracle Support</TITLE></HEAD><BODY>
    <%@ page import="java.sql.*, oracle.jdbc.*, oracle.jdbc.pool.OracleDataSource" %>
    <% if (request.getParameter("user")==null) { %>
    <FORM method="post" action="testjdbc.jsp">
    <H1>Enter connection Parameters</H1>
    <H5>Please enter host name:</H5><INPUT TYPE="text" name="hostname" value="localhost" />
    <H5>Please enter port number:</H5><INPUT TYPE="text" name="port" value="1521" />
    <H5>Service nanme:</H5><INPUT TYPE="text" name="service" value="XE" />
    <H5>Please enter username: </H5><INPUT TYPE="text" name="user" />
    <H5>Please enter password</H5><INPUT TYPE="password" name="password" />
    <INPUT TYPE="submit" />
    </FORM>
    <% } else { %>
    <%
    String hostName = request.getParameter("hostname");
    String portNumber = request.getParameter("port");
    String service = request.getParameter("service");
    String user = request.getParameter("user");
    String password = request.getParameter("password");
    String url = "jdbc:oracle:thin:" + user + "/" + password + "@//" + hostName + ":" + portNumber + "/" + service;
    try {
    OracleDataSource ods = new OracleDataSource();
    ods.setURL(url);
    Connection conn = ods.getConnection();
    // Create Oracle DatabaseMetaData object
    DatabaseMetaData meta = conn.getMetaData();
    // gets driver information
    out.println("<TABLE>");
    out.println("<TR><TD>");
    out.println("<B>JDBC Driver version</B>");
    out.println("</TD>");
    out.println("<TD>");
    out.println(meta.getDriverVersion());
    out.println("</TD>");
    out.println("</TR>");
    out.println("<TR><TD>");
    out.println("<B>JDBC Driver Name</B>");
    out.println("</TD>");
    out.println("<TD>");
    out.println(meta.getDriverName());
    out.println("</TD>");
    out.println("</TR>");
    out.println("<TR><TD>");
    out.println("<B>JDBC URL</B>");
    out.println("</TD>");
    out.println("<TD>");
    out.println(meta.getURL());
    out.println("</TD>");
    out.println("<TABLE>");
    conn.close();
    } catch (Exception e) {e.printStackTrace(); }
    %>
    <%-- end else if --%>
    <% } %>
    </BODY>
    </HTML>

  • How to call the EJB methods from servlet/jsp

    Hello ,
    i have write one ejb signOn having the method validateUser(username,password).i can able to call this function from client.java class.i want to know whether i can call this function from servlet.if yes then where to write that servlet and web.xml file.
    At present i m using weblogic server 8.1and i create directory call c:\ejb\demo and put the ejb files(home ,remote,ejb class ,client.java) then i have created .jar file and put in application file.
    Now i want to create a servlet for that i have to create a new directory and put the servlet,web.xml,weblogin-web.xml file and then create one .war file and put in application directory or do some thing extra.Please help me.
    Thanks In Advance
    [email protected]

    I think this might not be the most appropriate forum for your question. You might try a forum about ejb, or weblogic, or jndi.

  • Through Enhancement, how to call a Webdynpro method from another webdynpro?

    I have a standard page with 2 iViews with a standard abap webdynpro in each.
    The first webdynpro needs to refresh the second webdynpro.
    Through enhancement, I tried to follow the solution below:
    first of all in the child component's component controller method(which you want to expose to another component) must be checked in the interface column.
    Double click on the webdynpro project(parent component)->In the used components tab, in the column of component type the child project name(whose method you want to call) and in component usage column give any name->save the project.
    goto the controller(VIEW or COMPONENT) from where you want to call the method->click create controller usage->select the interface controller of the child component->save the project.
    click the code wizard->select method call in used controller->select the child component interface controller ->select the method you want to call.
    Link of thread: Calling a method of other webdynpro component
    But this solution doesn't worked because in this standard webdynpro is not possible to check the method as Interface.
    Is there other way to do this?
    Thanks.

    Hello,
    you can refer the following documentation for portal eventing
    http://help.sap.com/saphelp_nw70/helpdata/en/f6/7d6f4151dc5758e10000000a1550b0/frameset.htm
    Br, Saravanan

Maybe you are looking for