How to call a jsp file from an servlet and access the jsp file objects??

Hi everybody
I have an jsp file where it contains a vector object with some data and I have a servlet that needs to access this vector object . How can my servlet call for this jsp page and get the vector object. ?
then an applet will be calling this servlet to get some other object created with the data contained within this vector object...so each time Applet ask the servlet for the object the servlet need to call for this jsp page somehow
My main question is the communication servlet-jsp
please if u have any clue I will appreciate it
thanks

Hi
There are several ways to share objects between JSPs/Servlets.
You can share objects by putting them in the request-in which case the objects lifetime is limited by that of the request, Another way is to store them in the session, againg the lifetime is limited by the lifetime of the session. To have objects that have to persistent over the application life-span use the servletContext to store the objects.
Any good tutorial should help you get started. Please see the link below for a tutorial on Servlets/JSPs
Note: Local variables in the JSP cannot be shared with other components as their scope is limited to that particular Page/Servlet.
Link: http://java.sun.com/docs/books/tutorial/servlets/
Good Luck!
Eshwar Rao
Developer Technical Support
Sun microsystems inc
http://www.sun.com/developers/support

Similar Messages

  • How can I extract certain pages from my document and save as another file?

    How can I extract certain pages from my document and save as another file?

    You would need Adobe Acrobat to do that, not Adobe Reader.

  • I want to initialize my MBpro end reinstall lino, but I purchased it from apple store and cancelled the installation file. If i try to download again it from appstore I couldn't...How I can do ? Please help me

    I want to initialize my MBpro end reinstall lino, but I purchased it from apple store and cancelled the installation file. If i try to download again it from appstore I couldn't...How I can do ? Please help me

    Thanks for the feedback. Now, before installing in, put a copy some place safe and you won't have to download it again, wasting bandwidth, time, and electricity. Why? Because the installer blows itself away during the installation—IMO, a braindead delivery system, copied from their iOS world, but totally unsuitable for computers.

  • I have different music files all over three computers. Everytime I connect my iPod to one of these computers it transfer the music files from that computer but delete the music files that I already have in my iPod. I want all my music in my iPod.

    I have different music files in three computers.
    Everytime I connect my iPod into one of these computers it transfer the music files from that computer but delete the music files that I already have in my iPod.
    I want all my music in my iPod.
    What I need to do?
    Thanks!

    I haven't researched it and I don't claim to know everything about iTunes, but it has always been my understanding that you can only use one computer per iPod, but you can have multiple iPods per computer. From what I understand, this is to prevent illegal sharing and whatnot.

  • Can we open a URL link from an RFC and access the data in the link.?

    Can we open a URL link from an RFC and access the data in the link.
    I have the following scenario.
    I have a URL link and it opens a KM folder in the Portal server and I need to put a PDF file in that KM folder
    Can we do that with the help of an RFC, can we deal with Links in RFC, is there any such FM??
    Regards

    >
    SAP LEARNER wrote:
    > Can we open a URL link from an RFC and access the data in the link.
    >
    > I have the following scenario.
    >
    > I have a URL link and it opens a KM folder in the Portal server and I need to put a PDF file in that KM folder
    >
    > Can we do that with the help of an RFC, can we deal with Links in RFC, is there any such FM??
    >
    > Regards
    I guess you are trying to connect from the R3/ECC to the Portal Server.
    Are these two systems in the same network? Do you have usernames (valid and fully authorized) in both systems? What is the OS on which these two systems are housed?
    Please provide these details to proceed further.
    Regards
    Sabu

  • How can I import an Aperture Catalog into Lightroom and retain the RAW file as well as the files with the edits?

    I have several catalogs in Aperture that I would like to import to Lightroom 5 and I want to retain the original RAW files as well as the files with the edits.  How can I do this?

    Well, you can bring in the raw file (without edits), and you can bring in a rendered RGB file (e.g. jpeg or tiff) with edits baked in, but what you CAN'T do is bring in a raw file, with the non-destructive Aperture edits, and have Lr translate those Aperture edits into Lightroom edits.
    Put another way: no raw converter/editor can understand the edits of any other raw converter/editor. So, you have to work with a rendered version, and/or re-edit from scratch in a new raw converter/editor.
    PS - it would be feasible to write a rough translator which approximated raw edits in one world into edits in another, but such does not exist yet for Aperture -> Lightroom, that I know of.

  • Networking a firewire hard drive from a Mac and access the drive from a PC

    I'm trying to network a firewire hard drive from my Mac and access that hard drive from a Windows XP PC. I can see the main internal hard drive but I cannot see the firewire hard drive. Does anybody have a solution or work around?
    Many thanks,
    Roy

    Thanks SO MUCH! Not only does it work, BUT IT IS FREE!!!!
    See, I have two firewire (external) HDs, connected to a Mac, connected to a PC, connected to a USB external HD... now I can share files from the USB HD to the firewire HDs!
    Gotta love technology!
    Matthew

  • How do I move data files from old iPhone? Specifically, the password files for the App mSecure from my old iPhone 3Gs to iPhone 4S?

    How do I move data files for mSecure (a password saver app) from old iPhone 3GS to new iPhone 4S?

    That article is about using your iPod as an external hard drive, to move files from one computer to another computer.  It is not related to your question.
    You can't use iTunes to move song files from iPod to computer, except for songs you purchased from the iTunes Store (and you can also re-download purchases).  However, there are third-party methods and utilities that can move song files from iPod to computer.  If you do a Google search on something like "ipod transfer," you should get some links.
    Once the song files are on your current computer, add them to that computer's iTunes library by dragging the files (or folder containing the files) to the iTunes window.  After confirming everything is there (and fixing the data issue you mentioned) you can sync the iPod.  You may want to do a Restore on the iPod, if it might have a data corruption issue, which will erase the iPod's hard drive, re-install the latest software, and set it to defautl settings.

  • How to call a  portal service from a servlet

    Hello all.
    I have a functioning portal service that I would like to call from a servlet.
    When I try to do so, I get a ClassCastException when I do this (on line two):
    IPortalRuntimeResources runtimeResources = PortalRuntime.getRuntimeResources();
    IDocumentPersistence docPer = (IDocumentPersistence) runtimeResources.getService(IDocumentPersistence.KEY);
    However if I do the following I can get a generic IService and use reflection to invoke the method (in the IDocumentPersistence interface) that I want to invoke:
    IPortalRuntimeResources runtimeResources = PortalRuntime.getRuntimeResources();
    com.sapportals.portal.prt.service.IService aService = (com.sapportals.portal.prt.service.IService) runtimeResources.getService(IDocumentPersistence.KEY);
    There must be a better way to use portal services (hopefully like scenario one above) in servlets. In web dynpro you can use portal services and cast them to the correct type. What am I missing?

    Hi Kim,
    how did you integrate the references to your Portal Service Interface into your web application?
    You should do this using the references in your application-j2ee-engine.xml, did you do this? It might be a problem with the classloader otherwise.
    The way you are calling portal services does work normally, however it is not the recommended way as it is documented in the SAP documentation.
    Please check the SAP documentation on how to access a portal service from a j2ee app:
    http://help.sap.com/saphelp_nw70/helpdata/EN/42/9ddd0cbb211d72e10000000a1553f6/frameset.htm
    Best regards,
    Stefan Brauneis

  • How do i remove an app from my imac, and all its associated files

    I know you can drag an item to the trash can but i have heard there are files left on the computer that don't get deleted.  So how do i get rid of them?

    If the app has an uninstall routine use that. If it doesn't you can use a utility such as AppCleaner. BTW if you have come from the MS Windows world uninstalling apps Macs is really simply just drag them to the trash. Any files left behind will not affect the performance of the system and are normally so small (KB's) that they can be ignored. Tools like AppCleaner are not totally necessary to be honest, they're there to just make us feel better.

  • How to call a dos shell from a servlet

    How could I call a dos shell using a servlet so that java files could be compiled and the results be seen without having to call the browser each time? thanks for your kind attention. amaral

    I guess this might help....
    In one of your servlet classses create a runtime process and execute a command( the path to javac and the file to be compiled) wait for the process to finish a get the result and send it to the client.
    - XL

  • Read file from directory, update contents of the each file

    hai,
    I could not understand how to debug the error i have now.
    target
    1- read the files from directory // i able ot do this part
    2- for each file
    for each file read the content & compare with the existing List & update the list // i able to do this part
    when i try to combine both parts , i got some following error
    run:
    E:\java\check\100130.ixf
    Error: children[i] (The system cannot find the file specified)
    BUILD SUCCESSFUL (total time: 2 seconds)
    i can see from the code that children[i] only gives the error when i use that in the second part of the code.
    can any one help me on this??
    Thanks
    Priyan
    the original code
    import java.io.BufferedReader;
    import java.io.DataInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.InputStreamReader;
    import java.io.RandomAccessFile;
    import java.util.ArrayList;
    public class CompareList
         public static void main(String[] args){
             ArrayList a1 = new ArrayList();
             ArrayList a2 = new ArrayList();
             a1.add("1");
             a1.add("2");
             a1.add("3");
             a1.add("4");
             a1.add("5");
             a1.add("6");
             a1.add("7");
             a1.add("8");
             a1.add("9");
             a1.add("10");
             a1.add("11");
             a1.add("12");
             a1.add("13");
             a1.add("14");
             a1.add("15");
             a1.add("16");
             a1.add("17");
             a1.add("18");
             a1.add("19");
             a1.add("20");
             a1.add("21");
             a1.add("22");
             a1.add("23");
             a1.add("24");
             a1.add("25");
             a1.add("26");
             a1.add("27");
             a1.add("28");
             a1.add("29");
             a1.add("30");
             a1.add("31");
             a1.add("32");
             a1.add("33");
             a1.add("34");
             a1.add("35");
             a1.add("36");
             a1.add("37");
             a1.add("38");
             a1.add("39");
             a1.add("40");
             a1.add("41");
             a1.add("42");
             a1.add("43");
             a1.add("44");
             a1.add("45");
             a1.add("46");
             a1.add("47");
             a1.add("48");
             a1.add("49");
             a1.add("50");
             a1.add("51");
             a1.add("52");
              try{
                    File dir = new File("E:\\java\\check");
                    File[] children = dir.listFiles();
                    if (children == null) {
                          System.out.println("does not exist or is not a directory");
        else {
               for (int i = 0; i < children.length; i++) {
                       System.out.println( children);
    FileInputStream fstream = new FileInputStream("children[i]");
    DataInputStream in = new DataInputStream(fstream);
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    String strLine;
    while ((strLine = br.readLine()) != null)      {
    String line =strLine.substring(0,2);
    // Print the content on the console
    //System.out.println(line);
    a2.add(line);
    } // end of add list2
    if (a1.size() > a2.size())
    int k = 0;
    for (int l = 0; l < a2.size(); l++)
    if (!((String)a1.get(l)).equals((String)a2.get(l)))
    //System.out.println((String)a2.get(i));
    // System.out.println("dd");
    k = l;
    k++;
    for (int l = k; l < a1.size(); l++)
    System.out.println((String)a1.get(l));
    String str = "children[l]";
    File file = new File(str);
    RandomAccessFile rand = new RandomAccessFile(file,"rw");
    rand.seek(file.length()); //Seek to end of file
    rand.writeBytes((String)a1.get(i)); //Write end of file
    rand.writeBytes("., 0.");
    rand.writeBytes("\n");
    }// end of comparing and updating the list2
              in.close();
    catch (Exception e){//Catch exception if any
    System.err.println("Error: " + e.getMessage());

    thanks for the information.
    i tried, the error
    like this
    run:
    E:\java\check\100130.ixf
    java.lang.StringIndexOutOfBoundsException: String index out of range: 2
            at java.lang.String.substring(String.java:1935) 
            at CompareList.main(CompareList.java:84)
    BUILD SUCCESSFUL (total time: 0 seconds)this comes because in my code i used children[i] as string in the later part
        else {
               for (int i = 0; i < children.length; i++) {
                        System.out.println( children);
    FileInputStream fstream = new FileInputStream(children[i]);
    DataInputStream in = new DataInputStream(fstream);
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    String strLine;
    while ((strLine = br.readLine()) != null)      {
    String line =strLine.substring(0,2);
    a2.add(line);
    System.out.println(line);
    } // end of add list2
    if (a1.size() > a2.size())
    int k = 0;
    for (int l = 0; l < a2.size(); l++)
    if (!((String)a1.get(l)).equals((String)a2.get(l)))
    //System.out.println((String)a2.get(i));
    // System.out.println("dd");
    k = l;
    k++;
    for (int l = k; l < a1.size(); l++)
    System.out.println((String)a1.get(l));
    String str = "children[l]";
    File file = new File(str);
    RandomAccessFile rand = new RandomAccessFile(file,"rw");
    rand.seek(file.length()); //Seek to end of file
    rand.writeBytes((String)a1.get(i)); //Write end of file
    rand.writeBytes("., 0.");
    rand.writeBytes("\n");
    rand.close();
    }// end of comparing and updating the list2
              in.close();
    i stil could not figure out it yet. do u have any clue with this.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • When I export a AAF file from Protools 9 and Import the file into Logic ProX the drum track is out of sync.  I created the drum loop using NI Maschine.  Has anyone else seem this??

    When I export an AAF file/project from Protools 9 using an external drive and import the AAF into Logice Pro X the drum track does not play correctly.  It is out of sync with the rest of the track.  I created the drum loop as a plugin using Native Instruments Maschine. Has anyone else had this problem??  Also how would I go about exporting the midi tracks from the Protools session.  The midi track does not show when the file is imported to Logic Pro X.  The midi data should export with the AAF file correct??

    Are you using any plugins in Logic?
    In Preferences/Audio  under the General tab, how do you have the plug-in-latency compensation set?

  • How to delete one perticular message from a user and not the whole messages

    hi
    i would like to know how can i delete a single message sent by a person and not the complete list of message received by me from the same person also how can i forward a message received by me

    beesani
    Sorry. ;( You can"t delete part of a message. You can only delete the entire message from that person.
    will2b

  • Reading only Image Files from a Directory and ignoring the rest

    i am wanting to be able to read a directory but only obtain the Image files (ie, gif, jpeg, tiff, png etc) and ignore all other type of files.
    i have made a custom ImageFIlter class which extends FileFilter which works for adding a photo singly, as only image files are shown in the JFileChooser. however i am wanting to add a folder of photos at once.
    here is the code so far:
    File dir;
                        JFileChooser fc = new JFileChooser();
                        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                        //Handle open button action.
                        int returnVal = fc.showOpenDialog(MainAppGUI.this);
                        if (returnVal == JFileChooser.APPROVE_OPTION) {
                             dir = fc.getSelectedFile();
                             if (dir.isDirectory()) {
                                  File[] files = dir.listFiles(new ImageFilter());
                                  for (int i = 0; i < files.length; i++) {
                                       if (files.isFile()) {
                                            try {
                                                 Photo PhotoAdded = workingCollection.addManyPhotos(files[i], canvas.getChangedMaxDim());
                                                 //need to also add it to the relevant vectors, ie
                                                 //for mouse over operations, or photos added after
                                                 //save.
                                                 if(!workingCollection.isDuplicate()){
                                                      photosToCheck.add(photoAdded);
                                                      canvas.addToGrid(photoAdded);
                                                      photosAddedAfterLoad.add(photoAdded);
                                                      canvas.repaint();
                                                 else{
                                                      //do nothing as it is already in the vectors.
                                            } catch (Exception er) {
                                                 // Do nothing. Bad mp3, don't add.
                                       // recurse through directories
                                       else {
                             } else {
                                  try {
                                       throw new IOException(
                                                 "Error loading files from a directory: "
                                                           + dir.getAbsolutePath() + " is not a "
                                                           + "directory");
                                  } catch (IOException e1) {
                                       // TODO Auto-generated catch block
                                       e1.printStackTrace();
    any ideas?

    I'm confused.
    You already ARE using a FileFilter to only pick up image files. Whats the problem?
    If you need to recurse directories you need to change your code only a little.
    Write your method
    JFileChooser fc = new JFileChooser();
    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    //Handle open button action.
    int returnVal = fc.showOpenDialog(MainAppGUI.this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
      dir = fc.getSelectedFile();
    if (dir.isDirectory()) {
      scanDirectory(dir);
    else{
      // not a directory
    public void scanDirectoryForPhotos(File directory){
      // taking your code
    if (dir.isDirectory()) {
      File[] files = dir.listFiles(new ImageFilter());
      for (int i = 0; i < files.length; i++) {
        if (files.isFile()) {
    // details deleted
    // recurse through directories
    else {
    scanDirectory(files[i]);
    Your exception handling is a little strange. You throw an exception only to catch it immediately to print a stack trace? Not exactly the most common handling I've seen. You should probably just throw the exception and let the next level down handle it.
    Cheers,
    evnafets

Maybe you are looking for