Can we create multiple instances of a Bean in a JSP file?

Hi,
I am new to JSP & Servlets programming.
I need to write a servlet that connects to a database via JDBC ( using IBM DB2 dbms) , sets some Beans with the tuples in the relevant table.
Then, I need to have a JSP "read" ( or "get") info from the Beans & display the contents to the client.
( At a time only 5 tuples must be visible in the UI , with Next & Prev links ...)
I am using Tomcat 4.0 for this...
Can any one please help me regarding HOW to go abt it ?
Esp., should we create 1 instance of a Bean , ( say "DataBean") for EACH tuple , or is there a way to do it with only 1 instance...
Please, guide me... ( if not possible, at least give me some hints to some GOOD resources ( books, sites,etc.), that deal with this kind of applications)
Thanks,
Raghu.

Once again, thanx a lot for your detailed help -- evnafets !!
I think I am gaining in my knowledge of JSP & Servlets thanks to your help...
Now, I am tackling the issue of selecting the BEST way of "STORING" which "PAGE" no. I am displaying.
Say, I have only 15 tuples(ROWS), & with 5 tuples displayed per page, I have to have 3 "pages", & I need to accomplish the handling of "Prev" & "Next" links using only 1 Servlet & 1 JSP ( apart from the Authorization servlet ).
I am thinking of storing a "session-scoped" variable called "page-num". Do you think it's the best way?
Or should I score it as an "application-scoped variable" ( i.e., in the ServletContext ...) ??
Also, I have got no clues as to which of the following would be a better idea :
(a) Fetch ALL the tuples in the table & set as many beans. And then display the corresponding 5 tuples in each page.
Here, more bean instances are needed to hold the data which gets repeatedly passed around ( when Prev & Next links are clicked ).
OR ..
(b)Fetch only 5 tuples at a time . I think this may be done by creating a scrollable Resultset & then moving around to the appropriate ROW by saying
resultSet.absolute( (page_num - 1)*5 + 1 ); & then fetching 5 tuples relative to this row.
In this case I will need atmost 5 Bean objects per request.
And YES, one more thing , WOULD you PLEASE try & give me some guidance towards some good references to JSP, Servlets & J2EE ? ( Links, Books, anything ! )
Sorry for the TROUBLE I gave, but THANKS a lot for the TROUBLE u took ! ;-)
Thanks & Regards,
Raghu

