Hi, i've a question, how to comunicate from servlet to a JSP and viceversa?

i would like to know how to do this and if its possible an example i'll appretiate it much. thanks

You have a mechanism called "forwarding", with which you can pass control from one resource (servlet/jsp) to another resource (servlet/jsp). You do this using a RequestDispatcher, which you can get from the HttpServletRequest object. If for example you want to forward to "index.jsp" which is in the root of your web application, you would do this in your servlet:
RequestDispatcher rd = request.getRequestDispatcher("/index.jsp");
rd.forward(request, response);
return;(watch the return statement, you must manually return after a forward, or else the servlet will continue executing!). A forward will NOT create a new request, the same request is passed to the new resource (to create a new request, use a redirect in stead, also done with the RequestDispatcher).
To pass objects between the two resources when doing a forward, use request.setAttribute(), request.getAttribute() and jsp:useBean.

Similar Messages

  • Thanks.. can u please help me out in one more question. how can i transfer files like pdf, .docx and ppt from my laptop to iPhone 5 ? please its urgent.

    thanks.. can u please help me out in one more question. how can i transfer files like pdf, .docx and ppt from my laptop to iPhone 5 ? please its urgent.

    See your other post
    First, i want to know how can i pair my iPhone 5 with my lenovo laptop?

  • How to exit from a WebDynpro ABAP application and open another url

    Hi Friends,
    How to exit from a WebDynpro ABAP application and open another url like (www.yahoo.com) in the same window of the WD4 application on click of a Button?
    Regards,
    Xavier

    Hi,
    First of all you should create outbound plug in the window you are trying to exit with plufg type "Exit"
    Then create method handler in the view with this code
            data lo_view_cntr type ref to if_wd_view_controller.
            data lo_win_cntr type ref to if_wd_window_controller.
            data: l_parameter_list type wdr_event_parameter_list,
                  l_parameter type wdr_event_parameter,
                  l_val type ref to data,
                  l_val_url type REF TO data.
            field-symbols: <fs> type any,
                           <fs_url> type any.
            lo_view_cntr  = wd_this->wd_get_api( ).
            lo_win_cntr = lo_view_cntr->get_embedding_window_ctlr( ).
            CREATE DATA l_val type c.
            CREATE DATA l_val_url type string.
            ASSIGN l_val->* to <fs>.
            ASSIGN l_val_url->* to <fs_url>.
            <fs> = 'X'.
            <fs_url> = 'http://your-link.com'.     
            l_parameter-name = 'URL'.
            l_parameter-value = l_val_url.
            INSERT l_parameter INTO TABLE l_parameter_list.
            lo_win_cntr->if_wd_view_controller~fire_plug( EXPORTING plug_name = 'EXIT_PLUG'
                                                                    parameters = l_parameter_list ).
          You can easily change this logic to exit application instead of redirecting to the site
           just changing to
           l_parameter-name = 'CLOSE_WINDOW'.

  • How remove data from OS X10.8.3 and Safari 6.0.4 beyond Delete or Ctrl Del?

    How remove data from OS X10.8.3 and Safari 6.0.4 beyond Delete or Ctrl Del?
    When I had a Windows OS based machine I had to dig deep into the Directory to find everything I wanted to remove as the delete function did not do so.  I don't know if this "digging deeper" action is even necessary in Mac and if it is where I would go in Mac to do so.  Is it?  If so, how?

    I appreciate your clarification inquiry request.  My goal was as initially stated, to "find everything I wanted to remove as the delete function did not do so.......if.....digging deeper.....is.....necessary.....and if it is where....go in Mac to do so....(and)...how?"
    I have now resolved my data removal inquiry, accomplishing it through use of William Lloyd's post of instructions.
    Thank you.

  • HT5172 Glad to have USB capability on my new iMac.  Been in Mac world all of 2 days now.  Question - I downloaded photos from a Centron flash drive and am wondering if flash drives have to be ejected the same as on a PC?  Can't find how to do it.  Thanks.

    Been in the iMac world now all of 2 days.  I'm glad to have USB capability.  I downloaded photos from a Centron flash drive and now need to remove the flash drive.  Do you eject flash drives on iMacs as we did on PC's?  Can't find an answer in the support area.  Thanks...

    Yes. All external drives regardless of how they are connected must be ejected before they can be unplugged.

  • Questions from a Rookie about JSP and JEE

    Hello friends. I've just started to learn JEE and JSP technologies. I have some experience with .Net and PHP; but just found time to learn JSP. I have developed a simple Web application by using those technologies. And I want to deploy those codes to the web. I have googled. But could not find an explanatory tutorial about this topic.
    My second Question is:
    I am using Netbeans 6 Beta 2 and I am connecting to a Database by using a function let's say something called connectDb() with SSH;. How can I bind a Data table with this function. (Netbeans have a buildin component for binding to a component to db but does not support SSH)
    Thanx in advance. I would appreciate any kind of help.

    Hello.
    Is there anybody in there?
    Just reply if you can help me.
    Is there anyone here?
    By Dink Floyd

  • How to pass arraylist of object from action class to jsp and display in jsp

    I need to do the following using struts
    I have input jsp, action class and action form associated to that. In the action class I will generate the sql based on the input from jsp page/action form, create a result set. The result set is stored as java objects in a ArrayList object.
    Now I need to pass the arraylist object to another jsp to display. Can I put the ArrayList object in the request object and pass to the success page defined for the action? If this approach is not apprpriate, please let me know correct approach.
    if this method is okay, how can I access the objects from arraylist in jsp and display their property in jsp. This java object is a java bean ( getter and setter methods on it).
    ( need jsp code)
    Can I do like this:
    <% ArrayList objList = (ArrayList)request.getattribute("lookupdata"): %> in jsp
    (***I have done request.setattribute("lookupdata", arraylistobj); in action class. ***)
    Assuming the java object has two properties, can I do the following
    <% for (iint i=0. i<objList.size;I++){ %>
    <td> what should i do here to get the first property of the object </td>
    <td> what should i do here to get the first property of the object </td>
    <% }
    %>
    if this approach is not proper, how can I pass the list of objects and parse in jsp?
    I am not sure what will be the name of the object. I can find out how many are there but i am not sure I can find out the name
    thanks a lot

    Double post:
    http://forum.java.sun.com/thread.jspa?threadID=5233144&tstart=0

  • 2 questions; how to erase "other memory" on iphone 5 and how to sync to a new computer

    Apple support is failing to help my issues so I thought its best to turn to the community. OK so I've talked to Apple before about my "other memory" and I performed a soft reset on my phone and it decreased other memory by maybe a gig. A month later now its higher than it was before at over 5.6 gigs, any way how to make it as little as possible?
    Also I just got a new macbook pro and I use to sync my iphone 5 to my macbook (2008), how do I make my macbook pro my primary itunes and still keep all my info on my phone? My new macbook pro itunes says its backed up, but when I plug it in it won't sync any new songs or app data to my itunes, etc.
    Any help with these issues will much be appreciated!!

    "Other" is all of the data for all of the built in apps. If you delete its contents all of your built in app data will disappear. Some of what is contained in other:
    email messages and attachments
    Reminders
    Calendar entries
    Contacts
    Text messages
    MMS messages and attachments
    Genius data
    Music cover art
    Operating system settings
    Safari cache
    bookmarks
    Game Center status
    Music catalog
    Probably a few I've missed. There was a problem in an earlier version where deleted MMS messages left behind their attachments, but that has been fixed as of 6.1. Some people suggest deleting your music on the phone. DON'T DO IT! The reason that deleting music recovers some Other space is because it deletes cover art. But is also screws up your music, which will no longer play correctly.
    You will find posts from people who said they recovered over 1 GB of space by just deleting old text messages.
    If you want Other to be smaller you will have to keep less data on your phone; delete old MMS and texts, delete old email (especially from the "deleted" folder), clear the cache, eliminate cover art.
    Your Other is so large, however, that there may be corrupt data contained in it (unless you send a lot of MMS messages with large attachments). If this is the case you should restore the phone as New.
    =====================
    For your other question, the easiest way is to copy your iTunes library folder from the old computer to the new computer. For the hard way, see: Syncing to a "New" Computer or replacing a "crashed" Hard Drive

  • Newbie question : How to call a servlet from JSP?

    my web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
      <display-name>Test</display-name>
      <description>
         Test
      </description>
    <servlet>
            <servlet-name>Test1</servlet-name>
            <servlet-class>Test1</servlet-class>
        </servlet>
        <servlet-mapping>
           <servlet-name>Test1</servlet-name>
           <url-pattern>/test1</url-pattern>
        </servlet-mapping>
         <security-constraint>
          <web-resource-collection>
             <web-resource-name>Protected Group</web-resource-name>
          <!-- Define the context-relative URL(s) to be protected -->
             <url-pattern>/jsp/security/protected/*</url-pattern>
          <!-- If you list http methods, only those methods are protected -->
          <http-method>DELETE</http-method>
             <http-method>GET</http-method>
             <http-method>POST</http-method>
          <http-method>PUT</http-method>
          </web-resource-collection>
          <auth-constraint>
             <!-- Anyone with one of the listed roles may access this group -->
             <role-name>tomcat</role-name>
          <role-name>role1</role-name>
          </auth-constraint>
        </security-constraint>
        <!-- Default login configuration uses BASIC authentication -->
        <login-config>
          <auth-method>BASIC</auth-method>
          <realm-name>Example Basic Authentication Group</realm-name>
        </login-config>
    </web-app>my index.html
    <html>
    <body>
    <a href="/test1">test</a>
    </body>
    </html>I put my Test1.class in ../WEB-INF/classes.
    When I click the link for test1, I got the following message
    HTTP Status 404 - /test1
    type Status report
    message /test1
    description The requested resource (/test1) is not available.
    Apache Tomcat/4.1.18-LE-jdk14please help. thanks

    Hi,
    You have not said if your servlet is in a package in which case which one.
    you need to add the '/servlet/' to the href so it becomes
    '/servlet/test1'.
    Phil

  • How to import from ipod to new os and itunes?

    Had to replace my hard drive and reinstall itunes. How do i import the songs from the ipod to itunes? The music that is on the ipod was lost with the old hard drive. I hope there is some way besides updating the ipod with itunes erasing everything.

    Stanman,
    These links will give you several methods of recovering whatever songs remain on your iPod; some free, some third-party software, some more comprehensive for restoring playlists, ratings, playcounts, etc. Read them and their associated links before deciding on a strategy that works for you. There are many various third-party software programs that will offer a more robust process, or an easier GUI. Do a Google search for them if the links below leave you wanting…
    Don King Resurrected: Deleted files from hard drive (free user steps – music recovery only)
    MacMuse: Computer Crashed (free user steps – music recovery only)
    Copying music from iPod to computer (a primer on various methods and software)
    Copying Songs from Your iPod to a Mac or PC (resource for 3rd party software)
    iPodRip Software
    PodUtil Software
    XPlay (Software For Cross-Platform Functionality & Music Recovery)
    XPlay Photo Browser (For recovering Photos)
    After recovering your song files, strongly consider developing a thorough backup strategy for just this type of situation.
    You need at least three sets of your music:
    -- One full set on the PC within iTunes
    -- One full set on an external backup medium (CD/DVD/ExHD/other)
    -- One (full or partial) set on the iPod
    Music files on just the iPod and the computer is not considered having any backup. If you cannot store your complete music files on the computer, then create and maintain two external sets.
    Backup both the music files and the Library database file (iTunes Library.itl).
    Here is a post on developing a backup strategy: http://discussions.apple.com/click.jspa?searchID=210939&messageID=1215125

  • How to createWebservice from Functional Module inECC system and how to test

    Hi all
    i have one functional module in backend system i.e BAPI_GL_ACC_GETLIST. now i want to create a Webservice from the above functional module. once the webservice is ready in ECC system then how do we access in webdynpro thru model. i want to test the same webservice in ECC system itself, what is the procedure??
    can any body send the clear steps on starting from create of webservice and till to access the same in webdynpro.
    if we want to access from webdynpro thru model for the  same webservice which did in ECC system, is it require to deploy on J2ee engine by creating the same webservice or we can access that directly in Webdynpro??
    can you please tell me clear steps on the same rather than documents??
    Regards
    Suresh babu

    Hi Suresh,
    refer This ppt link will  help you.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/244e7923-0a01-0010-5887-fe0b0c6dbb8d
    Supraja

  • How to keep from losing connection to firefox and reentering user name and password when I close a message in my e-mail that I have read

    I use firefox for e-mail and am unsure how to close a message without losing the connection to firefox. Then I need to go through the tedious task of entering my username and password everytime I am finished reading the message and close it. How can I close the message without losing connection to firefox? Also, when I select "save my password" at the sign in page it never saves the information. Why not?

    You're welcome.
    You could always get a Gmail account(free), set that up as IMAP or Exchange, then forward all of the mail from your POP account to your Gmail account.

  • How does "Unflatten From String" take a type and return a value of that type?

    http://zone.ni.com/reference/en-XX/help/371361E-01/glang/unflatten_from_string/
    How exactly does the "type" argument for "Unflatten From String" work? I need to create a VI that takes a type, passes it as an argument to several calls of the "Unflatten From String" function, and returns an array containing elements of the type originally passed. The "Unflatten From String" function seems to do some magic though, because the type of the "value" that it outputs changes depending on the type it is passed as input. How do I do the same magic in my VI?
    Ultimately, what I need to accomplish is an unflatten-list operation. Given a type T and a byte string of length L (which contains a concatenation of T elements that are flattened to their bytes), create a VI that unflattens all the types in the string and return an array of length (L / sizeof(T)) that contains each type.
    Note: performing the unflatten-list operation is trivial, but I cannot for the life of me figure out how to do it in a VI that takes a type and returns an array of the appropriate type. By the way, my data is being given to me from another source, so please don't bother suggesting that I should be flattening an array using LabVIEW's "Flatten To String" function in the first place. My data is not given in LabVIEW's array format: http://zone.ni.com/reference/en-XX/help/371361B-01/lvconcepts/flattened_data/
    Thanks a ton!
    -Wakka

    Take a look at this example:  You can see that the flattened string contains several bytes.  The first four bytes contain the length of array (number of elements).  Since the data type is U32, the next 32 bits (4 bytes) contains the value of the first element, and so on.  Could you possibly use this scheme to do what you want to do?  Other data types present different outputs.  You would have to experiment with them.
    - tbob
    Inventor of the WORM Global

  • How to create a Servlet Exception in jsp

    Greetings,
    I would like to know if someone knows how create a servlet exception in a JSP.
    Thx

    What for? new ServletException() - IIRC it's not abstract.

  • How to Download from app store to pc and then onto iphone 4s

    how do i download from the app store onto my pc and then onto my iphone 4s?

    In a nutshell: Install iTunes on your computer if you have not already done so. Download the app you want. Sync your phone to attains by connecting it to the computer using the cable that came with the phone or by WiFi.
    See this page for more information:
    http://www.apple.com/support/itunes/apps/
    Is there a reason you don't do it directly on the phone itself?

Maybe you are looking for

  • Continued Spotlight Indexing Problems

    I'm still having problems with Spotlight indexing my drives into infinity. I just had a new 320g drive installed on my machine and, as I've posted before, Spotlight went ballistic trying to index it, telling me it had "2147483648 hours remaining" to

  • My problem/Q not solved- how/what correct signal setting on the Macbook pro for ther PC config on Bravia defn

    Regrettably Shane mu Q/problem is not solved-how does one check the comptability of defn (1020x...) for the computer and Bracia?

  • Missed due date for quiz due to vacation

    Hi, I was on a two weeks vacation (8-22 June) and now I'm seeing that I already missed the due date for lesson 2 quiz. What should I do? Thanks and regards Thomas

  • Font Issues & AppleWorks

    It seems that some of my fonts disappeared from out of nowhere. I was using Pages and tried changing the font to Times New Roman and nothing happened. When I tried typing in Word (Office 2004), the default font in a new document was Courier. I opened

  • External EZQuest Problems

    My 7 year old EZQUEST Cobra 80GB external is making a "clicking" noise at start-up and will not mount. It has worked fine for 7 years. Now this clicking noise that sounds like it is trying to "engage"? help?