Monday, September 8, 2008

JSP page back and forward on Same Page

Hi, Friends

Today I have been faced problem for forwarding from JSP page to servlet and from servlet to the Page (Jsp) from which it is called.

I think you are not understanding...

Let's understand by one example...

Let say, I have three consecutive lists one is for country, second is for state and 3rd one is for city..

And I want to get one by one information. One depends on another one. If I select Country = "india" I will get all the state inside India. And the same way Once I select state I will get city information regarding it.

Now that is very easy using AJAX but consider I don't know AJAX (And right I don't know AJAX. Will learn shortly). Now we have 2 options first one is to on change event of first list data I will send request to server. Server get related information from database. send back to the same page. (dispacher(request, response). All Content I will get as ArrayList at jsp. I will loop this arraylist and get back all related content and put it in list. And the same way change on second list data I will send request to database and get back information.

That is main logic behind it...

Another way is Java Script..(I have not even try for that)

In this one there will be structure of java script such that each elements are connected each other.That is fastes rather then previous one. No server side callings need every time. (that's why)

will right code for that in few time..

Thanks to read my blog.

No comments: