Sending variables between classes

hi,
I have a question, in one class, not the main class, I have several data readed from a file and I want to send it to another class for processing.
Any one can give an example how to do it?

     if (event.getSource()==search)
              ID = txtID.getText();
              name = txtName.getText();
             if (ID.equals("Client"))
                 FileReader rf=new FileReader("Client.txt");
               ds =new BufferedReader(rf);
               String namas = ds.readLine();
               int i = Integer.parseInt(namas);
               int ananasas = i*4;
             for(int kaminas = 0; kaminas < ananasas; kaminas++)
                 String lyginam = ds.readLine();
                 if (lyginam.equals(name))
                     String a = ds.readLine();
                     String b = ds.readLine();
                     double ba = Double.parseDouble(b);
                     break;
              if (ID.equals("Employee"))
                    FileReader rf=new FileReader("Employee.txt");
                  ds =new BufferedReader(rf);
                  String namas = ds.readLine();
                  int i = Integer.parseInt(namas);
                  int ananasas = i*4;
                 for(int kaminas = 0; kaminas < ananasas; kaminas++)
                 String lyginam = ds.readLine();
                 if (lyginam.equals(name))
                     String c = ds.readLine();
                     double a = Double.parseDouble(c);
                     String ba = ds.readLine();
                     double b = Double.parseDouble(ba);
                     break;
               new Search();
          }The data(double a, double b, String a, double b) needs to be sent to class called Search in here (depending on what "if" will it fall)
Edited by: ErnestasAbra on May 5, 2009 8:30 AM

