Hi i wrote a question a weeks ago about servlets and JSP

I thank to jimbal2 for help me on the topic "how to comunicate from servlet to a JSP and viceversa?", the solution was:
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.
but i have some other questions, and these are :
so i've to do this with sessions and everything i want to pass to: for example my application is a servlet based, from a servlet to a JSP so i have to do it with:
RequestDispatcher rd = request.getRequestDispatcher("/servletToJsp.jsp");
rd.forward(request, response);
return;
if its from a JSP to a servlet it is the same way?, if i want to pass the session from one to another and viceversa how do i do that?,and its possible to import into a JSP a class that isn't a bean? because like i wrote here my appplication is a servlet-based but i want to insert new JSPs so thanks for your help and if its possible to respond my questions.

but i have some other questions, and these are :
so i've to do this with sessions and everything i want to pass to: for example
my application is a servlet based, from a servlet to a JSP so i have to do it with:
RequestDispatcher rd = request.getRequestDispatcher("/servletToJsp.jsp");
rd.forward(request, response);
return;
if its from a JSP to a servlet it is the same way?, JSP is actually generated as a HTML.
You can simply use a HTML form to submit data to a Servlet
if i want to pass the session from one to another and viceversa how do i do that?,http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/http/HttpSession.html
session.setAttribute("id",123);
session.getAttribute("id");
Similar to request.setAttribute() but last for a session.
and its possible to import into a JSP a class that isn't a bean? because like
i wrote here my appplication is a servlet-based but i want to insert new JSPs http://java.sun.com/developer/onlineTraining/JSPIntro/contents.html#JSPIntro3
You can import java.util.*, java.io.* , etc.
so thanks for your help and if its possible to respond my questions.See if it helps

