sudhir wrote: why dont you store the file on server?
actually i want to use actual file data after another request without having the overhead of retrieving it again from server's directory using servlet. would it be better or storing and retrieving again from server be better?
you can have file name or path as a session attribute.
doing so, will the actual file data be available in session attribute?
In general, it's a bad idea to store anything that isn't serializable in session scope. Things like database connections, input streams, and file handles are not serializable because they are not really data structures.
Having non-serializible objects in session scope will cause problems with session persistance and with session replication.
It would be better to read the file when you need it and explicitly close the stream as soon as you're done with it.