Use link instead of RequestDispatcher to forward session objects

I have objects that I pass from a Servlet to JSP using RequestDispatcher type. Now, I was wondering if I can do the same with a link but not sure how I do that:
Servlet called MyServlet.java (or MyServlet in web.xml mapping):
String firstname = request.getParameter("firstname");
String lastname = request.getParameter("lastname");
String city= request.getParameter("city");
String state= request.getParameter("state");
HttpSession session = request.getSession();
session.setAttribute("firstname", firstname);
session.setAttribute("lastname", lastname);
session.setAttribute("city", city);
session.setAttribute("state", state);
RequestDispatcher dispatcher = getServletContex ().getRequestDispatcher("start.jsp");
dispatcher.forward(request, response);
...The above servlet automatically goes to the JSP and shows the firstname,lastname, city and state values that were submitted from a form. What is the equivalent of the RequestDispatcher where I can put a link instead so the user can click on the link and that will take them to the JSP with the session values:
This is not working because takes to a null error page:
response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
                                        "Transitional//EN\">\n" +
                "<HTML>\n" +
                "<HEAD><TITLE>Hello WWW</TITLE></HEAD>\n" +
                "<BODY>\n" +
                "<p><a href="MyServlet">Link to JSP</a></p>\n" +
                "</BODY></HTML>");
.....Please advise.

Not quite sure I understood what you're trying to do...do you want that when the user clicks on a link, he/ she should be taken to your JSP via MyServlet?
If so, then your link simply needs to point to the URL that MyServlet is mapped to.
For example, if your web.xml has the entry:
<servlet-mapping>
    <servlet-name>MyServlet<servlet-name>
    <url-pattern>/MyServlet</url-pattern>
</servlet-mapping>...then your servlet can be accessed at http://[servername]/[context]/MyServlet. So your link needs to point to this, just like it would for other resources like JSPs or HTML pages.
So the line should be:
<a href="/MyServlet">Link to JSP</a> //the exact href value will depend on where you are in your web-app directory structure and how you want to link to your servletAlso, note that you're breaking the String with unescaped quotes.