Similar Messages

  • Send variables between ICM scripts

    Hi,
    It is a UCCE environment with CVP.
    I have Post Call Survey configured and running.
    In the CVP survey script, I don't want the caller to select again the language.
    Is there a way to send variables between ICM scripts so the language selected in the first CVP script will be sent to ICM script1 then ICM script2 then CVP script2?
    Your help is highly appreciated.
    Thank you in advance
    Lara

    Hi David,
    I still have an issue with the above. In the initial CVP script the customer can choose to listen to announcements without the need to be transferred to an agent. In this case, the Survey script is launched but the call variables are not populated and the language is showing as Null in the log which is causing a bad fetch error.
    Kindly, is there a workaround?
    Thank you in advance.
    Lara

  • How share variables between classes ???

    Hi !
    Basically I have two classes and I would like them to share a variable, I mean, when I modify it on one class the other one is also affected.
    how can I do that ? by using the inheritance principle or is it a simple way so that we don't have one more class??
    thank you a lot for your answer !
    PA

    If you want them to always have the same value, you should have only one variable:public class ClassOne
      private static int theVar = 0;
      public static void setTheVar(int value){theVar = value;}
      public static int getTheVar(){return theVar;}
    public class ClassTwo
      public static int getTheVar(){return ClassOne.getTheVar();}
    }

  • NativeProcess: how to send variables between AIR and C#?

    Hi, how do I make AIR send variables to C#? And how do I make C# send variables back to AIR?
    Please help!

    You can send arguments back  through the standard output of  your c# code.
    maybe this can help ?
    http://www.adobe.com/devnet/air/flex/quickstart/articles/interacting_with_native_process.h tml
    regards,
    Alain

  • How can i pass variables between classes?

    Hi.
    i have three classes and i need use a variable from 'Battleship' and use it in 'BattleWindow', these summaries of the classes, if anyone could give me a solution without editing it too much it would be greatly appreciated
    public class Ship{
    public Ship(){
    int missilesLeft;
    int shots = 10;
    for (int i=0;i<8;i++) {
         missilesLeft = shots - 1;
    //Panel
    public class PanelWindow{
         public static void main (String [] args) { 
         System.out.println(missilesLeft.Ship);
    Andrew

    i still can get it to work.. but i think that you got me quite close;
    this is where i need to get missilesLeft from
    //BattleShip
    public void mouseClicked(MouseEvent e){
         tries--;
         for (int i = 0; i < 8; i++){
          for (int j = 0; j < 8; j++){
           if (e.getSource().equals(buttons[i][j]) && ship[i][j] == true){
            buttons[i][j].setBackground(new Color(80,80,80));
            hit++;
            System.out.println(hit+" "+total);
           else if (e.getSource().equals(buttons[i][j]) && ship[i][j] == false){
            buttons[i][j].setBackground(new Color(0,0,255));
         //Win
          if (isWin()){
           int hits = 64 - tries;
           int misses = hits- hit;
           int score = ((tries+hit)/misses)*64;
           missilesLeft = tries - 30;
           mis = missilesLeft;
           JOptionPane.showMessageDialog(this, "You WIN!\n \nMissiles used: "+hits+"\nMissiles left: "+missilesLeft+"\nHits: "+hit+"\nMisses: "+misses+"\nScore: "+score );
         //Game Over
         if (isGameOver()){
           JOptionPane.showMessageDialog(this, "  GAME OVER!!\n*******************\nYou have run out of missiles!\nTRY AGAIN");
    //BattleWindow
    private void build(){
              main = new JPanel(new BorderLayout());
              title = new JPanel(new FlowLayout(FlowLayout.CENTER));
              right= new JPanel(new FlowLayout(FlowLayout.CENTER));
              left = new JPanel(new FlowLayout(FlowLayout.CENTER));
              bottom = new JPanel(new FlowLayout(FlowLayout.RIGHT));
              displayField = new JTextField("000", 8);
              displayField.setEditable( false );
              b = new Battleship();
              JLabel t = new JLabel("Battleship Potemkin");
              Font myFont =  new Font("Arial",Font.BOLD,32);
              t.setFont(myFont);
              title.add(t);
              help = new JButton("Help");
            exit = new JButton("Quit");     
            help.setFont(new Font("Arial", Font.BOLD, 17));
            exit.setFont(new Font("Arial", Font.BOLD, 17));
            displayField.setFont(new Font("Arial", Font.BOLD, 22));
              main.add(title,BorderLayout.NORTH);
              main.add(left,BorderLayout.WEST);
              main.add(right,BorderLayout.EAST);
              main.add(bottom,BorderLayout.SOUTH);
              main.add(b,BorderLayout.CENTER);
             this.add(main);
              help.addMouseListener(this);
              exit.addMouseListener(this);
              bottom.add(displayField);
              bottom.add(help);
              bottom.add(exit);
              setSize(500,600);
              setResizable(false);
              String aString = Integer.toString(bob);
              displayField.setText(displayField.getText() + bob);
              //displayField.setText("bob");
              }the variable bob in must have the same value as missilesLeft
    thank you

  • Sending variables between swfs

    I'm loading one swf into another and trying to send a
    variable to the loaded swf. I'm using the code at the bottom to
    load the swf and send the variable. In the loaded swf I'm using:
    [Bindable] public var myName:String
    Then in a function:
    myName = Application.application.parameters.loginID;
    trace("loginID="+myName)
    This fails to load. Can anyone tell me what I'm doing wrong?
    Thank you!

    "SiHoop" <[email protected]> wrote in
    message
    news:gnvnor$105$[email protected]..
    > I'm loading one swf into another and trying to send a
    variable to the
    > loaded
    > swf. I'm using the code at the bottom to load the swf
    and send the
    > variable. In
    > the loaded swf I'm using:
    > [Bindable] public var myName:String
    > Then in a function:
    > myName = Application.application.parameters.loginID;
    > trace("loginID="+myName)
    > This fails to load. Can anyone tell me what I'm doing
    wrong? Thank you!
    If you look at this example:
    http://flexdiary.blogspot.com/2009/01/example-of-casting-contets-of-swfloader.html
    You will see examples of loading two different types of swfs
    and calling a
    method on each one. Please remember that a setter is also a
    method, so the
    technique should work to allow you to set a variable as well.

  • Help: I am trying to pass a variable between classes

    I am trying to pass data in a variable inbetween two classes is there any suggestions as to how to do this? Here is a example of the code I am trying to pass MqMessage to the class MqLog.
    if(MqMessage.equals("END"))               
                                       finalize();
                                       System.exit( 0 );
                             else //else build flat file and launch docusolve
                                       MqLog tempMqLog = new MqLog();
                                       tempMqLog.levelThreeDiagnostic();
                                       aRuntime = null;
                                       aProcess = null;                                   
                                  }

    I don't really undestand what you are asking specifically. If you only want to transfer a value from one Object to another Object, then you should just use a set method:
    if (objectOne.getValue().equals("END"))
    end();
    else
    objectTwo.setValue(objectOne.getValue())

  • Accessing a public variable between classes

    Hi there,
    I've got two classes running...one is a document class (EgoGame.as) and another is a class linked to several similar movie clips (Ball.as).
    I'm trying to access a public variable from Ball.as which has been declared in the doucment class EgoGame.as.
    When I run the test the outputs states the following...
    1120: Access of undefined property _ballPlaced.
    Here's my code.  What I'm trying to do is remove the event listeners from the Ball.as when the _ballPlaced variable is true, so that the user can't drag and drop the balls after they've been placed in a zone....any pointers greatly appreciated!
    Document Class
    EgoGame.as
    package
        import flash.display.MovieClip;
        import flash.display.DisplayObject;
        import flash.events.MouseEvent;
        import Ball;
        public class EgoGame extends MovieClip
            public var __zoneFull:Array = new Array(false, false, false);
            public var __ballPlaced:Array = new Array(false, false, false);
            public function EgoGame()
                ball0_mc.addEventListener(MouseEvent.MOUSE_DOWN, zoneEmpty);
                ball1_mc.addEventListener(MouseEvent.MOUSE_DOWN, zoneEmpty);
                ball2_mc.addEventListener(MouseEvent.MOUSE_DOWN, zoneEmpty);
                ball0_mc.addEventListener(MouseEvent.MOUSE_UP, zoneFill);
                ball2_mc.addEventListener(MouseEvent.MOUSE_UP, zoneFill);
                ball1_mc.addEventListener(MouseEvent.MOUSE_UP, zoneFill);
                ball0_mc.addEventListener(MouseEvent.MOUSE_UP, playMovie);
                ball1_mc.addEventListener(MouseEvent.MOUSE_UP, playMovie);
                ball2_mc.addEventListener(MouseEvent.MOUSE_UP, playMovie);
            private function zoneEmpty(event:MouseEvent):void
                if(event.target.hitTestObject(zone0_mc) && _zoneFull[0] == true)
                    _zoneFull[0] = false;
                    _ballPlaced[event.target.name.substring(4,5)] = false;
                else if(event.target.hitTestObject(zone1_mc) && _zoneFull[1] == true)
                    _zoneFull[1] = false;
                    _ballPlaced[event.target.name.substring(4,5)] = false;
                else if(event.target.hitTestObject(zone2_mc) && _zoneFull[2] == true)
                    _zoneFull[2] = false;
                    _ballPlaced[event.target.name.substring(4,5)] = false;
                else
                    event.target.x = event.target._startX;
                    event.target.y = event.target._startY;
                    _ballPlaced[event.target.name.substring(4,5)] = false;
            private function zoneFill(event:MouseEvent):void
                if(event.target.hitTestObject(zone0_mc) && _zoneFull[0] == false)
                    event.target.x = zone0_mc.x;
                    event.target.y = zone0_mc.y;
                    _zoneFull[0] = true;
                    _ballPlaced[event.target.name.substring(4,5)] = true;
                else if(event.target.hitTestObject(zone1_mc) && _zoneFull[1] == false)
                    event.target.x = zone1_mc.x;
                    event.target.y = zone1_mc.y;
                    _zoneFull[1] = true;
                    _ballPlaced[event.target.name.substring(4,5)] = true;
                else if(event.target.hitTestObject(zone2_mc) && _zoneFull[2] == false)
                    event.target.x = zone2_mc.x;
                    event.target.y = zone2_mc.y;
                    _zoneFull[2] = true;
                    _ballPlaced[event.target.name.substring(4,5)] = true;
                else
                    event.target.x = event.target._startX;
                    event.target.y = event.target._startY;
                    _ballPlaced[event.target.name.substring(4,5)] =false;
            private function playMovie(event:MouseEvent):void
                if (_ballPlaced[0] == true)
                    ball0_mc.gotoAndPlay(2);
                else
                    ball0_mc.gotoAndStop(1);
                if (_ballPlaced[1] == true)
                    ball1_mc.gotoAndPlay(2);
                else
                    ball1_mc.gotoAndStop(1);
                if (_ballPlaced[2] == true)
                    ball2_mc.gotoAndPlay(2);
                else
                    ball2_mc.gotoAndStop(1);
    Ball.as
    package
        import flash.display.MovieClip;
        import flash.events.MouseEvent;
        import flash.display.DisplayObject;
        import EgoGame;
        public class Ball extends MovieClip
            // public var _hitTarget:MovieClip;
            public var _startX:Number;
            public var _startY:Number;
            public function Ball()
                _startX = this.x;
                _startY = this.y;
                this.buttonMode = true;
                this.addEventListener(MouseEvent.MOUSE_DOWN, dragIt);
                this.addEventListener(MouseEvent.MOUSE_UP, dropIt);
            private function dragIt(event:MouseEvent):void
                this.startDrag();
            public function dropIt(event:MouseEvent):void
                this.stopDrag();
            public function lockBall(event:MouseEvent):void
                if(_ballPlaced[this.name.substring(4,5)] == true)
                    this.removeEventListener(MouseEvent.MOUSE_DOWN, dragIt);
                    this.removeEventListener(MouseEvent.MOUSE_UP, dropIt);

    every place you have a ball reference you can access the lockBall() method.  so, if ball0_mc is a Ball class member, you can use:
    ball0_mc.lockBall();

  • Sharing variables between classes

    Hi,
    I wrote a class to handle button functionality. I want the
    onPress event in this class to play a movieclip that is sitting in
    my .fla file, also access some boolean values in the .fla.
    What's the best way to implement this?

    Best practice is to avoid directly accessing non-static final fields of other classes - they should generally by private or if necessary protected.
    get/set methods are the usual way to do this. You can use public static final fields without having a getter.
    Static in the context of field definition identifies fields which exist at the class scope (1 copy per class) versus those (non-static) which exist at the instance scope (1 copy per instance of the class).
    If the value you want to share instance-speciifc, use a non-static field backed up by non-static get/set methods. If you want one copy per process, static fields with static get/set methods are best.
    Chuck

  • Can I share Attributes/Variables between 2 different Class Driver Sessions?

    I am designing a Simulator of Instrumentation following these steps:
    1) re-programming, re-compiling, and re-building the DLLs from the advanced class simulation drivers included in IVI Driver Toolset 2.0 using LabWindows/CVI 7.0;
    2) then i create a VI in LabVIEW 7.0 which calls an IVI Class Driver obtaining the desired simulated output data.
    My problem is that I need to share variables between different DLLs in LabVIEW.
    I want to simulate a circuit which consists of a battery and a resistor. I've got 2 instruments: a DC Power Supply and a Digital Multimeter.
    The DC Power Supply acts as the battery providing a certain voltage level, and the Multimeter measures the Voltage and the Current in the resistor.
    I've designed a VI in LabVIEW which uses 2 different sessions: one which calls the class driver IviDCPwr, and the other one which calls IviDmm.
    I wish to be able to access the attributes from "nisDCPwr.c" in the file "nisDmm.c".
    For example, to write a line like this:
    Ivi_GetAttributeViReal64 (ViSession vi, ViConstString channelName, NISDCPWR_ATTR_MEASUREMENT_BASEV, 0, &reading));
    inside the source code "nisDmm.c" of the advanced class simulation driver.
    The problem is that the only ViSession accessible from nisDmm is the handle from the Digital Multimeter, but not from DC Power Supply.
    Would this be possible? Is it "legal"?
    I've tried another approach through the declaration of external variables, but unfortunately I get a run-time error in LabVIEW.
    The only solution I've found is using auxiliary files going between, through the functions included in the Low Level I/O Library .
    Nevertheless, the solution proposed above would result much more convenient, faster and safer in my application.
    I hope everyone has understood my question, and anyone can help.
    THANK YOU VERY MUCH FOR YOUR TIME!!!

    Doesn't anyone have an answer?
    Or any proposal?
    Or even a clue?
    THANKS!

  • Share variables between JSP and Classes

    Hello !
    Is there any way to share the same variables between JSP�s and Classes?
    For example...
    I have 20 variables in a JSP page (with values, like constants...) and I want to view their contents inside the classes...
    Is there any way? Maybe a import or something like this...
    Thanks,
    Igor.

    If you search the forums you will find many answers to your questions. You can also try the servlet and JSP short courses listed below;
    Here is lthe link that will take you to the Java.sun.com Tutorial pages.
    http://developer.java.sun.com/developer/onlineTraining/
    Here is a tutorial on Servlets
    http://developer.java.sun.com/developer/onlineTraining/Servlets/Fundamentals/contents.html
    Here is the tutorial on the JSP
    http://developer.java.sun.com/developer/onlineTraining/JSPIntro/contents.html

  • ActiveX in BradySoft (CodeSoft) - What Class/Method/Object's would I use to send variable form data to BradySoft?

    What Class/Method/Object's would I use to send variable form data to BradySoft? I have a basic label setup in BradySoft and I want to send it variable form data (a serial number) from Labview ActiveX. I have attached Brady's ActiveX programmers guide but can't figure out what to use for this. P.S. I would call Brady or TekLynx tech support about this but they have a strict policy whereas BradySoft supports ActiveX but their tech support doesn't provide programming help with it. I figured I'd try the NI Forums.  

    Aaronb, I presume by publishing an ActiveX programmers manual the BradySoft software installs Active X objects. You may choose to interact with these objects within LabVIEW using Active X controls. The following link will provide a starting point for LabVIEW help topics on Active X communication: Select ActiveX Object Dialog Box
    http://zone.ni.com/reference/en-XX/help/371361F-01/lvdialog/insert_active_x_object/
    Building a Simple Web Browser Using ActiveX (Example of ActiveX arcitecture)
    http://zone.ni.com/devzone/cda/epd/p/id/81 Hope this helps provide a bit of guidance. Cheers!  

  • How to use a variable between interfaces or class?

    Hello All;
    Far by now I can say that the forum is very helpful for me. Thanks for all the people who have the time and generosity to help our problems. Thank you.
    Unfortunately I have a problem <Again :( >
    I want to use a variable in two different *.java files.
    Is it possible?
    The Variable i want to use is; int CiftSayisi
    The variable is declared in the CamCalib.Java under a button's Action Listener.
    Here is the code;
    public void actionPerformed(ActionEvent arg0) {
                        ImagePair.main(null);
                        String[] ImPath = list.getItems();                                           //Storing Items in an Array
                        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();                     //Dimensions of the Screen Storing in an object
                        int ScreenHeight = dim.height;                                           //Definition ScreenHeight
                        int ScreenWidth = dim.width;                                          //Definition ScreenWidth
                        // System.out.println(ScreenHeight);                                                    //Testing of the Dimensions
                        // System.out.println(ScreenWidth);                                                     //Testing of the Dimensions
                        int CiftSayisi = ImPath.length -1 ;
                        if (CiftSayisi == 0){
                             System.out.println("Added Images do not Construct a Pair");
                        else {
    }Now i want to use it in another java file which is ImagePair.Java in the loading part of the interface;
                 setType(Type.UTILITY);
              setTitle("Image Pair Selection");
              setResizable(false);
              setAlwaysOnTop(true);
              setBounds(100, 100, 450, 68);
              contentPane = new JPanel();
              contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
              setContentPane(contentPane);
              contentPane.setLayout(null);
              textField = new JTextField();
              textField.setBounds(61, 11, 22, 20);
              textField.setEditable(false);
              textField.setEnabled(false);
              contentPane.add(textField);
              textField.setColumns(2);I have a text field in here that i need to fill with the value of CiftSayisi
    Any help please?
    ömer kaya
    METU-GGIT
    Edited by: Ömer K. on Apr 10, 2012 12:43 AM

    I didn't bother reading the code, since you didn't format it.
    But to answer your question (if I understand it correctly), yes, it is possible to pass variables between different object instances (not from an interface specifically, since interfaces don't have members). The simplest way to pass the variable as an argument to a method or constructor. If these aren't available, you could create a static global variable, though in a multithreaded app you'd have to synchronize access.

  • Sharing a shared network variable between two PC's connected to a network

    Sharing a shared network variable between two PC's connected to a network
    Surely this shouldn’t be so difficult! I have a little LabVIEW program running in the background of PC1. The exe’s task is to collect and send OPC variables held on a SCADA system and convert them to shared network variables (as I thought that they would be easy to share over a network, easier than the nasty OPC and DCOM issues). I have PC2 which runs measurement studio and I have created a nice test VB program which either writes or reads the network variables which are on PC1. The PC1 collection software is working perfectly and when I change the values on the SCADA system I can see the network variable change on ‘NI Distributed System Manager’. I When I look at ‘NI Distributed System Manager’ on PC2 I can’t see PC1 on the list and when I use the basic measurement studio code below to read the network variable it times out at the TestVariable.connect() line.
    Ok so what do I need to do to read a shared network variable sat on PC1 from PC2 on the network
    Public Class Form1
    Private WithEvents TestVariable As NetworkVariableSubscriber(Of Double)
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    TestVariable = New NetworkVariableSubscriber(Of Double)("\\192.168.58.139\Test\TestVariable")
    TestVariable.Connect()
    End Sub
    Private Sub TestVariable_Data_Updated(ByVal sender As System.Object, ByVal e As NationalInstruments.NetworkVariable.DataUpdatedEve​ntArgs(Of Double)) Handles TestVariable.DataUpdated
    TextBox1.Text = e.Data.GetValue
    End Sub
    End Class

    Sorry lost all the formatting
    Surely this shouldn’t be so difficult! I have a little
    LabVIEW program running in the background of PC1. The exe’s task is to collect
    and send OPC variables held on a SCADA system and convert them to shared
    network variables (as I thought that they would be easy to share over a
    network, easier than the nasty OPC and DCOM issues). I have PC2 which runs
    measurement studio and I have created a nice test VB program which either
    writes or reads the network variables which are on PC1. The PC1 collection
    software is working perfectly and when I change the values on the SCADA system
    I can see the network variable change on ‘NI Distributed System Manager’. I
    When I look at ‘NI Distributed System Manager’ on PC2 I can’t see PC1 on the
    list and when I use the basic measurement studio code below to read the network
    variable it times out at the TestVariable.connect() line.
    Ok so what do I need to do to read a shared network variable
    sat on PC1 from PC2 on the network
    Public Class Form1
        Private
    WithEvents TestVariable As NetworkVariableSubscriber(Of Double)
    Private Sub Form1_Load(ByVal sender As System.Object,
    ByVal e As System.EventArgs) Handles MyBase.Load
    TestVariable = New NetworkVariableSubscriber(Of
    Double)("\\192.168.58.139\Test\TestVariable")
    TestVariable.Connect()
    End Sub
    Private Sub TestVariable_Data_Updated(ByVal sender As
    System.Object, ByVal e As
    NationalInstruments.NetworkVariable.DataUpdatedEve​ntArgs(Of Double)) Handles
    TestVariable.DataUpdated
    TextBox1.Text = e.Data.GetValue
    End Sub
    End Class 

  • Using HttpServletRequest object to share variables between static methods.

    Does anyone know of the overhead/performance implications of using the HttpServletRequest object to share variables between a static method and the calling code?
    First, let me explain why I am doing it.
    I have some pagination code that I would like to share across multiple servlets. So I pulled the pagination code out, and created a static method that these servlets could all use for their pagination.
    public class Pagination {
         public static void setPagination (HttpServletRequest request, Config conf, int totalRows) {
              int page = 0;
              if (request.getParameter("page") != null) {
                   page = new Integer(request.getParameter("page")).intValue();
              int articlesPerPage = conf.getArticlesPerPage();
              int pageBoundary = conf.getPageBoundary();
                int numOfPages = totalRows / articlesPerPage;  
                // Checks if the page variable is empty (not set)
                if (page == 0 || (page > numOfPages && (totalRows % articlesPerPage) == 0 && page < numOfPages + 1)) {    
                 page = 1;  // If it is empty, we're on page 1
              // Ex: (2 * 25) - 25 = 25 <- data starts at 25
             int startRow = page * articlesPerPage - (articlesPerPage);
             int endRow = startRow + (articlesPerPage);           
             // Set array of page numbers.
             int minDisplayPage = page - pageBoundary;
             if (minDisplayPage < 1) {
                  minDisplayPage = 1;     
             int maxDisplayPage = page + pageBoundary;
             if (maxDisplayPage > numOfPages) {
                  maxDisplayPage = numOfPages;     
             int arraySize = (maxDisplayPage - minDisplayPage) + 1;
             // Check if there is a remainder page (partially filled page).
             if ((totalRows % articlesPerPage) != 0) arraySize++;
             // Set array to correct size.
             int[] pages = new int[arraySize];
             // Fill the array.
             for (int i = 1; i <= pages.length; i++) {
                  pages[i - 1] = i;
             // Set pageNext and pagePrev variables.
             if (page != 1) {
                  int pagePrev = page - 1;
                  request.setAttribute("pagePrev", pagePrev);
             if ((totalRows - (articlesPerPage * page)) > 0) {
                 int pageNext = page + 1;
                 request.setAttribute("pageNext", pageNext);
             // These will be used by calling code for SQL query.
             request.setAttribute("startRow", startRow);
             request.setAttribute("endRow", endRow);
             // These will be used in JSP page.
             request.setAttribute("totalRows", totalRows);
             request.setAttribute("numOfPages", numOfPages);
             request.setAttribute("page", page);
             request.setAttribute("pages", pages);          
    }I need two parameters from this method (startrow and endrow) so I can perform my SQL queries. Since this is a multithreaded app, I do not want to use class variables that I will later retrieve through methods.
    So my solution was to just set the two parameters in the request and grab them later with the calling code like this:
    // Set pagination
    Pagination.setPagination(request, conf, tl.getTotalRows());
    // Grab variables set into request by static method
    int startRow = new Integer(request.getAttribute("startRow").toString());
    int endRow = new Integer(request.getAttribute("endRow").toString());
    // Use startRow and endRow for SQL query below...Does anyone see any problem with this from a resource/performance standpoint? Any idea on what the overhead is in using the HttpServletRequest object like this to pass variables around?
    Thanks for any thoughts.

    You could either
    - create instance vars in both controllers and set them accordingly to point to the same object (from the App Delegate) OR
    - create an instance variable on the App Delegate and access it from within the view controllers
    Hope this helps!

Maybe you are looking for

  • Calling abap method in xslt mapping?

    Hi I need to call abap method in my xslt mapping , i tried with <sap:external-call >and <sap:external-function> . But it is giving short dump error. Can anybody give me proper syntax.. thanks Prasad

  • Sending a max of 8 SMS messages at one time?

    Is it just me or is this happening to anyone else? You used to be able to send texts to much more than 8 contacts at one time. Is there an explanation for why this is happening? Please give me your thoughts and feedback. Thanks.

  • Adobe Reader LE 1.5 and Deleting Recent Documents

    On my E71, I am having difficulty deleting PDFs from the Reader's recent document list. There is no option to remove them, and the files don't seem to be stored anywhere in the filesystem that I can get to via Bluetooth or the File Manager. Any ideas

  • Help to configure a ppp connection with modem

    Solaris 8 (Intel) Modem connect with ttya Thanks

  • How can I use normal JSP-Scripting in Studio Creator pages ?

    Hello, if I try to integrate for example <jsp:scriptlet> for(int i=0; i < 10; i++) { out.println("Txt: " + i); </jsp:scriptlet> in my JSP Page it dosn't wok because the IDE complains that the jsp-document isn't wellformed due to the < sign. If you re