moving data between java servlets

dropadrop

Gawd
Joined
Feb 28, 2001
Messages
569
I'm working on a web application made with java servlets and sql. It has data collected from forms and stored into the database. There is also a page with a listing of all the stored stuff, and a chance to view each entry separatly.

I would also like to have the ability to edit each entry, and I'm trying to figure out the simplest way of doing it. On the page that displays a single entry, there would be a link to edit it.The page displaying them allready does a database lookup to get the data, so I think it would be silly for the editing page to do one too.

So what would the best way be? Can I send the data somehow (like hidden form data without a form) from the servlet to the other? Or should I use HttpSession or cookies (I would prefere not to use cookies as I don't need them for anything else).

I've done a few simple servlets, but don't know too much about this... :)

edit: if it makes a differance, I just need to move a few Strings
 
There are many ways to solve kind of trouble.

The easiest is to make every one of your "edit" button in the main displaying page a form. Then you simply put the data into hidden fields so that when the user executes the form, the data is send to the other page.

Although there are far more exiciting ways of resolving this problem. Depending on how much time you are willing to waste trying to create the uber coolest system 3vah!

My personal favorite would be the implementation of a timed hashtable using a java.lang.ref.WeakReference as a key! That would be freakin' awesome :cool:

Or just do it the old boring way... :p
 
Hey!

I think you've awnsered all of my java related questions here, thanks again. :D That really does sound like the simplest way to take care of it, and now I can lose the extra query I made it with.
 
Back
Top