This week's book giveaways are in the Cloud/Virtualization and Go forums. We're giving away four copies each of Cloud Native Transformation: Practical Patterns for Innovation and The Go Workshop and have the authors on-line! See this thread and this one for details.
Hi, I have been doing a web application related on online shopping. It has file uploading capability.In some forms,I used enctype="multipart/form-data" for the forms. I set some session attributes in the jsps,in which I put enctype as multipart/form-data for the forms. If I tried to get the session attributes in servlets, I got null. How can I retrieve session and other types of attributes from jsps?
I think you're either confusing terms or misinterpreting the problem you're seeing.
I don't think the problem is with the adding or retrieving of variables to or from session. It's most likely that you're not getting the parameters properly. When you respond to multipart requests in your servlets or JSPs, request.getParameter doesn't work. It will always return null. To retrive your form parameters, you'll need to check the documentation for the upload libraries that you're using.
I understood the problem clearly. In multipart request request.getParameter() does not work,I knew. Also I got those type of parameters after checking FileItem's isFormField() method and
fileItemObject.getString() methods. No problem.
My problem is how I can get session attributes set in a jsp,that has multipart/form-data form. I tried for the multipart form and got the session attribute as null. If the request is not multipart, result comes.