How to call other method using struts

Hi,
in my TestAction.java,
i have 2 method, one is execute(...) and another is changeABC(...)
in jsp,
when i onchange, i call a javascript
function onSwitch()
document.forms[0].action.value = "changeABC";
document.forms[0].submit();
<html:form action="/test.do">
</html:form>
test.do will call TestAction.java and TestActionForm.java.
y when i submit, it keep calling the execute method??
How i suppose to do to enable it call changeABC method??
pls advice.. thanks

hi
i am sending u one plz reply as soon as possible

Similar Messages

  • How to call java method using jsp

    how to call java method using jsp.....
    anyone can help me.....i having problem here...coz i very new in java and jsp.....
    thanks.....

    keep an eye on this person's thread...they have code there and everything.
    http://forum.java.sun.com/thread.jspa?threadID=777263&tstart=0

  • How to call a method using a array of that object?

    hey, another array question
    for example i have 2 classes one name class and a driver
    inside the name class i have method that gets the name
    public Name getName1( ) {return name1;}
    my question is if i created an array of Name objects in my driver with the following line
    Name [ ] n1 = new Name [ ] ;
    and i wanna call methods inside the name class using my array of Name that i created how do i do it?
    thanks in advance

    thanks for the reply Maxx
    another question regarding arrays
    for example if im doing an array of objects Name[ ] n1 = new Name [ ]
    and i have a method that removes the name if its the same as the user input
    if (n1[ i ].getName.equals(myName))
    / / if they equal it removes it,
    else,
    / / the n[ 1 ] stays the same
    ive search the forum for previous questions on this but their examples doesnt seems to work, can anyone help? also if end up using this remove method that checks the elements in n1 if it matches it will remove it what should i do to avoid nullpointerexceptions if i wanna shift it all down?
    thanks in advance

  • How to call a method from a separate class using IBAction

    I can't work out how to call a method form an external class with IBAction.
    //This Works 1
    -(void)addCard:(MyiCards *)card{
    [card insertNewCardIntoDatabase];
    //This works 2
    -(IBAction) addNewCard:(id)sender{
    //stuff -- I want to call [card insertNewCardIntoDatabase];
    I have tried tons of stuff here, but nothing is working. When i build this I get no errors or warnings, but trying to call the method in anyway other that what is there, i get errors.

    Can you explain more about what you are trying to do? IBAction is just a 'hint' to Interface Builder. It's just a void method return. And it's unclear what method is where from your code snippet below. is addNewCard: in another class? And if so, does it have a reference to the 'card' object you are sending the 'insertNewCardIntoDatabase' message? Some more details would help.
    Cheers,
    George

  • How to call  a method of one view in other view

    Hi
      could any one suggest "how to call  a method of one view in other view "
    thanks
    kaushik

    Hi Kausic,
    Its not possible to call a method from view to View.
    Since view is private entity we can not pass the data directly.
    I suggest you to declare the method in Component/Custom controller and call.
    the code is,
    wdThis.wdGet<Component/Custom Name>Controller().<methodName>();
    Regards,
    <b>Ramganesan K</b>

  • How to call a method in onload using jsf

    Hi
    i have task where i neeed to retrive datas from database on page onload . i have written retriving code in backing bean but how to call that
    method on onload in jsf.......
    Can anybody help ???????????
    thanks

    public class firstbean{
         list mylist = new ArrayList();
         firstbean(){
         new firstcontroller().retriveData()
    public class firstcontroller{
         public void retriveData(){
              // I need to get first bean object reference to assign the retived data to my list variable(mylist)
              // but iam getting first bean object object as nulll
              Object object =
                   FacesContext
                   .getCurrentInstance()
                   .getExternalContext()
                   .getSessionMap()
                   .get("FirstBean");
              FirstBean firstBean = (FirstBean)object;
              // firstBean = null its coming
              firstBean.mylist = new FirstDao().getdata();
    this is my code how to implement the onload function in this login . here when i try accesss my first bean reference is showing as null . so aim not able to assign the retrived data in to mylist variable

  • How to call particular method in action class from Portlets StrutsContent

    I am developing a web application which uses weblogic portlets and struts. This is what I have for now in the .portlet file.
    +<netuix:strutsContent action="getStudentList" module = "people/students"+
    refreshAction = "getStudentList" reqestAttrpersistence="none"/>
    I want it to change something like this:
    +<netuix:strutsContent action="getStudentList.do?method=allGrads" module = "people/students"+
    refreshAction = "getStudentLis.do?method=allGrads" reqestAttrpersistence="none"/>
    But this is not working. So how can I achieve something like that?
    Thanks
    Edited by: user13634949 on Jun 23, 2011 1:22 PM
    Edited by: user13634949 on Jun 23, 2011 1:22 PM

    No, i dont know how to call other than main methods from other classes
    And one more doubt i have i.e. Like in C can we see the execution of the program like how the code is being compiled step by step and how the value of the variable changes from step to step like(Add Watch).........

  • How to call a method in one JSP from another JSP?

    say that I have 2 JSPs.
    JSP one has a button.
    JSP two has some method that, say, find the square root of the number passed from JPS one.
    How to - when click - the button on page one call the method on page two?
    Please note that I can not use object binding, but I want passing the actual parameter and call the method on page two.
    Please note that this is an update of a previous post on the same topic called "Object scope".
    Thank you all very much.

    No, i dont know how to call other than main methods from other classes
    And one more doubt i have i.e. Like in C can we see the execution of the program like how the code is being compiled step by step and how the value of the variable changes from step to step like(Add Watch).........

  • How to call a Method in a Program?

    Hello,
    I am very new to the ABAP world.  I have been given a task to call a method if_hrbas_plain_infotype_access~read_single from the class CL_HRBAS_PLAIN_INFOTYPE_ACCESS in a program to see if we can use it to display some employee information.  I don't know how to call a method in a program.  Can somebody please provide me some pseudo code or instructions?
    Thanks.

    Hi Shan,
    here is the code to call a method. while calling the method Instance as 'r_info' which is the type reference to class as specified.
    pass the values to exporting parameters plvar,otype,objid...etc  according  to the requirement
    infotypes: 0002.   " creates an internal table p0002.
    data:
    r_info type ref to CL_HRBAS_PLAIN_INFOTYPE_ACCESS.
    TRY.
    CALL METHOD r_info->if_hrbas_plain_infotype_access~read
       EXPORTING
         plvar           = 
         otype           =
         objid           =
         istat           =
         infty           =
    *     SUBTY           =
         begda           =
         endda           =
         no_auth_check   =  'X'
         message_handler =
       IMPORTING
         PNNNN_TAB       = P0002
    *     HRTNNNN_TAB     =
    *     IS_OK           =
      CATCH CX_HRBAS_VIOLATED_ASSERTION .
    ENDTRY.
    LOOP AT P0002.
          WRITE:/
            P0002-VORNA,
            P0002-NCHMC,
            P0002-NACHN.
        ENDLOOP.
    Regards

  • How to call a method in the servlet from an applet

    I want to get the data for the applet from the servlet.
    How to call a method that exits in the servlet from the applet? I want to use http protocol to do this.
    Any suggestions? Please help.
    thanks

    Now that Web Services is around, I'd look at possibly implement a Web Service call in your applet, which can then be given back any object(s) on return. Set up your server side to handle Web Service calls. In this way, you can break the applet out into an application should you want to (with very little work) and it will still function the same

  • How to display dynamic images using Struts

    I am storing the image name in bean. I want to use the <html:img> tag to display my images. How can i do that using struts.
    Something or sort..
    <html:img src=bean:write name="pageEntry" property="pageImg"/>
    Thank You

    * In your web.xml file, add the struts-html-el.tld definition from the struts\contrib\struts-el\lib directory
    * Add this tag library to your JSP page; something like:
    <%@ taglib uri="WEB-INF/struts-html-el.tld" prefix="html-el" %>* Refer to the following example:
    <html-el:img src="${pageEntry.pagePic}" />* This assumes that pageEntry is a Bean, and pagePic is a bean variable accessed by the getPagePic() method.

  • How to call a method of another class ?

    Hello,
    I�d like to know how to call a method of another class. I have to classes (class 1 and class 2), class 1 instantiates an object of class 2 and executes the rest of the method. Later, class 1 has to call a method of class 2, sending a message to do something in the object... Does anybody know how to do that ? Do I have to use interface ? Could you please help me ?
    Thanks.
    Bruno.

    Hi Schiller,
    The codes are the following:
    COMECO
    import javax.swing.UIManager;
    import java.awt.*;
    import java.net.*;
    import java.io.*;
    import java.awt.event.*;
    import javax.swing.*;
    //Main method
    class comeco {
    public static void main(String[] args) {
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    catch(Exception e) {
    AGORA testeagora=new AGORA();
    // Code for socket
    int port;
         ServerSocket server_socket;
         BufferedReader input;
         try {
         port = Integer.parseInt(args[0]);
         catch (Exception e) {
         System.out.println("comeco ---> port = 1500 (default)");
         port = 1500;
         try {
         server_socket = new ServerSocket(port);
         System.out.println("comeco ---> Server waiting for client on port " +
                   server_socket.getLocalPort());
         // server infinite loop
         while(true) {
              Socket socket = server_socket.accept();
              System.out.println("comeco ---> New connection accepted " +
                        socket.getInetAddress() +
                        ":" + socket.getPort());
              input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
              // print received data
              try {
              while(true) {
                   String message = input.readLine();
                   if (message==null) break;
                   System.out.println("comeco ---> " + message);
    testeagora.teste(message);
              catch (IOException e) {
              System.out.println(e);
              // connection closed by client
              try {
              socket.close();
              System.out.println("Connection closed by client");
              catch (IOException e) {
              System.out.println(e);
         catch (IOException e) {
         System.out.println(e);
    AGORA
    import javax.swing.UIManager;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    import javax.swing.*;
    import java.net.*;
    //public class AGORA {
    public class AGORA {
    boolean packFrame = false;
    //Construct the application
    public AGORA() {
    try {
    Main frame = new Main();
    System.out.println("agora ---> Criou o frame");
    //Validate frames that have preset sizes
    //Pack frames that have useful preferred size info, e.g. from their layout
    if (packFrame)
    frame.pack();
    else
    frame.validate();
    //Center the window
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = frame.getSize();
    if (frameSize.height > screenSize.height)
    frameSize.height = screenSize.height;
    if (frameSize.width > screenSize.width)
    frameSize.width = screenSize.width;
    frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
    frame.setVisible(true);
    catch(Exception e)
    { System.out.println("agora ---> " +e);
    // Tem que criar a THREAD e ver se funciona
    public void remontar (final String msg) {
    try {
                   System.out.println("agora ---> Passou pelo Runnable");
    System.out.println("agora --> Mensagem que veio do comeco para agora: "+ msg);
    Main.acao(msg);
    catch(Exception x) {
    x.printStackTrace();
    MAIN
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import com.borland.jbcl.layout.*;
    import javax.swing.border.*;
    import java.net.*;
    import java.io.*;
    public class Main extends JFrame {
    // ALL THE CODE OF THE INTERFACE
    //Construct the frame
    public Main() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    public void acao() {
    // C�digo para mudar a interface
    Runnable setTextRun=new Runnable() {
    public void run() {
    try {
                   System.out.println("main ---> Passou pelo Runnable");
    TStatus.setText("main ---> Funcionou");
    catch(Exception x) {
    x.printStackTrace();
    System.out.println("main ---> About to invokelater");
    SwingUtilities.invokeLater(setTextRun);
    System.out.println("main ---> Back from invokelater");
    // Aqui vai entrar o m�todo para ouvir as portas sockets.
    // Ele deve ouvir e caso haja alguma nova mensagem, trat�-la para
    // alterar as vari�veis e redesenhar os pain�is
    // Al�m disso, o bot�o de refresh deve aparecer ativo em vermelho
    //Component initialization
    private void jbInit() throws Exception {
    // Initialize the interface
    //Setting | Host action performed
    public void SetHost_actionPerformed(ActionEvent e) {
         int port;
         ServerSocket server_socket;
         BufferedReader input;
    System.out.println("main ---> port = 1500 (default)");
         port = 1500;
         try {
         server_socket = new ServerSocket(port);
         System.out.println("main ---> Server waiting for client on port " +
                   server_socket.getLocalPort());
         // server infinite loop
    while(true) {
              Socket socket = server_socket.accept();
              System.out.println("main ---> New connection accepted " +
                        socket.getInetAddress() +
                        ":" + socket.getPort());
              input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    String espaco=new String(": ");
         JLabel teste2=new JLabel(new ImageIcon("host.gif"));
              PHost.add(teste2);
    System.out.println("main ---> Adicionou host na interface");
              repaint();
    System.out.println("main ---> Redesenhou a interface");
              setVisible(true);
              // print received data
              try {
              while(true) {
                   String message = input.readLine();
                   if (message==null) break;
                   System.out.println("main ---> " + message);
              catch (IOException e2) {
              System.out.println(e2);
              // connection closed by client
              try {
              socket.close();
              System.out.println("main ---> Connection closed by client");
              catch (IOException e3) {
              System.out.println(e3);
         catch (IOException e1) {
         System.out.println(e1);
    public void OutHost_actionPerformed(ActionEvent e) {
              repaint();
              setVisible(true);
    //Help | About action performed
    public void helpAbout_actionPerformed(ActionEvent e) {
    Main_AboutBox dlg = new Main_AboutBox(this);
    Dimension dlgSize = dlg.getPreferredSize();
    Dimension frmSize = getSize();
    Point loc = getLocation();
    dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);
    dlg.setModal(true);
    dlg.show();
    //Overridden so we can exit on System Close
    protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if(e.getID() == WindowEvent.WINDOW_CLOSING) {
    fileExit_actionPerformed(null);
    public void result(final String msg) {
    // C�digo para mudar a interface
    Runnable setTextRun=new Runnable() {
    public void run() {
    try {
                   System.out.println("main ---> Chamou o m�todo result para mudar a interface");
    System.out.println("main --> Mensagem que veio do agora para main: "+ msg);
    TStatus.setText(msg);
    catch(Exception x) {
    x.printStackTrace();
    System.out.println("main --> About to invokelater");
    SwingUtilities.invokeLater(setTextRun);
    System.out.println("main --> Back from invokelater");
    []�s.

  • How to call a method in jsf after stop typing in test box?

    Hi all,
    In my jsf page i have a text box in which user type some text field like "abc". i want after stop the typing i want a method to be called automatically and a datatable will be populated sith some result. my problem is is how to call the method automatically so that the user does not have to click any button after typing in the text box? plz help..
    Edited by: sailajoy on Dec 23, 2008 3:36 PM

    If it is after certain characters that the user types you can ascertain that the entry is done you can use onkeyup and within the javascript count the characters an when the necessary characters are set do the action you need to do.
    There should be some way by which you can suggest that the user has stopped typing i.e. either the max length has reached or the user has hit tab or went to another field. Going on other field too you can bring the focus back to your original field from where the user had hit tab. If you are thinking of something liek google suggest then AJAX is the best way to implement it.

  • How to call java method from workflow script?

    Hi
    I have a requirement of updating field value 'Document Status' based on review/approve of content from Workflow and hence need to update the version number. For that I need to call my java method from workflow during submit of review/approve condition. Please let me know how to call java method from workflow?
    Is there any alternative better way to achive this requirement from workflow? Please suggest.
    Thanks,
    Sarang

    OK. So, I think we can all conclude that you don't need to call any Java method, can't we? And, that wfUpdateMetadata is the command that will update your metadata.
    Now, the question is what are its arguments. It has two - the first is the name of a custom metadata field to be updated (let's suppose that one field is called xMinorVersion, and the other xMajorVersion), the other is the new value, e.g. <$wfUpdateMetaData("xMinorVersion", "New value.")$>As for new value - do you insist on using strings? Since you want to increase the value, it would be more convenient to work with numbers. For instance, with integers you could go with <$wfUpdateMetaData("xMinorVersion", xMinorVersion + 1)$>With strings you will need to convert it to numbers and back to strings. Besides, what happens if you have more than 100 minor versions? (you mentioned you want to add 0.01, but that would finally increase the major version, wouldn't it?) So, I think these two numbers are independent (perhaps, with exception that increase on the major version set the minor version to .00).
    If you want to present it, you can use profiles that will construct for you the representation 2.304 out of MajorVersion = 2, MinorVersion = 304
    Solved?

  • Call trasaction method using o3uici_ppd

    hi all,
      i want to write a call transaction method using o3uici_ppd  but the data must split into two copys . can you tell me how to do.
    please explain with example or coding.

    LOOP AT IT INTO WA.
    REFRESH BDCDATA_IT.
    CLEAR BDCDATA_WA.           "<===============
    bdcdata_wa-program = 'SAPMF02D'.
    bdcdata_wa-dynpro = '0100'.
    bdcdata_wa-dynbegin = 'X'.
    APPEND BDCDATA_WA TO BDCDATA_IT.
    CLEAR BDCDATA_WA.           "<===============
    bdcdata_wa-FNAM = 'BDC_CURSOR'.
    bdcdata_wa-FVAL = 'RF02D-KTOKD'.
    APPEND BDCDATA_WA TO BDCDATA_IT.
    CLEAR BDCDATA_WA.           "<===============
    bdcdata_wa-FNAM = 'BDC_OKCODE'.
    bdcdata_wa-FVAL = '/00'.
    APPEND BDCDATA_WA TO BDCDATA_IT.
    CLEAR BDCDATA_WA.           "<===============
    bdcdata_wa-FNAM = 'RF02D-KUNNR'.
    bdcdata_wa-FVAL = WA-KUNNR.
    APPEND BDCDATA_WA TO BDCDATA_IT.
    CLEAR BDCDATA_WA.           "<===============
    bdcdata_wa-FNAM = 'RF02D-KTOKD'.
    bdcdata_wa-FVAL = WA-KTOKD.
    APPEND BDCDATA_WA TO BDCDATA_IT.
    CLEAR BDCDATA_WA.           "<===============
    bdcdata_wa-program = 'SAPMF02D'.
    bdcdata_wa-dynpro = '0110'.
    bdcdata_wa-dynbegin = 'X'.
    APPEND BDCDATA_WA TO BDCDATA_IT.
    CLEAR BDCDATA_WA.           "<===============
    bdcdata_wa-FNAM = 'BDC_CURSOR'.
    bdcdata_wa-FVAL = 'KNA1-SPRAS'.
    APPEND BDCDATA_WA TO BDCDATA_IT.
    CALL TRANSACTION _____________________.
    ENDLOOP.

Maybe you are looking for

  • Insert values to one table based on a value inserted into another table

    Hi, I've got a form based off a report which creates a new project. I've added an additional process to this form to insert four new values into another table as soon as the new project is created and the PK for that project is generated. This was wo

  • Nokia N8 Flash compatibility with streaming video ...

    Wondering why I can't watch streaming video sites like Justin.tv on my new N8 but can view them just fine on my E71.  When trying to watch a channel on Justin.tv, It states I must upgrade my flash player.  How can my brand new phone's flash not be co

  • CS5 Ext and Bridge 6.3 are now corrupting my Canon cr2 files. Any suggestions?

    Morning All, My machine has just started corrupting some of my cr2 files. I bring them back from the card as well as from my backups and all of a sudden all of the versions are corrupt. I can open them in IrfanView no problem. I can open them in DPP

  • Can't get eth0 to work (via-rhine)

    First some info: I'm using a Biostar M7VIG Pro (via-rhine NIC) motherboard with a Duron CPU. When starting the network 'dhcp' is 'busy' until it times out.  What makes this strange is I ready intalled Rehat on the same system without any problems! I

  • Received recent iOS 8 but unable to install 21/02/2015

    ipad air 2 recent ios8 received 21/02/2015 but can not install the update. iPad is plugged in and full wifi available.  Agreed to all ts & ca but no luck. Any suggestions