Similar Messages

  • How to use session object in jsp

    hi all
    marry christmas
    can anyone plz tell me how to use session obect in jsp
    rachna
    Message was edited by:
    rachna_arora82

    hi rachna,
    JSP has a default(implicit) session object...... use the getSession(true) method on the session object and then going u can either get or set attributes depending on the requirement
    That was in general and now with the issue u have got..... what u can do is that the u can create session for every user who logs in and when he/she tries to login again then u can probably check for the existing session object in the JSP and perform the logic as required..... any clarifications plzzzzzzz let me know
    Thanks n Regards
    Naveen M
    Message was edited by:
    Novice_inJAVA
    Message was edited by:
    Novice_inJAVA

  • We are currently looking for a way to link images to a design file within programs like InDesign and Illustrator using an HTML link instead of a local file.  We are hosting our images in SharePoint and need the design file to retain it's links, no matter

    We are currently looking for a way to link images to a design file within programs like InDesign and Illustrator using an HTML link instead of a local file.  We are hosting our images in SharePoint and need the design file to retain it's links, no matter who on our network opens the design file.

    The Cloud forum is not about using individual programs
    The Cloud forum is about the Cloud as a delivery & install process
    If you will start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • Fields "Used " upon Leave Request show carry forward instead of al

    Dear all,
    Staff  have apply 1 days annual leave. However when the staff submit leave request via
    ess, fields "used" in leave request show carry forward leave insteqad of annual leave .
    The staff have carry forward but have fully utilize it before his apply the leave.
    Is there any config can I check why the fields show carry forward?TQ

    it is the same as per backend customisation
    ie T554s absence is connected to which absence quota to deduct using a deduction rule V_556R_B
    (T556C), Please verify.

  • Question regarding using links in Discoverer 10g

    Hi All,
    I have a workbook which uses links. The 1st worksheet is connected to the second worksheet using a simple parameter and link. It works fine.
    But when a users saves this report and tries to use the link, Discoverer tries to open the work sheet from the query which I had created and not the one from the worksheet which the user has saved.
    I am not sure if that the regular feature of the Link functionality or if there is a bug/workaround.
    Is it possible to set these reports to open the worksheet from the saved workbook instead of the original one.
    Any help is appreciated. Please let me know if I have confused you.
    Thanks.

    Hi,
    I've had a look at this on Metalink and there seems to be lots of different bugs with manage links on 10g.
    We build our reports under one user and share it with all other users, easier to manage. We've built some reports exactly has you have and it also works fine. I'll try to resave this as another user and see if we have the same problem.
    For info there are links to several different bugs related to lots of scenarios Here (You'll need metalink access).
    Couldn't find your exact problem in there so you want to raise it with Oracle.
    Regards,
    Lloyd

  • Invalid security certificate for my website host-they say the problem is Apple Safari and use Firefox instead

    For the past few days, I keep getting an invalid security certificate in Safari whenever I select Edit My Site from my website homepage (http://annaporterartist.com), or whenever I select anything requiring a secure log in from my website host main page (FASO.com). I have contacted technical support at my website host (fineartstudioonline.com) and they say that this has been an intermittently recurring problem in Safari for years and they recommend that I use Firefox instead. As proof of this they emailed a link to an Apple Support discussion, but it was for Mac OS X Lion v 10.7.4 and Safari 5.1, even though I told them I am using Mac OS X Mountain Lion v 10.8.2 and Safari 6.0.2. I do not get this error message anywhere else on the web using Safari. I did try Firefox and it seems to work fine, but I prefer Safari and I want to know why Safari is not working as it should be. I am concerned that there is a real security problem with my website host and I need someone to explain why I am getting this error message, what it means, and if it is, in fact, a known problem with Safari or is my website host corrupted? Really tired of technical support playing pass the buck or pretending the problem does not exist.
    The specific error message is:
    Their response to my inquiry and my reply is shown below:

    Back up all data.
    Launch the Keychain Access application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Keychain Access in the icon grid.
    From the menu bar, select
    Keychain Access ▹ Preferences ▹ Certificates
    There are three menus in the window. What is selected in each of them?

  • Using jsessionid to get to the right session

              We've got an odd situation that we've run into using Weblogic Server 8.1 SP2 to
              serve up dynamic VoiceXML pages. Our VoiceXML platform has a VoiceXML browser
              and another component called a compilation server, whose job is to retrieve grammars,
              compile them and make them available for recognition. Although the browser itself
              supports cookies, the compilation server does not.
              Here's the scenario:
              Server A (the browser) makes a request to Weblogic for its initial page, and a
              new session is created. The page that is returned contains a link that includes
              the session ID appended to the end of the URL, so that it looks like this. http://someserver/voice/grammars/grammar.jsp;jsessionid=A0vIhV1RkYzwYI0vcS1b0ykU21YPy2Ww3r9WBzoDAOq04liAWnQf!507937038!1089777544278.
              Server A sends that URL (including the jsessionid) to server B (the compilation
              server), and B uses the URL to fetch a grammar.
              In the HTTP access logs for Weblogic, we see the second request (from B) come
              in, and it contains the correct jsessionid. However, our application logs show
              that a entirely new session is actually created, with a brand new session ID.
              To further test it out, some attributes that were put into the session during
              the initial request are definitely not there on the second request.
              Anyone know how we can make Weblogic use the jsessionid to find the correct session
              rather than create a new one? Our assumption is that since the request is coming
              from a different client, Weblogic is automatically creating a new session.
              

    Our assumption is that          > since the request is coming
              > from a different client, Weblogic is automatically
              > creating a new session.
              Server will create a new session only if the jsessionid is not present in the original request. Making a request from a different client should not make a difference.
              Are you making the request to the same application in both the cases ?
              You may try the following code and access it from diff. client to see the expected result.
              <html>
                   <head>
                        <title>some Application</title>
                   </head>
                   <body>
                   Session is new ==> <%=session.isNew()%> <BR>
                   Session Id is ==> <%=session.getId()%>     <BR>
                   <% if(session.isNew()){
                        session.setAttribute("one","sesion-one");
                             else{
                             out.println("Attribute is " + session.getAttribute("one"));
                   %>     
                   </body>
              </html>

  • ISE 1.2, Patch 7: "NAK requesting to use PEAP instead"

    We're experiencing seemingly random occurrences of users failing authentication because they're trying PEAP vs EAP. Does anyone know if it is possible to force the Windows supplicant to use EAP only?
    For what it's worth, the user can fail authentication for hours and I can either allow open authentication on the port for a bit, or the user can leave for the day and come back tomorrow and authentication will succeed. I'm not sure if it's an ISE problem or a supplicant problem, but I'm leaning towards supplicant.
    Personas:
    Administration
    Role:
    PRIMARY(A)
    System Time:
    Apr 24 2014 08:26:58 AM America/New_York
    FIPS Mode:
    Disabled
    Version:
    1.2.0.899
    Patch Information:
    7,1,3
    11001
    Received RADIUS Access-Request
    11017
    RADIUS created a new session
    15049
    Evaluating Policy Group
    15008
    Evaluating Service Selection Policy
    15048
    Queried PIP
    15048
    Queried PIP
    15004
    Matched rule
    11507
    Extracted EAP-Response/Identity
    12500
    Prepared EAP-Request proposing EAP-TLS with challenge
    12625
    Valid EAP-Key-Name attribute received
    11006
    Returned RADIUS Access-Challenge
    11001
    Received RADIUS Access-Request
    11018
    RADIUS is re-using an existing session
    12301
    Extracted EAP-Response/NAK requesting to use PEAP instead
    12300
    Prepared EAP-Request proposing PEAP with challenge
    12625
    Valid EAP-Key-Name attribute received
    11006
    Returned RADIUS Access-Challenge
    11001
    Received RADIUS Access-Request
    11018
    RADIUS is re-using an existing session
    12302
    Extracted EAP-Response containing PEAP challenge-response and accepting PEAP as negotiated
    12318
    Successfully negotiated PEAP version 0
    12800
    Extracted first TLS record; TLS handshake started
    12805
    Extracted TLS ClientHello message
    12806
    Prepared TLS ServerHello message
    12807
    Prepared TLS Certificate message
    12810
    Prepared TLS ServerDone message
    12305
    Prepared EAP-Request with another PEAP challenge
    11006
    Returned RADIUS Access-Challenge
    11001
    Received RADIUS Access-Request
    11018
    RADIUS is re-using an existing session
    12304
    Extracted EAP-Response containing PEAP challenge-response
    12305
    Prepared EAP-Request with another PEAP challenge
    11006
    Returned RADIUS Access-Challenge
    11001
    Received RADIUS Access-Request
    11018
    RADIUS is re-using an existing session
    12304
    Extracted EAP-Response containing PEAP challenge-response
    12305
    Prepared EAP-Request with another PEAP challenge
    11006
    Returned RADIUS Access-Challenge
    11001
    Received RADIUS Access-Request
    11018
    RADIUS is re-using an existing session
    12304
    Extracted EAP-Response containing PEAP challenge-response
    12305
    Prepared EAP-Request with another PEAP challenge
    11006
    Returned RADIUS Access-Challenge
    11001
    Received RADIUS Access-Request
    11018
    RADIUS is re-using an existing session
    12304
    Extracted EAP-Response containing PEAP challenge-response
    12318
    Successfully negotiated PEAP version 0
    12812
    Extracted TLS ClientKeyExchange message
    12804
    Extracted TLS Finished message
    12801
    Prepared TLS ChangeCipherSpec message
    12802
    Prepared TLS Finished message
    12816
    TLS handshake succeeded
    12310
    PEAP full handshake finished successfully
    12305
    Prepared EAP-Request with another PEAP challenge
    11006
    Returned RADIUS Access-Challenge
    11001
    Received RADIUS Access-Request
    11018
    RADIUS is re-using an existing session
    12304
    Extracted EAP-Response containing PEAP challenge-response
    12313
    PEAP inner method started
    11521
    Prepared EAP-Request/Identity for inner EAP method
    12305
    Prepared EAP-Request with another PEAP challenge
    11006
    Returned RADIUS Access-Challenge
    11001
    Received RADIUS Access-Request
    11018
    RADIUS is re-using an existing session
    12304
    Extracted EAP-Response containing PEAP challenge-response
    11522
    Extracted EAP-Response/Identity for inner EAP method
    11806
    Prepared EAP-Request for inner method proposing EAP-MSCHAP with challenge
    12305
    Prepared EAP-Request with another PEAP challenge
    11006
    Returned RADIUS Access-Challenge
    11001
    Received RADIUS Access-Request
    11018
    RADIUS is re-using an existing session
    12304
    Extracted EAP-Response containing PEAP challenge-response
    11808
    Extracted EAP-Response containing EAP-MSCHAP challenge-response for inner method and accepting EAP-MSCHAP as negotiated
    15041
    Evaluating Identity Policy
    15006
    Matched Default Rule
    15013
    Selected Identity Source - *****
    24431
    Authenticating machine against Active Directory
    24470
    Machine authentication against Active Directory is successful
    22037
    Authentication Passed
    11824
    EAP-MSCHAP authentication attempt passed
    12305
    Prepared EAP-Request with another PEAP challenge
    11006
    Returned RADIUS Access-Challenge
    11001
    Received RADIUS Access-Request
    11018
    RADIUS is re-using an existing session
    12304
    Extracted EAP-Response containing PEAP challenge-response
    11810
    Extracted EAP-Response for inner method containing MSCHAP challenge-response
    11814
    Inner EAP-MSCHAP authentication succeeded
    11519
    Prepared EAP-Success for inner EAP method
    12314
    PEAP inner method finished successfully
    12305
    Prepared EAP-Request with another PEAP challenge
    11006
    Returned RADIUS Access-Challenge
    11001
    Received RADIUS Access-Request
    11018
    RADIUS is re-using an existing session
    12304
    Extracted EAP-Response containing PEAP challenge-response
    15036
    Evaluating Authorization Policy
    24433
    Looking up machine in Active Directory - host/*****
    24435
    Machine Groups retrieval from Active Directory succeeded
    15048
    Queried PIP
    15048
    Queried PIP
    15048
    Queried PIP
    15048
    Queried PIP
    15048
    Queried PIP
    15004
    Matched rule - Default
    15016
    Selected Authorization Profile - DenyAccess
    15039
    Rejected per authorization profile
    12306
    PEAP authentication succeeded
    11503
    Prepared EAP-Success
    11003
    Returned RADIUS Access-Reject 

    salodh,
    Thank you for your response. Below is the authorization policy it should hit. The trouble is the workstation wants to use PEAP for some reason but we don't want PEAP because we're certificate-based. I understand what you're saying, and it's because I didn't word my question correctly. 
    12500
    Prepared EAP-Request proposing EAP-TLS with challenge
    12625
    Valid EAP-Key-Name attribute received
    11006
    Returned RADIUS Access-Challenge
    11001
    Received RADIUS Access-Request
    11018
    RADIUS is re-using an existing session
    12301
    Extracted EAP-Response/NAK requesting to use PEAP instead 
    If the NAK would not request PEAP, it would continue on to the following Authorization Policy (and succeed):
    Name
    Wired-******-PC
     Conditions
    Radius:Service-Type EQUALS Framed
    AND
    Radius:NAS-Port-Type EQUALS Ethernet
    AND
    *******:ExternalGroups EQUALS **********/Users/Domain Computers
    AND
    Network Access:EapAuthentication EQUALS EAP-TLS
    Again, this PEAP request only happens occasionally. This same workstation will work at other days/times. If I could figure out why some workstations randomly request PEAP (or find a way to force EAP only) I think that would take care of it.
    Thanks again, sir.
    Andrew

  • New page opens each time I click on a link instead of staying imbedded on the current page

    Each time I click on a link or delve further into a sight, instead of staying within that sight Firefox opens an entirely new page. At the end of just a few minutes of browsing, the page indicator along the bottom of my screen has dozens of open pages. I can't hit the 'back' button to go back in a sight because Firefox has already opened a new page instead.
    What is up with this and how do I get it to stop?

    Hi,
    Please check if this happens in [https://support.mozilla.com/en-US/kb/Safe%20Mode Safe Mode.] If possible please also try to rule out hardware / mouse settings issues.
    Useful links:
    [https://support.mozilla.com/en-US/kb/Options%20window All about Tools > Options]
    [http://kb.mozillazine.org/About:config Going beyond Tools > Options - about:config]
    [http://kb.mozillazine.org/About:config_entries about:config Entries]
    [https://support.mozilla.com/en-US/kb/Page%20Info%20window Page Info] Tools (Alt + T) > Page Info, Right-click > View Page Info
    [https://support.mozilla.com/en-US/kb/Keyboard%20shortcuts Keyboard Shortcuts]
    [https://support.mozilla.com/en-US/kb/Viewing%20video%20in%20Firefox%20without%20a%20plugin Viewing Video without Plugins]
    [http://kb.mozillazine.org/Profile_folder_-_Firefox Firefox Profile Folder & Files]
    [https://developer.mozilla.org/en/Command_Line_Options#Browser Firefox Commands]
    [https://support.mozilla.com/en-US/kb/Basic%20Troubleshooting Basic Troubleshooting]
    [https://support.mozilla.com/en-US/kb/common-questions-after-upgrading-firefox-36 After Upgrading]
    [https://support.mozilla.com/en-US/kb/Safe%20Mode Safe Mode]
    [http://kb.mozillazine.org/Problematic_extensions Problematic Extensions]
    [https://support.mozilla.com/en-US/kb/Troubleshooting%20extensions%20and%20themes Troubleshooting Extensions and Themes]
    [https://support.mozilla.com/en-US/kb/Troubleshooting%20plugins Troubleshooting Plugins]
    [http://kb.mozillazine.org/Testing_plugins Testing Plugins]

  • .pdf files come up as web links instead of documents

    when I send adobe standard XI produced files to a certain customer they come up as web links instead of documents.  This customer says that they are having no problem opening documents from other people. Any help with this will be appreciated.

    Do you use the SendNow service?
    http://helpx.adobe.com/acrobat-com/kb/using-sendnow.html

  • How do I force Outlook 2010 to use Firefox instead if IE8?

    Whenever I click a link in my emails, it opens in IE8. With only one link, it works fine, but when I click on multiple links in a techie email, IE locks up when dealing with multiple tabs. Firefox works great.
    Where do I change the settings in Outlook 2010 so that links will open using Firefox instead???????
    Help files have not produced an answer.
    This is on a Win 7 Ultimate 32, Office 2010 Military version, with full Outlook 2010.
    TIA

    I found that this link solved my problem for windows 7:
    [http://www.werockyourweb.com/how-do-i-set-default-browser-outlook http://www.werockyourweb.com/how-do-i-set-default-browser-outlook]

  • Connect Non-SAP Oracle db (32bit) in sql 2005 (64 bit) using linked server

    Hi,
    I am connecting Oracle 10g database from SQL 2005 using linked server, in which i get the error
    "Cannot initialize the data source object of OLE DB provider "MSDAORA" for linked server "L2ORACLE".
    OLE DB provider "MSDAORA" for linked server "L2ORACLE" returned message "Oracle client and networking components
    were not found. " (Microsoft SQL Server, Error: 7303)
    SAP Server with sql 2005 db is in 64 bit server / Windows 2003
    Non-SAP Oracle 10g is in 32 bit windows 2003 server.
    i have installed Oracle 64 bit client in the SAP Server and also copied the 64 bit version of dboraslib.dll to the DIR_LIBRARY path. I am able to view the oracle tables in the oracle client.
    But, when i create the linked server, it gives the above error.
    If i install 32 bit version of Oracle client in the SAP Server, i am able to create the linked server in the db level, but, it says "Work Process restarted, session terminated" message in the Z program in SAP.
    The same works in the test environment where both are 32 bit servers. problem is when SAP server is in 64 bit and non sap is in 32 bit.
    Please suggest.
    Thanks and Regards,
    Nagu

    "Cannot initialize the data source object of OLE DB provider "MSDAORA" for linked server "L2ORACLE".
    OLE DB provider "MSDAORA" for linked server "L2ORACLE" returned message "Oracle client and networking components
    were not found. " (Microsoft SQL Server, Error: 7303)
    check the workprocess traces for errors (and/or SM21). It seems that the system is "not aware" that an Oracle client is installed.
    64bit programs can´t load 32bit libraries/DLLs that´s why the workprocess dumps when you use the 32bit client.
    Markus

  • DMS: using BPM instead of WFW

    Hi Experts,
    What do you think of using BPM instead of workflows for DMS distribution or alerts? Does it exist standard modules to implement this?
    Thanks in advance!
    Kind regards,
    Neil

    Hi,
    Did you make up your mind on this? Do share incase you arrived at any concrete conclusion. Would be interested to know.
    From whatever little i know, both the solutions appear so similar and yet are very different. An interesting comparison is presented in the link below, do go through whenever time permits.
    http://sapsolutions.searchsap.com/documents/document;5141982/sap_abstract.htm
    Regards,
    Pradeepkumar Haragoldavar

  • Login issues using linked tables in Microsoft Access

    Hello everyone!!!
    Anybody knows how to set the ODBC Login and password for a group of Oracle ODBC linked tables in MS Access by using DAO or VBA?. I need to use DAO instead of ADO for my application since I use ODBC and an Oracle Database.
    I know I can use the "save password" check box in the linked tables dialog, but I am developing and Access Application for my company and I'm using a generic username for the application itself by I need not to store the password in the connection string because is easy for an end user to obtain.
    I would like to have a form to set the password as long it is opened, and when the form closes, the password is cleared. (Actually, when the control panel form closes, I close Access itself).....
    Is there any way to set the password in the DBEngine.Workspaces object??
    I searched Microsoft Developer web site and there is severan articles about this topic, but none of them work in an Oracle Database.
    Is there any way to communicage with the Oracle Client from the Access application and set the password??
    Thanks, I know it's a very technical question, but is the only thing I need to solve to finish my application.!!!!

    Does anyone know if JDBC can access linked tables
    in a Microsoft Access?I doubt the bridge can. However the link is created using ODBC so you can access it directly.

  • I can't use have JSP code in jsp:forward ?

    when i try to use
    <jsp:forward page="product.jsp?id=<% out.print(bid.getItemID()); %>&action=bidfail" />it dont seem to have any id value?
    i will get something like
    /AuctionProject/product2.jsp?id=<% out.print(bid.getItemID()); %>&action=bidfailhow can i have some jsp code inside the forward url? like in this case i need a item ID

    You can use run time expressions in jsp:forward, but you shouldn't use a scriptlet with out.print(...). Instead use an expression. An expression looks like <%= value to display %> instead of <% out.print(value to display) %>
    <jsp:forward page="product.jsp?id=<%= bid.getItemID() %>&action=bidfail" />See the JSP Syntax Reference at: [http://java.sun.com/products/jsp/syntax/2.0/syntaxref20.html |http://java.sun.com/products/jsp/syntax/2.0/syntaxref20.html]

Maybe you are looking for

  • Apps in iPad 1 open and close quickly

    Hello, My mother has an iPad 1 (she has her own itunes account) but had never synced and updated her iPad with a computer (pc or mac). Today I had to use it and connected to my iTunes on the pc but only to update her iOS on the iPad wich was 3.x. Aft

  • HP 1300 wont print from Remote Desktop applications

    I have an HP 1300n attached via USB to a windows 7 computer.  I log onto a clien'ts windows 2003 server using remote desktop application.  I have installed the driver to HP 1300 PCL 5 on the remote server and of course it's installed on the windows 7

  • Adobe form - Text field not getting saved.

    Hi All, We created an application in which user will enter the data and submit it . The details entered in the screen will be saved in the Ztable. Our problem is when the user enters the data in the TextField UI of the adobe form it is not getting sa

  • IPhone4 syncing failure iOS5

    I have looked online but there doesn't seem to be any solutions offered. Since the iOS5 update I have had on going issues with syncing my iPhone 4. I have tried to remove music and clean up apps, but when I try and apply the change and sync it, the s

  • Impossible de desinstaller et installer itunes error runtime R6034

    lors d'une mise a jour itunes s'est bloque durant l'installation avec erreur runtime R6034. impossible de desinstaller ni reinstaller .