I had some code that worked a long while back, but it is not failing. It sucessfully shared a javabean object between a jsp and a servlet. As memory serves me, the JSP created a bean and set a property, e.g.
In the servlet I had code that included this:
I could then cast the object to an 'Info' object (bean) and get or set properties.
I can no longer get this to work.
Can some one recommend a way or point me to a document that explains this.
Thanks. I have already spend a lot of time researching this without success, so
your help is appreciated.
What does "I can no longer get this to work' mean?
I have a website in development. When it was working, I could:
1) bring up the main page
2) fill out a form
3) submit the form
4) pass the form data as a URI to the java HTTPservlet
[NOTE in this step, a javabean object handle was passed as part
of an HttpServletRequest object from
the JSP page to the servlet]
5) process the URI
6) based on the URI data from the form, the servlet will then
bring up the appropriate response page
The current behavior is identical until step 4. In step 4 the
HttpServletRequest object does not have a handle to the
javabean object, but a 'null' handle. Consequently, the
servlet fails and passes a null URL to the Tomcat server
and the server displays a blank screen.
Regarding code, this site is proprietary and I send the source code 'as is'.
I will create a cleansed version and submit it.
I remember code like that. But I never actually put any of it into production because JSTL and EL had taken over. This was 15 years ago mind you.
However if that code used to create session attributes correctly and now it isn't, then probably something is different in the new environment and your sessions aren't being maintained in the same way.
First, I thank you all for the comments. My background is largely C/C++ and java application programming, not in website development. JSP is really relatively new to me and I can say I have a lot to learn. I have read several books about JSP, but as yet, I have not really gotten the correct flow and communication down right. In fact, flow is part of my problem - in application programming there are general logical flows that get followed while in website development the asynchronous client/server communication does not really lend itself to that type of thinking. I'm still working a getting a GOOD client/server model, before I burn it into my brain.
Second, the good news is that I resolved the problem by going back to an old working development website that I have and doing some comparisons. I probably made about 5 changes in the code and that fixed the problem. Thus, I will be closing this thread as resolved.
Wow! That was quite an article! Thank you for the pointer.
It is an excellent article to direct me to and I have bookmarked it so I can go back it as needed. I'm not sure I really need to read it again, because I got the underlying message. I have the link, just in case.
I know it will not fix all my problems, but my current 'Model 2' is setup for disaster.
I need some time to restructure my 'sample' websites. Hopefully I can then put together a simple website that works as I expect.
Did I say thank you? Thank you, Thank you, Thank you!