954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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

Thirusha
Posting Whiz
357 posts since Mar 2008
Reputation Points: 36
Solved Threads: 57
 

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.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

thanx for the reply.

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

Thirusha
Posting Whiz
357 posts since Mar 2008
Reputation Points: 36
Solved Threads: 57
 

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");

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You