DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   JSP (http://www.daniweb.com/forums/forum24.html)
-   -   JSP ajax question (http://www.daniweb.com/forums/thread113086.html)

Thirusha Mar 10th, 2008 7:36 am
JSP ajax question
 
Hi

I am using ajax and jsp in my web application.
The user is required to fill out a few forms, for this i am using ajax to go through the forms, on one of the forms i need to set the session bean value and i am unsure as to how to do that.

Do i submit the form to a servlet then cause the servlet to redirect to a particular page within the specified div tag.

I have to use struts 1.1 though.

any help will be appreciated.
Thanx

~s.o.s~ Mar 10th, 2008 2:45 pm
Re: JSP ajax question
 
Yes, submit the form to a servlet, perform the processing and redirect to a page whose output you would like to have in responseText attribute of the XMLHttpRequest object.

Thirusha Mar 11th, 2008 5:03 am
Re: JSP ajax question
 
thanx for the reply.

when setting the value in the servlet do i call the setter method ?
or use request.setAttribute() ?

~s.o.s~ Mar 12th, 2008 10:56 pm
Re: JSP ajax question
 
Since you need to set the bean in the session scope, you need to do something like
session.setAttribute("YourBeanName", yourBeanReference);
. Read the form values in a normal manner; the same way you would do for a normal form submission i.e.
request.getParameter("formFieldName");


All times are GMT -4. The time now is 12:54 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC