Problem in session.setAttribute    (like the other user!)

Hello,
when JSP is invoked by the servlet it found ID = null
My Servlet has this code ( I tried to let connection and statement open like you said in another post, but nothing)
The worse thing is that, the first time I tried this code, it worked!
public class Login extends HttpServlet{
     private Connection con;
     private Statement st;
     private ResultSet rs,rs2;
     public void doGet(HttpServletRequest req,HttpServletResponse res) {
          try{
          Class.forName("com.mysql.jdbc.Driver");
          con=DriverManager.getConnection("jdbc:mysql://localhost:3306/gecoprova","root","argoilcane");
          st=con.createStatement();     
          rs=st.executeQuery("SELECT * FROM anagrafe_procuratori WHERE ragsoc='"+req.getParameter("ID")+"'");          
          if(rs!=null){
               if(rs.next())try {
                    st=con.createStatement();
                    rs2=st.executeQuery("SELECT * FROM privilegi_procuratore WHERE (userid='"+req.getParameter("ID")+"' AND pass='"+req.getParameter("pass")+"')");
                    if(rs2!=null){
                         if(rs2.next())try {
                                        HttpSession session=req.getSession(true);
                                        String ID=req.getParameter("ID");
                                        String pass=req.getParameter("pass");
                                          session.setAttribute(pass,pass);
                                        session.setAttribute(ID,ID);
                                        // rs2.close();     
                                        // con.close();
                                        String url = res.encodeRedirectURL("Inserimento.jsp");
                                        res.sendRedirect(url);
               }catch (Exception e){e.printStackTrace();}
               res.sendRedirect("errorlogin.html");
          else{
               res.sendRedirect("errorlogin.html");
               }catch (Exception e){e.printStackTrace();}
               res.sendRedirect("errorlogin.html");
          else{
               res.sendRedirect("errorlogin.html");
          res.sendRedirect("errorlogin.html");
          catch(Exception e){
               try {
                    e.printStackTrace();
                    res.sendRedirect("errorlogin.html");
               catch(Exception e1){}
     }

Hello,
when JSP is invoked by the servlet it found ID =
null
My Servlet has this code ( I tried to let connection
and statement open like you said in another post, but
nothing)
The worse thing is that, the first time I tried this
code, it worked!
public class Login extends HttpServlet{
     private Connection con;
     private Statement st;
     private ResultSet rs,rs2;
public void doGet(HttpServletRequest
t req,HttpServletResponse res) {
          try{
          Class.forName("com.mysql.jdbc.Driver");
          con=DriverManager.getConnection("jdbc:mysql://localh
ost:3306/gecoprova","root","argoilcane");
          st=con.createStatement();     
rs=st.executeQuery("SELECT * FROM
OM anagrafe_procuratori WHERE
ragsoc='"+req.getParameter("ID")+"'");          
          if(rs!=null){
               if(rs.next())try {
                    st=con.createStatement();
rs2=st.executeQuery("SELECT * FROM
FROM privilegi_procuratore WHERE
(userid='"+req.getParameter("ID")+"' AND
pass='"+req.getParameter("pass")+"')");
                    if(rs2!=null){
                         if(rs2.next())try {
                                        HttpSession session=req.getSession(true);
                                        String ID=req.getParameter("ID");
                                        String pass=req.getParameter("pass");
                                          session.setAttribute(pass,pass);
                                        session.setAttribute(ID,ID);
                                        // rs2.close();     
                                        // con.close();
String url =
ng url = res.encodeRedirectURL("Inserimento.jsp");
                                        res.sendRedirect(url);
               }catch (Exception e){e.printStackTrace();}
               res.sendRedirect("errorlogin.html");
          else{
               res.sendRedirect("errorlogin.html");
               }catch (Exception e){e.printStackTrace();}
               res.sendRedirect("errorlogin.html");
          else{
               res.sendRedirect("errorlogin.html");
          res.sendRedirect("errorlogin.html");
          catch(Exception e){
               try {
                    e.printStackTrace();
                    res.sendRedirect("errorlogin.html");
               catch(Exception e1){}
hi ...
i think u retrive the session information in jsp like this ....
session.getAttribute("ID");
session.getAttribute("pass");
if this so .. then u made a mistake in ur servlet code
check wat u write in ur servlet
String ID=req.getParameter("ID");
String pass=req.getParameter("pass");
session.setAttribute(pass,pass);
session.setAttribute(ID,ID);
the first argument of setAttribute method is used as key ... which u set as ID and pass .. but b4 that u set ID and pass to string values that r coming from request...
change the code in servlet to this
String ID=req.getParameter("ID");
String pass=req.getParameter("pass");
session.setAttribute("pass",pass);
session.setAttribute("ID",ID);
i think it will work now
session.getAttribute("ID");
session.getAttribute("ID");

Similar Messages

  • TAB keystroke is inactive in one session, active in the other

    This is a problem I've been experiencing with Tiger, but it is still present with Leopard :
    for some reason, the TAB keystroke (the one above the Permanent-Maj-CAPS keystroke, on the left side of the keyboard) is inactive in one session.
    On the other user session, it works just right. So it is not a "keyboard-hardware" problem (at least...).
    please, help me.... Using a computer with no TAB keystroke is really upsetting...
    thanks.

    Open the Speech pane of System Preferences and check whether either the speech key or the listening key has become set to tab; if so, change the setting.
    (25832)

  • I would like to move 2 users to creative cloud, but maintain all the other users (myself included) on CS5. Can I still get the reduced monthly rate? What serial number should I use?

    I would like to move 2 users to creative cloud, but maintain all the other users (myself included) on CS5. Can I still get the reduced monthly rate? What serial number should I use?

    Hi Thomasjewell,
    Yes you can avail the discounted prices even you are upgrading the product just for two users. You can use the serial number for your Creative Suite 5 product.
    You can follow the link: https://creative.adobe.com/plans in order to purchase Creative Cloud for Teams product.
    Let me know if it works or not.
    Thanks,
    Ratandeep Arora

  • I cannot see other user's tables via the OTHER USERS link

    I'm using SQL Developer version 1.5.0.53 Build MAIN-53.38.
    I log into the database as a user who has SELECT access to tables in other schemas via a ROLE.
    In the SQL window, I can select from those other tables as I expect.
    But, when I go down to the bottom of the screen and expand the Other Users link and then go down to one of the schemas that my account can select from,
    no tables appear.
    I've tried a couple of things so far to no avail.
    1. I first granted SELECT ANY TABLE to my account. I then killed my SQL Developer session and started a fresh session. I'm seeing the same results.
    2. I saw a post in here that said I needed to grant SELECT on the ALL_USERS view. So I removed the SELECT ANY TABLE privilege and granted the SELECT on
    ALL_USERS to my account. Once again, I killed the SQL Developer session and re-logged in. Same results.
    Is this a bug?
    Thanks,
    John

    well, it turns out I'm not as dumb as I though. My end user could still not select from other user's Materialized Views. Some more research showed that granting either SELECT ANY TABLE or SELECT_CATALOG_ROLE fixed the problem for him. I'm sure that a more restrictive grant on one of the DBA_ tables would also work (probably DBA_MVIEWS) but I've not tried that.

  • TS1969 What if I want iTunes to run from the other user's account, but I want to work in my account for a while, without interupting what is playing?  When I switch to my account, how can I STOP iTunes FROM TRYING TO OPEN on my side?

    We like listening to music playing from wife's user account.
    I want to do some work from my account.
    I don't want iTunes to open on my user account. 
    It keeps trying to, giving me the alert beep and the "Cannot Open iTunes" alert.
    How do I make it stop trying to automatically open on one account when it is already playing on the other account?
    Again, I want to keep listening to what is playing through my wife's account, therefore I don't want it to open or try to open on my account.
    Thanks for any guidance.

    Thanks. I messed up with my husbands iphone because I was told the wrong thing. Now everytime I sync his phone it makes it look just like the other phone I had. Do you know how I can fix taht for his phone? Any settings I can turn off that will prevent all of my apps/contacts, etc from auto populating his phone?

  • Windows 7, and I open window, which then flashes across the screen and is then hidden (only on my screen--the other users are able to open Firefox). What can I do?

    There are several different user screens on my computer with each users programs. We all use Firefox on our Windows 7 desktop. However, for the last week, when I hit my Firefox icon, a small window flashes across the screen and is hidden. However, it shows the open window and the default site on the Task Bar, and I cannot browse, although Firefox still works on the other users' screens. What can I do to use it again and still save my Favorites/Bookmarks?

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • BootCamp Black Screen with white cursor not like the others :S

    i searched around but my problem is not like the others i was doing bootcamp  than i put my win 7 cd and reboot but a black screen comes with a  white cursor  and nothing happens and now i dont want the dang win 7 i just want my mac back with my data   i eject the cd and   reboot my mac gray scereen comes and after 10 sec.  black screen comes again says bootable device no found help ! i tried cmd  at the grey screen nothing happens i tried cmd+r   / cmd + alt  / cmd + r +p  / cmd+r+p+alt / cmd+alt+r   and all that stuff it wont do nothing please helllp i cant even recover my recover thing is inside my mac but cant acess there :S  it like im doomed  please help please i use lion

    Mac 101: Using Windows on your Mac via Boot Camp
    https://support.apple.com/kb/HT1461
    Boot Camp 4.0, OS X Lion: Frequently asked question  http://support.apple.com/kb/HT4818  http://manuals.info.apple.com/en_US/boot_camp_install-setup_10.7.pdf
    http://manuals.info.apple.com/en/Boot_Camp_Install-Setup_10.6.pdf
    create a Windows support software (drivers) CD or USB storage media
    http://support.apple.com/kb/HT4407
    The Boot Camp Assistant can burn Boot Camp software (drivers) to a DVD or copy it to a USB storage device, such as a flash drive or hard drive. These are the only media you can use to install Boot Camp software.
    https://support.apple.com/kb/HT4569
    Installation Guide  
    Instructions for all features and settings.
    Boot Camp 4.0 FAQ  Get answers to commonly asked Boot Camp questions.
    Windows 7 FAQ  Answers to commonly asked Windows 7 questions.
    http://www.apple.com/support/bootcamp/
    iMac displays a black screen during installation of Windows 7

  • Ipad air 2 there's no silent mode like the other iPads ?? the button that does it does not exist on the iPad air 2 what does replace it??

    ipad air 2 there's no silent mode like the other iPads ?? the button that does it does not exist on the iPad air 2 what does replace it??

    hi the older button could be set to either "force portrait mode" or "silent mode". now you can do both in the iOS control center (swipe from the bottom of the screen), so the need for a button isn't needed anymore.

  • I have just re-installed itunes.  The previous use is still listed.  When I try to login with my account, Apple says to view my account. When I do that, it revers back to the other user.  How do I get the other user off of my system so that I can use mine

    I have just re-installed itunes.  The previous user is still listed.  When I try to login in with my account, Apple says to view my account.
    When I do that, it reverts back to the other user.  I want the other user totally off of my system.  How do I do this?

    Try Store > Sign Out followed by Store > Sign In...
    tt2

  • We just received our new mac and took it to the store to have the old files from our last computer transferred over.  Now we can't find all our files.  There was more then one user on the old machine.  How can we find the files from the other users?

    We need to find where the files for the other user on the computer are now located.  There were two other users on the old machine, which was taken into the store and ALL files were suppose to be transferred over to this computer. HELP!

    It appears what happened is the installer though it was looking at a empty drive and just went ahead and installed.
    I of course am assuming here you didn't use Disk Utility to format the drive first before installing, that would wipe out your files and programs for sure.
    So what to do, what to do.
    Well there is hope for you as long as the drive wasn't Filevaulted.
    I'll explain. When a hard drive writes data for the first time to a drive, it starts at the very top and works it's way down.
    When OS X was installed the first time, it was at the top of the drive, unless you upgraded then the upgraded OS X could have been written elsewhere.
    Now when you just reinstalled OS X, the new OS went on the top of the drive, overwriting any data that was there previously, so what was there you have lost forever which is about 8GB or so. If it was the previous OS there, then your more in luck because only the old OS X was overwritten.
    The remaining space on the drive still can have a copy of your files, provided it's not overwritten yet.
    It's because when a hard drive deletes data or reformats, it doesn't remove the data off the drive or overwrites it immediately, it's just made so it's SPACE is available for new files to be written there.
    So technically one can recover the deleted data off a non-encrypted/scrubbed hard drive with special software.
    The way it does this is it reads the 1's and 0's of the files themselves, and through a lot of figuring out, can tell what that file is and what it belongs too.
    So what you will have to do is this:
    Create a data recovery/undelete external boot drive
    or if you don't have the skills, then take it to a local PC/Mac tech and they can do a direct image of the drive and then you can run Data Rescue on it to rebuild your files.

  • If I add a new account user,can I sync my iPhone and iPad to that account without effecting the other user?

    If I add a new account user,can I sync my iPhone and iPad to that account without effecting the other user? I'm trying to sync my iPhone and iPad  to a new account on a computer I am now sharing after my computer died.

    Don't create a new iTunes account.
    Just update everything with new info/change password/ security questions.
    -> https://appleid.apple.com/

  • How do I share the iTunes library with all/some of the other users on the same iMac?

    How do I share the iTunes library with all/some of the other users on the same iMac?

    Check out these articles it may help...
    http://support.apple.com/kb/HT3819
    http://www.apple.com/itunes/how-to/#playlists-shareplaylists
    hope this helps.

  • HT2602 I am stuck. I can not figure out how to get the microsoft office that is on my (admin) profile dock onto the dock for the other users on my mac. Can anyone help me out?

    I am stuck. I can not figure out how to get the microsoft office that is on my (admin) profile dock onto the dock for the other users on my mac. Can anyone help me out?

    ebony --
    So, when you open your main Applications folder, there is no Office app there?
    It's in your Users>Applications folder?

  • I put in the code to get the digital copy for star trek into darkness, and i clicked download later, but it didn't show up in my movie library like the other movies i did the same thing to, where is my digital copy of star trek?

    i put in the code to get the digital copy for star trek into darkness, and i clicked download later, but it didn't show up in my movie library like the other movies i did the same thing to, where is my digital copy of star trek?

    Yes, the old album art view is gone, bu you can see the album art for a song that's playing by clicking on the art image and it will open a bigger view.
    Everything else in your post is a waste. I'm not going to spend time reading it. If - and I repeat if, you have a question on how to get the best out of the new look iTunes, post it. But don't spend your time in long rambling negative rants.

  • I just bought a subscription on July 23, 2103 and have been suspended because I haven't bought another year - I have had a months service and would like the other 11 please.

    I just bought a subscription on July 23, 2103 and have been suspended because I haven't bought another year - I have had a months service and would like the other 11 please. Can you get back to me and explain why this is going on?
    Thank you,
    John Maybee
    [email protected]

    Best Contact Customer Care
    If you tell us what exactly you subscribed to, I can move your post to the appropriate forum.

Maybe you are looking for

  • HT1937 Play video on TV?

    Can you play video on to t.v. Using 30 pin to hdmi cable ? I have iphone 4 don't want to Spend 50 if it doesn't work? Thanks

  • I bought an unlocked iphone in dubai and i will use only in Brazil. I will be able to use facetime?

    I bought an unlocked iphone in dubai and i will use only in Brazil. I will be able to use facetime?

  • How to ensure that the query results are fetched from the BW acclerator.

    Hi Experts, Suppose if i want to execute the query with BIA option, I can achieve it in RSRT . 1)But is there some query settings or properties where we can make sure that whenever a query(say Q1) is executed, always the data should be fetched from t

  • BaseLine Index Error

    Hi All, Iam new to Endeca. my question might be silly so please forgive me for that . Iam using ATG 10.1.1 I have configure CRS with Endeca. When Iam running ProductCatalogSimpleIndexingAdmin baseline Index, CommerceTreeService,SchemaExporter and Rep

  • Nokia 6680 Texting Problem

    My daughter has a 6680 and every time she tries to text a message with "General memory full close some applications and try again displays. The inbox is virtually empty as is sent and other boxes. No applications are running either. The phone has a m