Similar Messages

  • I ordered cards 1 week ago through iPhoto and I have not yet received a shipping confirmation.  How do I know when/if the cards will be processed and shipped? Thank you.

    I ordered cards 1 week ago through iPhoto and I have not yet received a shipping confirmation.  How do I know when/if the cards will be processed and shipped? Thank you.

    go to the online apple store (store.apple.com) and check your account for order status
    LN

  • Trying to install Photoshop Elements 13 - I'm getting an "Exit:  34 code" failure.  Adobe Tech support promised 2 weeks ago to research and resolve; nothing done.

    Trying to install Photoshop Elements 13 - I'm getting an "Exit:  34 code" failure.  Adobe Tech support promised 2 weeks ago to research and resolve; nothing done.

    Jive is the forum hosting provider which Adobe uses.  If you are receiving e-mail updates about Jive then it is likely due to the forum notifications.
    Steve Miller I am so sorry I see that you updated case 186454198 on 3/20/15 but you have not received a response since then.  I have asked that a member of our support team contact you directly at the phone number we have on file.  Please feel free to update this discussion if you continue to experience difficulties.
    I would recommend reviewing the installation log files for the update you are trying to apply to determine the cause of the error.  You can find details on how to locate and interpret the installation log files at https://helpx.adobe.com/photoshop-elements/kb/troubleshoot-install-using-logs-elements.htm l.  You are welcome to update this discussion with any errors which you are able to locate.

  • Hi, I had registered my credit card a week ago on Apple.and then that day  I remove all information about credit card off  my apple acount.but today i learned that  2 dollars payment has been given off my credit card.but I never  buy any paid apps.Each ti

    Hi, I had registered my credit card a week ago on Apple.and then that day  I remove all information about credit card off my apple acount.but today i learned that  2 dollars payment has been given off my credit card.but I never  buy any paid apps.Each time I was looking up my Itunes on pc , but there was always a 0.00$.so I do not know what to do now.please help me.check it . what happened and where is the 2 dollars? Please .

    Well the term "hotlined" I have never heard before. In any case many states (like NY) just passed regulatory powers to the State Public Service Commission of which it may be called something different in your state. You could file a complaint with them. Or file a complaint with your state attorney generals office, they also take on wireless providers.
    The problem here is the staff you speak to are poorly trained, in days gone by it took one call to them and they pulled up your account and see the error and had the authority to remove any errors. They did not remove legitimate account actions, but used their heads instead of putting a customer off or worse lying to the customer.
    Its a shame you have to go through what you going through.
    Good Luck

  • Downloaded ios5 one week ago, synced itunes and lost most apps, even folders and modified backup.  How can I get back what I had before last synced?

    Downloaded ios5 one week ago, last nigth synced itunes and lost most apps, even folders and modified backup.  How can I get back what I had before last synced?

    Try resetting your home screen layout, go to your setting>general>reset home screen layout. 

  • Questions about Java Servlets and JSP

    Hi,
    I'm a confident Java Programmer (and really enjoy using this language) but am very new to Java servlets and Java Server Pages.
    I have previously worked with Perl on my web projects (simple 'league' style voting pages). I read in my 'Core Java' book that I should no longer use perl or even cgi.
    I need to know more about Java servlets and Java Server Pages so I can make the switch to a 'real' programming language.
    I have a few questions:
    How should I start to learn JS and JSP?
    How applicable will the java knowlegdge I have already be?
    Are JSP common on the world wide web?
    What tools do I need to start? (I currently develop in JBuilder and have Java 1.4.1 Standard Edition)
    Is it likey my web host (and others) will support JSP?
    Thank-you very much for helping a novice get started,
    Regards,
    Paul

    Hi, Steve ...has to be frustrating! But do not despair.
    Let's suppose the servlet it's named MyServlet on package org.servlets
    WEB-INF should look:
    WEB-INF
    classes
    org
    servlets
    MyServlet.class
    web.xml
    web.xml file should have this two declarations:
    <web-app>
      <servlet>
        <servlet-name>MyServlet</servlet-name>
        <servlet-class>org.servlets.MyServlet</servlet-class>
      </servlet>
      <!-- other servlets -->
      <servlet-mapping>
        <servlet-name>MyServlet</servlet-name>
        <url-pattern>/MyServlet</url-pattern>
      </servlet-mapping>
      <!-- other servlets mappings -->
    </web-app>Now, once the container starts (Tomcat?), you should be able to see that servlet in:
    http://localhost:8080/[my-context/]MyServletAnd what my-context is? The web application context. This string should be empty if your're deploying to the root context, otherwise should the context name. In Tomcat, deploying to root context defaults to using webapps/ROOT.
    Sorry for my English, but I felt the need to answer your request. I hope it helps despite my writing.

  • I posted this question a week ago and received no answer.

    Whenever I try to change a sharers status or try to add new sharing  members it then prevents my already existing co-authors from editing.  They can log  in and they are still shown as Co-Authors, but they can't edit.  The  only way to resolve this is to delete all members and start from scratch  by adding them again, sending notification, and having them respond  again.  Am I going to have to do this every time?  Oh, and then they end up with two copies of the project and have to delete one.

    Hi,
    Sorry for the late reply.
    We investigated the issue you have mentioned at our end, but the sharing worked for us correctly( Co-authors were being able to edit the document). To get a better understanding of the issue we would like to meet you online sometime in a connect session anytime you suggest.
    You can drop me a mail at sunny at adobe dot com with the time that suits you.
    Regards,
    Sunny

  • I bought my Macbook Air 3 weeks ago (23 March) and have to pay for iPhoto'11 : is that logic ?

    Via time machine I used my back up of my previous Macbook Pro if this has any relation to my problem. 
    Now I feel like being blackmailed by Apple ....... pay or you will loos all your pictures .....

    You haven't purchased iPhoto yet, have you?  If not then  contact Apple as ask them why iPhoto wasn't included with the other applications on the MacBook Air?  Because it should have been. You do not need to purcahse it.
    You can take it to a local Apple store with your purchase papers and have them install any missing applicaitons. 
    OR, if you still have your MacBook Pro and the disks that came with it?  If so you can connect the two Macs with a FireWire cable, with the Mac Air in Target Disk Mode,  Transferring files between two computers using FireWire,, and run the Software Installer disk on the MPB to install iPhoto on your MacBook Air. 
    The installer disk looks like this:
    OT

  • A week ago Firefox crashed and since then will not run on my computer. At first when I clicked on Icon on desktop a popup said Firefox was already running, but where was it? I couldn't find it anywhere. I uninstalled Firefox and downloaded Firefox 9.0.1.

    Now when I click on either the desktop icon or Firefox in the program section, a little popup appears in the top left hand corner but there is nothing in it that I can click on to run Firefox

    There may be a parent.lock file left in the Firefox Profile Folder because Firefox crashed.
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    See:
    *https://support.mozilla.com/kb/Firefox+is+already+running+but+is+not+responding
    *http://kb.mozillazine.org/Profile_in_use

  • Question from Mac newbie about system and startup programs

    I recently switched from an old Win 98 computer and LOVE this macbook! Could someone please explain a couple of things to me?
    Two windows now suddenly appear when I restart my computer - one is a window with all the files and folders stuff from when I installed my Canon MP500 printer last week. Why is this box opening at startup, and can I get it to stop?
    The other suddenly opening at restart is a simple Finder window showing my hard drive and network. (I am not connected to a network). What's the source of these things starting up? How can I fiddle with this setting? These things are not listed when I go to System Preferences-Accounts-Login items.
    On Windows you can hit CtrlAltDelete and see all the running programs, even background programs. How do I do it on the Mac?
    Thanks,
    -Alden

    Charles I'll start from your last question. You'll find "Activity Monitor" in the Utilities folder (inside Applications folder) that's the equivalent to the Task Manager in Windows. you can leave it in the dock to have it handy.
    About the Canon printer window showing when you start; see if it has an open icon on the dock when it's open. Click and maintain clicked on that icon (if there is one) and uncheck "Open at Login".
    Finder Window usually opens at login if it was open when you logged out
    Oh, and Welcome to the forums!

  • 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

  • I can't get text effects to preview in cs6 After Effects. It was working a week ago.

    I can't get text effects to preview in After Effects CS6 browser. It was working a week ago.

    I uninstalled and reinstalled a current Quicktime. Couldn't find hardware accelerated previews in Bridge setting. Is it under "preferences"? Couldn't find it in preferences. Still not previewing.

  • Was just opening page on Chrome when computer went to white screen and became unresponsive. Did this several weeks ago too. Disk tools find no issues.

    While trying to open a link on FB, my computer went to a white screen and become unresponsive. I had to do a hard close. It did reboot and the Disk Aid finds no problems when I ran Verify Disc. This happened 2 weeks ago as well and I had to do a Safe mode reboot. Things seem a little slow when I use internet-Google Chrome (updated). I have a MacBook Pro with  OS X 10.9.4  I'm not sure what else needs to be done? I'm not supertech savvy.

    Hello! Since you don't have the startup disk your best shot is using fsck. Tom
    when you re-start, hold down the apple key AND the "S" key You'll start up into a command line interface.. it'll look strange but just hang in there. When it's done booting up, you should see something that looks like this: localhost:/ root# at this point, type in 'fsck -f" please note the space before the dash, and of course, ignore the quote marks, then hit return You computer will no go thru some low level checks on your HD. Most likely you'll get a list of a few files that have problems and this procedure will fix them. This should take about 2 or 3 mins, so don't be in a rush. When the line says "VOLUME WAS MODIFIED", this means that changes were made. At this point you should be back at the same localhost:/ root# prompt. run fsck -f again. Wait for it to finish. if you continue to get the "Volume was modified" message, continue to run fsck -f until you'll get a prompt that says The Volume(your HD) appears to be ok, again with the localhost:/ root# prompt. AT this point, type reboot, hit enter and your computer will start up normally. This is not difficult, but you may want to give it a shot when your feel you have a few moments where you can attempt something new and not stress too much.

  • My sceen is flickering and i live in a very small island with no apple store, what can i do? i bought it 3 weeks ago on ebay.

    Hallo, who can help me whit this problem? My band new iphone 5 sceen is flickering and i live on a very small island with no apple store, what can i do? i bought it 3 weeks ago on ebay and just start flickering the next day i recieved it.

    Contact the seller and eBay to return the iPhone for a refund.
    eBay is not an authorized Apple retailer. Sounds like you were sold
    a broken iPhone.

  • Few questions about j2ee and my program

    Hello
    I'm new on this forum and in j2ee :)
    I've to write program which should be in working similar to video on demand system but without streaming movies only database and etc.
    I'm gonna write database in mysql. It will contain user and movies. I'll use the tomcat server.
    Can you tell me what should i learn to do it, i mean can i use jdbc to do it or maybe i should use something diffrent, and what will i need more i mean jsp, servlets?
    Sorry for such a question but i'm just beginner in j2ee and i hope you will help me :)

    Hello
    I'm new on this forum and in j2ee :)Welcome.
    I've to write program which should be in working
    similar to video on demand system but without
    streaming movies only database and etc."streaming database"? Not sure what you mean.
    I'm gonna write database in mysql. It will contain
    user and movies. I'll use the tomcat server.Sounds ambitious for somebody who's new to Java and Java EE
    Can you tell me what should i learn to do it, i mean
    can i use jdbc to do it or maybe i should use
    something diffrent, and what will i need more i mean
    jsp, servlets?Yes, learn JDBC. And servlets and JSPs. That's quite a lot.
    Sorry for such a question but i'm just beginner in
    j2ee and i hope you will help me :)I don't know how this helps you. It seems to go without saying: If you want to write Java EE applications, you should know Java EE well.
    %

Maybe you are looking for

  • I am having trouble previewing.

    Ok to start with my problem -- I can not preview my video timeline at all when i have photoshop files on the timeline making it really hard for me create a video. When i first purchased PS9 & PE9 about three months ago everything worked great i had n

  • How to create a Source system

    Hi All, I am using SAP BW 3.5 and R3 ECC 5 versions (IDES system). Now how to create connections between BW and R3. Can anybody help me.. Thanks in Advance Narendra

  • Should I monitor the SQL Server tempdb for user activity?

    I am currently auditing all databases on SQL Server 2008 R2 for specific events ( database accounts related activity) . I get alot of events generated for tempdb. I am monitoring the following events 47, 102, 103, 104, 105, 108, 109, 110, 111, 113, 1

  • Problem in release strategy in a plant PO. Strategy does not appear

    Hi: I have a problem with release strategy in plant PO. When we create a PO in this plant, we have no tab for release strategy, if I change the plant in PO for a different one I get this tab with all data. I have checked OMGS, CL20N and everything se

  • Cropping to a Fixed Resolution

    Is it possible in Aperture to use the crop tool and have resulting images with the same resolution (resampling)? I ask because I often do slight crops to straighten or for composition and do not wish to send designers a mixed bag of sizes. If I could