This is my first post here. I appreciate any help you guys can give me.
I'm having some issues with the technologies listed in the title. I've narrowed this down to a Apache/Tomcat configuration issue (I'm leaning towards tomcat issue).
First of all, my setup:
Apache 2.2.10 -- The server is set to use C:\serverroot as it's base.
Tomcat 6.0.18 -- Set to take any requests from apache's base that end in .jsp and process them. Also has a webapp I made called fap (which is a basically a login gateway).
I can successfully trigger the webapp and send it data via form post. So where's the problem right?
Well after the servlet verifies the username/password I use:
... session.setAttribute("enick", "blarg"); ...
I'm using a literal value for testing so that I don't have to worry about maybe the variable being set incorrectly. Then I redirect the user back to the main page where the jsp is something like this:
... <% out.print(session.getAttribute("enick")); %> ...
Now this always comes back null. I tried using setAttribute right before the display code in the main page. I load the page, then remove the setAttribute, and getAttribute still returns "blarg" as it should. So I thought maybe it was the servlet, so I had not redirect, and then display the value of getAttribute("enick") right after setting it. That works as well.
Then I remembered once while I was still setting up and Tomcat I saw a SESSIONS.ser file. So I went to the Tomcat folder and found the work folder. At some point in the tree structure under the "work" folder there is a "localhost" folder.
The "localhost" folder has 2 subfolders, "fap" and "_". Each has it's own SESSIONS.ser file. Using a hex editor I found the session ID that I was trying to test in BOTH of the SESSIONS files. However only the fap\SESSIONS.ser had the information I had set in the servlet. So to do a test, I copied this SESSIONS.ser over the _\SESSIONS.ser and then turned tomcat on and restarted apache. Low and behold when I loaded the main page again it showed the value the servlet had previously shown.
So I'm led to believe that for some reason the sessions aren't being shared by the JSPs in my root, and the servlets in my webapp. How do I get them to share the same SESSIONS, or should I just get all of them in the servlet and use "web.xml" to make the webapp handle everything under "/" instead of "/fap/".