New to sessions

i need to open a session in first servlet and use its values in the second one... but i cant find really useful sample and .... i did it this way:
////////////////////in first servlet//////////////////////////////////
HttpSession session = req.getSession(true);
String user1 = req.getParameter("name");
session.setAttribute("user", user1);
String pass1 = req.getParameter("pass");
session.setAttribute("pass", pass1);
//////////////////// in second servlet////////////////////////////////
HttpSession session = req.getSession(false);
try{
aa = session.getAttribute("user").toString();
aaa = session.getAttribute("pass").toString();
pw.println("aa"+aa);
pw.println("aaa"+aaa);
catch(Exception e){ pw.println("exception"+ e.getMessage());}
and i get an exception.... in fact i even don t know how second servlet will understand that it have to use the session , was created in the first one....
please can anyone bring me some light on this things... or maybe some links (in fact i ve seen a lot but anyway i can t get it)
please help
thanks

Here is a working example which I have just made.
Let me know me if that works:
**** servlet 1 ****
public class TestServlet1 extends HttpServlet{
     public void doGet(HttpServletRequest req, HttpServletResponse res)
     throws ServletException, IOException {
          HttpSession session = req.getSession(true);
          ServletOutputStream out = res.getOutputStream();
          try  {
               String user1 = "toto";
               session.setAttribute("user", user1);
               out.print("user stored");
          } catch (Exception e)  {
                    out.println("error :"+e.toString());
}*** servlet 2 ***
public class TestServlet2 extends HttpServlet{
     public void doGet(HttpServletRequest req, HttpServletResponse res)
     throws ServletException, IOException {
          HttpSession session = req.getSession(false);
          ServletOutputStream out = res.getOutputStream();
          try  {
               String user1=session.getAttribute("user").toString();
               out.print("user ="+user1);
          } catch (Exception e)  {
                    out.println("error :"+e.toString());
}Regards

Similar Messages

  • LIBOVD ERROR  - "validateContextToken: workflow session was not found for given context. Create a new workflow session with token"

    Hello everyone,
    I have the following scenario:
    We're using "Oracle SOA Suite 11g 11.1.1.7.0" (Patched w/ 17893896) mainly for a BPM/Human workflow composite. Former, we were having the error bellow:
    <Mar 16, 2015 1:13:03 PM BRT> <Error> <oracle.soa.services.workflow.query> <BEA-000000> <<.> Verification Service cannot resolve user identity. User weblogic cannot be found in the identity repository. Workflow Context token cannot be null in request.
    ORABPEL-30511
    When that error ocurred, no one was able to use the system (BPM/Human Workflow).
    I opened an SR, and after some analysis from the support, it recommended me to set up "virtualize=true" in EM, and restarting the domain. Then it started logging the following:
    connection to ldap://[10.200.10.57]:7001 as cn=Admin.
    javax.naming.NamingException: No LDAP connection available to process request for DN: cn=Admin.
    Looking up on support KB, I found this note Doc ID 1545680.1 and increased from Max size of Connection Pool 10 to 200. That did work successfully! Problem now is that the <SERVER>_diagnostic.log is being filled up with the following error:
    [2015-03-31T16:03:46.421-03:00] [soa_server2] [ERROR] [] [oracle.soa.services.workflow.verification] [tid: [ACTIVE].ExecuteThread: '19' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: e0194e38aa6c9a2f:39fc1ff9:14c5def5247:-8000-00000000000a5653,0] [APP: soa-infra] <.>    validateContextToken: workflow session was not found for given context. Create a new workflow session with token=51490173-e3d0-41dd-ae99-983915aa8454;;G;;Z+P7Oe9ABnoTUQD9ECryEW2l0/8yRcqPDyZsOWBCuzMmRgA3Qsj601TxmWQ87z2MjuwW5AH+KzgjIwkPmhJFdpc1FrE6Y/MrN1bxIDHJWu2/zP3iSNwKD07hRrh/U37Ea0TvaQyuaHJIog9y3Ptmzw==
    One important point is that we're using only the embedded WLS ldap. So I am not 100% sure if we should be using the virtualize flag=true, once all docs I read point out that this should be done when using multi-ldap providers.
    Also, I only got this error in the "diagnostic.log".
    Although, no user has complained about using the system, I really want to work it out. Anyone has any suggestions?
    Thanks in advance!

    I have moved your thread from Certification to SOA Suite to get proper assistance.
    Thanks,
    Lisa

  • Transaction iView(from remote source) does not open a new SAP session

    Hi All,
    We are on portal 7.4 and are calling a transaction from ECC system. Within the transaction we have a button which displays graphs based on the output of the transaction. Since we are calling this transaction from portal, a new session does not open after clicking on this button.
    In order to enable a new session, I have changed the configuration for 'disable new session buttons in SAP GUI' to false yet the new SAP session does not open. I have also verified the webgui setting and ensured that we do not have '~singletransaction' maintained,  yet we are unable to enable the new session. Could you kindly suggest on how I can get this button to function?
    Additional inputs:
    - Referred to note 125814 for changing the new sessions value.
    - Tried changing the iview type to 'SAP GUI for window' from SAP HTML type(which was default).
    - In case I type '/o' in the command box for SAP, it gives me a 'maximum sessions reached' message, but this message does not come when I click on this button. In fact, nothing happens after I click on the button.
    I still think there might be a possibility to enable this, however, I seek your inputs on this.
    Awaiting response...
    Warm Regards,
    Vinay

    Hi Harini,
    thanks for your answer!
    I can tell you that the same command used from the SAP Client open a new session with the same transaction...
    Is strange that from the portal it has a different behaviour...
    Best Regards

  • Can't create a new user session with KDE

    Hi,
    when I select "Switch user" in KDE, and try to start a new user session, I get dropped to a lockscreen of the currently logged-in user. I first thought this was a KDM issue, but this still persists with SDDM. I'd post any relevant logs, but I'm not even sure where to look for the source of the problem now.
    Thanks in advance!

    I have the exact same problem.
    Using:
    kde-meta-*   14.12.1

  • Create New Service Session at Solution Manager = Product System missing

    We have installed SAP EHP 1 for SAP Solution Manager 7.0 last year but not really use it.
    We have setup in the system landscape:
    Server (ecc6sbx)
    Databases (MCD)
    Product System (MCD) => SAP ERP
    Assigned them to logical component (eg ZECC6DEV)
    RFC destination for MCD was generated
    SDCCN Administration at solutions manager display MCD with SDCCN status in green color.
    At the satellite system MCD, SDCCN Maintenance job was created and scheduled. Initial single run was also done.
    There were no issue. Connection to SDCC_OSS was fine.
    Back to the SOLUTION_MANAGER transaction, we created a new solution ECC ERP - Development.
    In the Solution Landscape => Solution Settings, we have assigned the Logical Component into the System Group.
    However when we expand the tree, and click on the Servers folder it did not display anything.
    Click on the Product Systems also did not display anything.
    We have another Solution Manager which display information on those Servers and Product Systems folder for satellite system.
    Going back to the Solution Manager for the Solution ECC ERP - Development, I tried to Create New Service Session for EarlyWatch Alert. When  I click on the Create button, I could only see SAP EarlyWatch Alert for Solutions, there is no SAP EarlyWatch Alert for the Reference Object MCD (<installation number). I could not create a session for MCD.
    Does anyone have ideas what I am missing here? I am trying to attached a document which have print screen for reference while creating this message, but there is no such function here.
    Adding to link to the document file contain print screen
    [Wihtout System and EarlyWatch Selectable.doc|http://www.easy-share.com/1915633524/Wihtout System and EarlyWatch Selectable.doc]
    [With System and EarlyWatch.doc|http://www.easy-share.com/1915633514/With System and EarlyWatch.doc]
    Edited by: Steven Foo on May 24, 2011 8:00 AM
    Edited by: Steven Foo on May 24, 2011 8:18 AM

    Anyway, in the solution manger  how to we setup earlywatch alert for the SM SID host itself (source system)?
    I have the information on the below from our solution manger
    The data for this session is overdue. Data has not yet been transferred from the associated satellite system.
    Go to the Service Data Control Center (transaction SDCCN) in the satellite system and check why the data has not been sent.
    Typical sources of errors are:
    The RFC connection for the SAP Solution Manager system is not working.
    The 'Task Processor' background job, which collects the session data, has been changed.
    Problems arose while data was being collected (see the detail log for the task that collects the session data).
    A periodic 'SDCC Maintenance Package' task has not been scheduled to check whether your SAP Solution Manager system requests session data.
    I tried to go SDCCN on the solution manager itself and look at the Maintenance Service Definitions:
    I get the information:
    No suitable RFC Destination found in SDCCN settings.
    When I click ok I get the following
    No RFC destionation to source system of service definitions available
    Delete Service Definitions (radio button selected).
    I did not continue and cancel it as I did not want to delete anything.
    I check the Task Processor background job is running at SM host itself.
    I managed to get the Maintenance Package job running. However it failed with the following
    Error refreshing service definitions from destination SM_SSMCLNT001_BACK
    Source and target system may not be identical SSM
    The source and target system is the same ==> SSM, will this be an issue?

  • Firefox keeps opening "new tabs" in a whole new firefox session.

    OK so this is probably an easy fix but I just had to wipe my comp and I am in the process of getting all my stuff back so my mind is muddled. That's my excuse anyways.
    My issue is that when I click "open a new tab" Firefox will open a whole new browsing session instead of just a new tab next to the one I am currently on. I have already tried fixing it by going to options and mucking about the tabs options but nothing seems to be helping it.
    Thanks in advance for any help and sorry if this is a repeat question but I couldn't find it on here.
    ~J~

    Do a malware check with some malware scanning programs on the Windows computer.<br>
    Please scan with all programs because each program detects different malware.
    Make sure that you update each program to get the latest version of their databases before doing a scan.
    *Malwarebytes' Anti-Malware:<br>http://www.malwarebytes.org/mbam.php
    *SuperAntispyware:<br>http://www.superantispyware.com/
    *Microsoft Safety Scanner:<br>http://www.microsoft.com/security/scanner/en-us/default.aspx
    *Windows Defender: Home Page:<br>http://www.microsoft.com/windows/products/winfamily/defender/default.mspx
    *Spybot Search & Destroy:<br>http://www.safer-networking.org/en/index.html
    *AdwCleaner:<br>http://www.bleepingcomputer.com/download/adwcleaner/<br>http://www.softpedia.com/get/Antivirus/Removal-Tools/AdwCleaner.shtml
    *Kasperky Free Security Scan:<br>http://www.kaspersky.com/security-scan
    You can also do a check for a rootkit infection with TDSSKiller.
    *Anti-rootkit utility TDSSKiller:<br>http://support.kaspersky.com/5350?el=88446
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked
    If using various malware scanners does not fix it or if you are blocked from installing those scanners then ask advice at a forum that specializes in malware removal.
    *http://forums.majorgeeks.com/index.php - MajorGeeks Support Forums
    *http://www.security-forums.com/index.php - WindowSecurity.com Security Forums
    *http://www.bleepingcomputer.com/forums - Bleeping Computer Forums

  • Windows Server 2008 R2 SP1 RDS hang and stop responding new rdp session. Already connected session also hang as well

    We have a Windows Server 2008 R2 SP1 RDS supporting many ThinClients, mostly using a mandatory profile on a Windows 2003 R2 AD environment
    at the moment of the hang what we experienced was:
    New RDP sessions got stucked in the legend "Iniciando" (we have the spanish MUI).
    Systems Events shows a lot of Warnings:
    The Group Policy Client Side Extension Group Policy Shortcuts may have caused the Group Policy Service to terminate unexpectedly. To prevent further failures in the Group Policy
    Service, this extension has been temporarily disabled until after the next system restart. Group Policy settings managed by this extension may no longer be enforced until the system is restarted. The vendor of this extension should be contacted if this issue
    recurs.
    and after that a lot of this errors:
    A timeout (30000 milliseconds) was reached while waiting for a transaction response from the CryptSvc service.
    A timeout (30000 milliseconds) was reached while waiting for a transaction response from the NlaSvc service.
    The RDP protocol component X.224 detected an error in the protocol stream and has disconnected the client.
    timeout (30000 milliseconds) was reached while waiting for a transaction response from the Schedule service.
    A timeout (30000 milliseconds) was reached while waiting for a transaction response from the gpsvc service.
    A timeout (30000 milliseconds) was reached while waiting for a transaction response from the BITS service.
    A timeout (30000 milliseconds) was reached while waiting for a transaction response from the SessionEnv service.
    A timeout (30000 milliseconds) was reached while waiting for a transaction response from the ShellHWDetection service.
    A timeout (30000 milliseconds) was reached while waiting for a transaction response from the CertPropSvc service.
    A timeout (30000 milliseconds) was reached while waiting for a transaction response from the IKEEXT service.
    A timeout (30000 milliseconds) was reached while waiting for a transaction response from the iphlpsvc service.
    A timeout (30000 milliseconds) was reached while waiting for a transaction response from the SessionEnv service.
    A timeout (30000 milliseconds) was reached while waiting for a transaction response from the iphlpsvc service.
    During the problem we ping DC and Network Share where Profile and Document Redirection resides and they were working OK (we also did a
    \\server\HomeUsers and we reached it without problem)
    Only reseting the server worked, Any Ideas of what could be causing this ?? Best Regards
    Federico Giampietri Latamsupport IT Infrastructure Services

    Hi Clarence,
    Today we experienced the problem again,
    Users can’t login to RDS, but now they got stucked at “"Please wait for the Group Policy client”;
    System log events recorded the following errors again:
    timeout (30000 milliseconds) was reached while waiting for a transaction response from the Schedule service.
    timeout (30000 milliseconds) was reached while waiting for a transaction response from the sessionenv service.
    timeout (30000 milliseconds) was reached while waiting for a transaction response from the ShellHWDetection service.
    timeout (30000 milliseconds) was reached while waiting for a transaction response from the Wuauserv service.
    timeout (30000 milliseconds) was reached while waiting for a transaction response from the BITS service.
    timeout (30000 milliseconds) was reached while waiting for a transaction response from the CertPropSvc service.
    What path do you suggest to investigate further?
    Thanks a lot!
    Federico Giampietri Latamsupport IT Infrastructure Services

  • Have to login username/password everytime I start new broswer session for yahoo mail

    I use yahoo as my start page. each time I start a new browser session I get a blue box that says JavaScript application, Invalid user-name/password. Try entering your email address as your user-name. I have to log in with email address and password every browser session even though the box for 2 weeks is checked. I have downloaded the latest version of Firefox and re downloaded Java, Have cleared all browsing history, cookies, cache etc. I do not have this problem if I switch to internet explorer.

    I use yahoo as my start page. each time I start a new browser session I get a blue box that says JavaScript application, Invalid user-name/password. Try entering your email address as your user-name. I have to log in with email address and password every browser session even though the box for 2 weeks is checked. I have downloaded the latest version of Firefox and re downloaded Java, Have cleared all browsing history, cookies, cache etc. I do not have this problem if I switch to internet explorer.

  • New user session from an existing logged in user browser window

    Hi,
    I have a requirement that says, a new browser window should be popped up with a new user session from the current "logged in user" browser window when he clicks a button event.
    What I have with me is the "UserID" of that new user. Is it possible in portal?
    Let me know.
    Thanks,
    Megha.

    Megha,
    I know that you can manually click CTL-N to open a new browser window and the user is still authenticated. 
    So I would think that you could code a similar function into the button event.
    Hope it helps.
    Regards,
    Keith

  • Which abap statements will start new internal session in the same external

    hi
    which abap statements will start new internal session in the same external

    Hi,
    Generally, the statements SUBMIT and CALL TRANSACTION would create internal session within another.
    However, the addition 'AND RETURN' should be specified upon using SUBMIT statement else without the addition, the internal session will be overwritten with the new program called by using SUBMIT.
    LEAVE TO TRANSACTION also will overwrite the current internal session with the new transaction code.
    Cheers,
    Venkat
    P.S: Kindly reward points for useful answers

  • Af:fileDownloadActionListener - any way to force new browser session?

    Hi all
    I'm using af:fileDownloadActionListener to download a file.
    It works fine except for one thing:
    For some file types it does not open a new browser session but just replaces the existing page content.
    That's really ok by itself, but we have a problem if the users presses the browser Back Button to get back to the application.
    As we're using partial page rendering and af:region this will result in an error:
    Error 403--Forbidden
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    10.4.4 403 Forbidden
    The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable
    So my question is: is there any way of forcing a new browser session to open when using af:fileDownloadActionListener?
    We're using JDeveloper 11.1.1.1.0.
    Regards,
    Tove

    Hello
    I have the same problem
    Frank, is it possible to know when we'll have the correction available.
    It is just to inform our client about this issue.
    Thx
    Jack
    PS: is there a workaround till the correction is done?

  • 5441 Endpoint started new EAP session...

    In test lab, using ISE 1.2. trying to authenticate wireless endpoint from WLC 2500 with code 7.2.103 . But when wireless endpoint trying to connect to 802.1X SSID receiving ISE logs showing following error.
    5441 Endpoint started new EAP session while the packet of previous EAP session  is being processed. Dropping new session
    On endpoint its showing 'Connecting' status for long time...
    To resolve this disconnected endpoint from WLC, also tried to connect to SSID after waiting for considerable time- But No success. Never received error for prior to ISE 1.2. Any Workaround? Any bugs. Any pointer to resolve this,

    Thanks both of you. But I believe some workaround should be there to resolve. Can not wait to release ISE 1.3 . Till that time only way I could see is to rebuild the ISE instance. What do you say ?

  • [svn:bz-4.0.0_fixes] 23961: Bug#3200562: New Flex Session Id generated while disconnect with streaming amf channel

    Revision: 23961
    Revision: 23961
    Author:   [email protected]
    Date:     2012-06-15 04:42:44 -0700 (Fri, 15 Jun 2012)
    Log Message:
    Bug#3200562: New Flex Session Id generated while disconnect with streaming amf channel
    While invalidating session, make sure a new one does not get created.
    Modified Paths:
        blazeds/branches/4.0.0_fixes/modules/core/src/flex/messaging/endpoints/BaseStreamingHTTPE ndpoint.java
    Property Changed:
        blazeds/branches/4.0.0_fixes/modules/

    You're trying to do this directly in ActionScript without using Flex, correct?
    The mxmlc compiler for Flex adds some registerClassAlias calls to map types between the client and the server. This will be missing if try to use the messaging code outside of a Flex app.
    Take a look at the mx.utils.RpcClassAliasInitializer class in rpc.swc. This has a static registerClassAliases method that will do the class registration for you. You should just need to call this before running your messaging code.
    -Alex

  • [svn:bz-4.6.x] 23962: Bug#3200562: New Flex Session Id generated while disconnect with streaming amf channel

    Revision: 23962
    Revision: 23962
    Author:   [email protected]
    Date:     2012-06-15 04:57:45 -0700 (Fri, 15 Jun 2012)
    Log Message:
    Bug#3200562: New Flex Session Id generated while disconnect with streaming amf channel
    While invalidating session, make sure a new one does not get created.
    Modified Paths:
        blazeds/branches/4.6.x/modules/core/src/flex/messaging/endpoints/BaseStreamingHTTPEndpoin t.java

    I thought the same that those devices simply are too old. However I would like to know what causes this capabilities change. We want to get rid of the old H/W, but at the moment it looks as if we would need to revert back to the 4402 in order to get those things working again.
    I have not enough information, but those devices are some kind of handhelds. Their MAC OUI belongs to Newport Electronics.
    Regards,
    Patrick

  • [svn:bz-trunk] 23960: Bug#3200562: New Flex Session Id generated while disconnect with streaming amf channel

    Revision: 23960
    Revision: 23960
    Author:   [email protected]
    Date:     2012-06-15 04:15:18 -0700 (Fri, 15 Jun 2012)
    Log Message:
    Bug#3200562: New Flex Session Id generated while disconnect with streaming amf channel
    While invalidating session, make sure a new one does not get created.
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/endpoints/BaseStreamingHTTPEndpoint.java

  • [svn:bz-trunk] 23948: Bug##3200562: New Flex Session Id generated while disconnect with streaming amf channel

    Revision: 23948
    Revision: 23948
    Author:   [email protected]
    Date:     2012-06-13 06:11:35 -0700 (Wed, 13 Jun 2012)
    Log Message:
    Bug##3200562: New Flex Session Id generated while disconnect with streaming amf channel
    On session time out, Flex Client is invalidated on the server side. It also results in Flex Session getting invalidated. In order to complete the client-server streaming connection handshake, the client ends up sending a CLOSE command. On the server side, for any work to be done, the MB first needs to creates a Flex Session (if none exists). After doing the necessary cleanup, the newly created Flex Session will also be invalidated. No stray Flex Sessions will left dangling...
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/endpoints/BaseStreamingHTTPEndpoint.java

Maybe you are looking for

  • How can I convert my iTunes media from stereo to mono?

    Just a sound preference I would like to have. Lets keep it simple. (iTunes 10.6.1)

  • Reporting issue with ZFS65

    Running zfs65 on nw65 everything seem to be running properly. When I go to run a report from console1, I get the error "unable to log into the database. Ensure that the odbc driver is installed properly." The snmp alerting is working fine because I h

  • Cloning / Libraries

    I have cloned one of my 10.3.2 managed servers. Any clue as to why these don't clone the libraires that are bound to the original? Absolutely a poor design as now I have to bind all 130+ libraries by hand. Anyone know of a way to assign all libraries

  • SAP Standard Transactions are not  Available

    Hi all, I have one issue that we want to start our project system but some SAP Standard Transactions are not available when i check that Transaction its showing "DOES NOT EXIST". I have then Checked Program name of that same SAP Transaction code in S

  • Canon Warranty ???

    I see a number of posts lately by private sellers not, Canon authorized dealers, in various buy and sell forums advertising BNIB 5D III with warranty like this example: " 1 year warranty applies until 12/3/2013. I will provide you a copy of the sales