Similar Messages

  • JSP-can i reuse the instance of a bean in another .jsp file

    am having a bean like clsStudent and i have used the usebean tag and setproperty to set all the values of the same bean. then i want to access the contents in the instane of clsStudent in another .JSP file.

    That doesn't sound like you're doing it right. Beans, like any java class, are actually defined in Java, and class files placed in the WEB-INF directory (By the way class names should be capitalised).
    JSPs shouldn't be populating beans, they should be generating HTML based on them. If you're loading form data into a bean use a servlet.
    That said there's no problem referencing beans in multiple JSPs, but you have to pay attention to how the actual reference gets into the JSP. This is done through "scope" on useBean. Generally a Servlet builds a bean and places it into the request attributes, then forwards to a JSP to format the HTML.

  • Can I create multiple instances of  realplayer plug-in in one jsp page?

    I want to play meny video files in one jsp web page, these video files are to be played with the embeded plug-in of realplayer, each plug-in was linked(use its SRC property) a different video file. But, to my surprise, when I press the play button, every player played the same video file,not its specified file.
    I have no idea why it did so and what can I do?
    Whether can I create multiple instances of realplayer plug-in in one jsp page, that is to say, each instance is independent of others?
    thanks in advance!

    Generally speaking, Internet Explorer tries not to launch multiple versions of a plug-in. So what's happening is that you load the first video clip, and then before it has a chance to play, you load the second video clip into the same window. (It's like changing songs in WMA.)
    In some cases - this may not work for Real Player, but it's worth trying - if you spawn a new window through a hypertext link and then launch the plug-in in that window, IE will treat it separately. Otherwise, you could not, for example, run two Macromedia Flash applications from different web sites at the same time.
    Keep in mind that only one program can access the soundcard at a time, so Real Player may purposely "pause" or "cancel" other video streams until the active one finishes. If you were using the desktop version, selecting another video by any means aborts the currently running video (i.e., RP won't let you create a separate instance of it).
    The easiest solution is to create a wrapper JSP file that takes the name of the video clip, and plays it. Call that JSP and specify that it should be opened in a new window via the TARGET keyword in the anchor tag. Then hopefully RP itself won't block a second window from running.

  • In Oracle 9 Application Server can we create multiple instances???

    Hi I need one help this is regarding to the oracle 9 application server in this can we create the multiple instances??
    my application was already developed and currently it is working with one instance for this i need to create the another one more instance which is same as existing and my application is web application developed in Forms6i and the db is oracle 9i my requirement is to create one more instance what are all the configuration files need to be modified and please give this info ASAP....

    It is still not very clear. What do you mean by creating "one more instance of the same application in the same application server"? By "application" do you mean another instance of OC4J in same Application Server Instance? If yes, you can do that. I mean you can create another OC4J component in same Application Server Instance without doing another installation. Refer this for details:
    http://download.oracle.com/docs/cd/A97329_03/core.902/a92171/config.htm#1010793
    If you are looking to create another Application Server Instance out of same installation/binaries (i.e. Oracle Home) than the answer is no. You can not create multiple Application Server Instances out of one Oracle Home. You will have to do another installation in a different Oracle Home and that's how you will get another Application Server Instance.
    Hope this helps.
    Thanks
    Shail

  • Can we have Multiple Instance on same Node in Oracle 10g RAC

    Hi All,
    I am planning to implement the RAC in Oracle 10g.Before that i have one doubt regarding RAC.
    My question is "Can we create multiple Instance on Same node(Server) ?"
    is it possible.
    Any ideas or thoughts would be apperciable.
    Thanks in Advance.
    Anwar

    This is where it is important to keep the separation between 'database' and 'instance'.
    A database is the set of files that contains the data (and the redo, control files, etc). A database does nothing by itself, other than take up lots of disk space.
    An instance is theCPU cycles (running software) and the memory to control the database.
    In Oracle RAC, you can have as many instances controlling one database [at the same time] as you want (within reason). Each instance must be able to access the disk(s) that contains the database.
    These multiple instances can be on the same computer (effectively taking up a lot of server memory and CPU for nothing) or they can be on separate computers.
    If they are on separate computers, the disk subsystems must be able to be shared across computers - this is occasionally done using operating system clusterware and is the main reason why clusterware is required at all. (This is also the toughest part of the pre-requisites in setting up a RAC and is very vendor dependent unless you use ASM.)
    These instances need a communication connection to coordinate their work (usually a separate network card for each computer) so they do not corrupt the disk when they are trying to access the same file, and possibly the same block, at the same time.
    In a RAC configuration, instances can be added, started, running, stopped and removed independent of each other (allowing a lot of high availability) or can be started and stopped as a group.
    Each instance gets it's own SID, which is in no way any different than a non-RAC SID. It's just the name of a service that can be invoked. The neat thing is that the SID
    a) helps the DBA keep things straight by lettiung us talk about 'instance A' (the Oracle software to be running over on computer A) vs 'instance B' when starting, stopping and managing;
    b) helps the application by providing targets that can be listed in the TNSNAMES.ORA [against one service alias], which is used by ORacle Networking to provide automated load balance or failover (instance/SID a is not available, I guess I'll try the next in the list)
    Hope that helps the concept level a bit.

  • Creating multiple instances for a single file in B2B

    Hi,
    I have a requirement to read the camt.053 file from the remote partner using Oracle B2B and send the file to oracle AIA and insert the data in the ERP database tables. I am able to read the file successfully through B2B using listening channel and send the data to AIA and insert the data in ERP tables but, if there is any error occured while inserting the data in the ERP tables it is creating multiple instances(6 message count) for the same file in B2B reports. where as it is creating only one entry in reports in case of successful insertion. I have not given any retry count in listening channel nor in the database adapter in SOA/AIA composite. I am confused from where B2B is retrying the message ? Do i need to set any system properties? Could you please guide me to resolve this issue?
    Regards,
    Nishanth.

    App message delivery is not retried in B2B, rather failed messages are delivered to the IP_IN_QUEUE. Please enable the logging for B2B engine in TRACE 32 mode and run a test to reproduce the behaviour. Post the log here or mail across to my id (in my profile).
    Regards,
    Anuj

  • How can I force TestStand to create multiple instance of an activex server instead of share the same reference?

    Hi, All:
         I am trying to migrate a application coded by VC++ to TestStand+CVI. This application opens multiple serial com ports and send commands to test targets, and get responses from these targets. The VC++ application creates multiple thread, and every thread create an activeX server instance which is responsible for opening serial port,sending test commands ,and getting response. It works fine as every thread has itsown activeX instance, so data and commands can be handled in the right serial port successfully.
         Yet when I works on TestStand, I got problems. I choose parallel model as the process model. I create a activeX object reference with AxtiveX/COM Adapter, and store the reference in a sequence local varialbe. If there is only 1 testsocket, It is OK. But if there are multiple test sockets, and communication between the application and test targets will be directly to the last test target. I try to popup a message within a execution to indicate the value of the activeX object reference, and all of them are identical. But this is not the behavior I want.
        So, is it possible to force TestStand to create independent instances of an activeX server? How can I make it work?
    Thanks

    Thanks for your comment, Dan.
          Yet I do get problems as none of us know how to program an activeX server so that it can be forced to be a single-instance or multiple-instance.
    As I mentioned earlier, there is existing application which is written by VC++ can create multiple instances of this activeX server, all I have to do is to create multiple threads, and initiate an instance of this server to contrl multiple test targets.
         My colleague said he creates the server with VC++ ATL, and cofigure it to be dual-interface and STA. And in the VC++ application side(client side), I use smart-pointer in threads to create an instance of the server:
     IMySerialServer pIMySerialServer;
      HRESULT hr = pIMySerialServer.CreateInstance("UUTCmd.MySerialServer");
      if(FAILED(hr))
       AfxMessageBox("Fail to create instance.");
    And then I got multple instances of the activeX server. Every thread can have itsown com port, can send/receive commands indepently. I have no idea how can I make it work on TestStand. Would you show me some reference documents or sample codes?
    Thank you
    Cipher

  • How to create multiple instance on same database

    Hi ,
    I would like to know how to create multiple instance on same database . I know that some people use database configuration assistant to do this but i could not figure out how they did it.
    Any how if some one can help me with this and can give me links of this it would be great help for me.
    Thank you for reading my problem and helping me !
    Amil
    please if possible mail me on [email protected]

    How to create multiple instance?????Do you mean multiple instances on the same database, or multiple databases on the same machine ?
    I m new to this field....
    Willin to learn a lot about oracle....Then it wouldn't be bad reading a bit of Database Concepts

  • Can i create an instance of a jar file?

    Actually,i'm creating a combobox component.For tht i've written a java class,in tht calss i read the javascript code and create an instance of the java class n render tht code.If i want to give this java file and javascript file i need to jar it.i have done tht also but i can't create the instance of tht java class from the jar .can u help me out?
    Thanks in advance.

    Hey thanks so much for the reply.
    Let me tell you the exact scenario. I'm actually developing a struts-application. Hope I can get some help here too.
    I have:
    1. login.jsp-where user logs in.
    -I have a userid and a password as default values for each unique user.
    Where should i store these details -in HashMap??
    -How can I display error messages if userId/passWord is invalid on login.jsp page ??
    2. confirmation.jsp-on successful login, he's shown his details:
    YOur first name: .........
    Your last name: ........ etc.
    -Here I can't use bean:write tag to read from form-bean.
    - how do i display it here without using a scriptlet ?
    3. LoginAction.java
    -Here i will get userId and passWord from LoginFormBean.java setter
    and getter methods.
    -For all validations' results, should i call a boolean getUserDetails() method from form-bean, wherein i can map values(first name, last name etc ) to each key (userid) ?
    i can use methods like:
    if (isValidUserId && isValidPassWord )
    LoginValidateUtil.getUserDetails();
    return mapping.findForward("success");
    But, can I assign many values to a single key using Map ?
    4. LoginFormBean.java
    -Here should I have to use set/getUserDetails() ?
    -If so, how do I use Map there?
    I want to have userId as the only key to which i can map values and not password.
    5. LoginValidateUtil.java
    -Here all validations are defined and boolean result is passed to LoginAction.java.
    Hope you got what I meant.
    Please tell me if i am right in this approach...
    Thanks in advance,
    sanlearns

  • Can i create an instance of ArrayList ?

    hi ,
    I need to store first name, last name etc in an ArrayList for a unique userid. And i have to do it for few userids. on successful login of the user ( with unique userid that matches with the one in the arraylist), i need to retrieve user details (first name, last name etc) from that arraylist and display in jsp file.
    Could u please tell me:
    1. how do i go about doing it?
    2 .Can i create an instance of ArrayList and use .add() method to add details ?
    3. can i write some java code in jsp without using scriptlets ?
    Thanks in advance,
    Sanlearns

    Hey thanks so much for the reply.
    Let me tell you the exact scenario. I'm actually developing a struts-application. Hope I can get some help here too.
    I have:
    1. login.jsp-where user logs in.
    -I have a userid and a password as default values for each unique user.
    Where should i store these details -in HashMap??
    -How can I display error messages if userId/passWord is invalid on login.jsp page ??
    2. confirmation.jsp-on successful login, he's shown his details:
    YOur first name: .........
    Your last name: ........ etc.
    -Here I can't use bean:write tag to read from form-bean.
    - how do i display it here without using a scriptlet ?
    3. LoginAction.java
    -Here i will get userId and passWord from LoginFormBean.java setter
    and getter methods.
    -For all validations' results, should i call a boolean getUserDetails() method from form-bean, wherein i can map values(first name, last name etc ) to each key (userid) ?
    i can use methods like:
    if (isValidUserId && isValidPassWord )
    LoginValidateUtil.getUserDetails();
    return mapping.findForward("success");
    But, can I assign many values to a single key using Map ?
    4. LoginFormBean.java
    -Here should I have to use set/getUserDetails() ?
    -If so, how do I use Map there?
    I want to have userId as the only key to which i can map values and not password.
    5. LoginValidateUtil.java
    -Here all validations are defined and boolean result is passed to LoginAction.java.
    Hope you got what I meant.
    Please tell me if i am right in this approach...
    Thanks in advance,
    sanlearns

  • Creating multiple instances of a class in LabVIEW object-oriented programming

    How do you create multiple instances of a class in a loop?  Or am I thinking about this all wrong?
    For instance, I read in a file containing this information:
    Person Name #1
    Person Age #1
    Hobby #1
    Hobby #2
    Hobby #3
    Person Name #2
    Person Age #2
    Hobby #1
    Hobby #2
    Hobby #3
    Person Name #3
    Person Age #3
    Hobby #1
    Hobby #2
    Hobby #3
    If I define a Person class with name, age, and an array of strings (for the hobbies), how can I create several new Person instances in a loop while reading through the text file?
    FYI, new to LabVIEW OOP but familiar with Java OOP.  Thank you!

    First of all, let's get your terminology correct.  You are not creating multiple instances of a class.  You are creating Objects of the class.
    Use autoindexing to create an array of your class type.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Can we create multiple application with single MSI(or Same MSI) in biztalk admin console ?

    Can we create multiple application with single MSI(or Same MSI) in biztalk admin console ?
    My client requirement is process 100 files  from biztalk with in 5 min ,actually it is taking 20 min .
    So I decided to created same instance of the application with multiple time in BTS admin console ,as I understand biztalk admin console never allow to install same
    schema’s with multiple  time .
    Any help can be  appreciate ..

    BizTalk will automatically process multiple messages on separate threads so you may need to tune your system. The following link should get you started:
    http://social.technet.microsoft.com/wiki/contents/articles/7801.biztalk-server-performance-tuning-optimization.aspx
    Another possibility is to set the Batch Size property on your receive location if the adapter uses batch size to determine how messages are picked up.  As an example, it you want  the MSMQ adapter to immediately pick up messages and start
    to process them, set the batch size to 1.
    You may also need to distribute the processing across multiple BizTalk servers by installing BizTalk on additional servers and joining the existing BizTalk group.
    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.

  • Create multiple instance in a database

    is it possible to create multiple instance in a database.if possible then is it possible to activate many instance at a time.(in personal edition)

    Instance in Oracle refers to the Oracle database "engine" - a collection of processes using a shared memory area, accessing a physical Oracle database.
    Multiple instances are possible on the same platform for different physical databases. But not a Good Idea..
    Multiple instances on different platforms are for the same physical database using Oracle Real Application Clusters, aka Oracle RAC.
    Thus your question does not make a lot of sense. My guess is that you are in fact refering to an Oracle session instead as this is "in the database" as you refered to.
    Each client that connect to Oracle, creates/establishes an Oracle session. A single client uses one (usually the default) or more sessions (usually used by a multi-threading client).
    By default, the Oracle Instance supports multiple Oracle (client) sessions. Including Personal Oracle. In the past, Personal Oracle limited (via the Listener) the number of remote clients (i.e. clients on other platforms) that can connect. I would assume that this is still the case. I however do not recall that there were a limit imposed on the number of local sessions that could be created - the limiting factor here is afterall the power and resources available by the PC. It's very unlikely that a common PC will be able to support a Personal Edition Oracle instance and 100's of local client sessions at the same time.
    If you do mean instance as per the strict Oracle definition - why would you want to create two Oracle instances (each with its own physical database) on a PC? That does not make sense on a large db server platform. It makes even less sense on a small PC platform.
    Each Oracle instance has overheads (processing and memory). Each physical Oracle database has overheads (system space, temp space, redo, logs, etc). Why duplicate these overheads?
    On a single platform - what can two Oracle instances (less capable because of reduced resources availability) do what a single Oracle instance cannot do faster and better and more effectively? Thus is it not a Good Idea to run multiple instances on a single platform. (exceptions acknowledged)

  • Creating multiple instances

    Below are two methods to create multiple instances. Clearly,
    method 2 is more efficient. However, if I use method 2 I don't know
    how to modify a specific instance later in my code. For example,
    using method 1 I can just write:
    tf1.alpha=0
    but I don't know how I can target a specific instance using
    method 2. Writing tf.alpha=0 will only target my last instance. How
    do I put something in my loop to allow me to identify every
    instance by name?

    "SiHoop" <[email protected]> wrote in
    message
    news:gmkkn3$ok8$[email protected]..
    > Below are two methods to create multiple instances.
    Clearly, method 2 is
    > more
    > efficient. However, if I use method 2 I don't know how
    to modify a
    > specific
    > instance later in my code. For example, using method 1 I
    can just write:
    > tf1.alpha=0
    > but I don't know how I can target a specific instance
    using method 2.
    > Writing
    > tf.alpha=0 will only target my last instance. How do I
    put something in my
    > loop
    > to allow me to identify every instance by name?
    >
    >
    >
    > Method 1:
    > var tf1:TextField=new TextField
    > var tf2:TextField=new TextField
    > var tf3:TextField=new TextField
    > tf1.text=myArray[0]
    > tf2.text=myArray[0]
    > tf3.text=myArray[0]
    > tf1.setTextFormat(format4)
    > tf2.setTextFormat(format4)
    > tf3.setTextFormat(format4)
    >
    > Method 2:
    > for(var i:uint:=0;i<3;i++){
    > var tf:TextField=new TextField
    > tf.text=myArray
    > thisi["tf"+i].setTextFormat(format4)
    > }
    >
    var instances:Array=new Array();
    for(var i:uint:=0;i<3;i++){
    var tf:TextField=new TextField
    tf.text=myArray
    thisi["tf"+i].setTextFormat(format4)
    instances.push(tf);
    HTH;
    Amy

  • In Pages (5.5.1) can I create multiple Paragraph Styles within one paragraph?

    In Pages (5.5.1) can I create multiple Paragraph Styles within one paragraph. 
    I need to make a table of contents for my Mater's Thesis and want to use the automatic table of contents feature.  I want the first sentence of a paragraph to have a different paragraph setting than the rest of the paragraph.  Is this possible?
    Thanks!

    Nice of you to be doing this for your Mother's Thesis.
    There are several issues here:
    1. A Paragraph Style is what it says, the style for the paragraph
    2. You can format text within a paragraph by applying a Character Style
    3. Pages 5.5.1 lets you apply formatting to overall text for the T.O.C. but not parts of it and you can not retain that formatting as a Paragraph style
    So in answer to your question, no.
    You will need to create the T.O.C. manually and unfortunately as Pages 5.5.1 can't create bookmarks (just one of over 100 missing features) you will be unable to link the T.O.C. to the referred pages in the list.
    Peter
    Apple's marketing slogan:
    Pages 5.5.1 - Can't Do That!

Maybe you are looking for

  • What's wrong with my AirPort Express?

    I got my AirPort Express over little a year ago and it worked great. About 3 months ago it died (no light at all). I tried to reset, but it didn't worked. I plugged my old TP-LINK back, and used it about 3 weeks and I didn't touched my AE. After 3 we

  • Saving PDF files after opening in Firefox from the web?

    When I open a PDF file from my credit union it displays as an HTML document. When I try and save it, it also is an HTML without an option to save it as PDF. IE works fine in this situation. I have selected to open the PDF file in a separate Adobe X w

  • Unable to send an email with Adobe Reader X

    I am using Outlook 2010 as my default email client. Every time I try sending an email I get this error. Either there is no default mail client or the current mail client cannot fulfill the request. Please run Microsoft Outlook and set it as the defau

  • Rename table

    how to rename table using export and import utility ?? Thanks 10

  • Account access rights and role for XI-to-XI communication using https

    Hi, Can anyone please provide information regarding what is the minimum privileges to be awarded to a new account created in XI so that a customer can connect using https. Presently, for testing purposes we are using PISUPER and PIAFUSER. We are maki