This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

AJAX with WebWork or Struts

 
vikas prasad
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to use AJAX in my web application. at present i am using free marker, webwork,spring and hibernate together. i found various example of using AJAX with other technologies. what i wan to know is that what changes should i make in my xwork.xml so that i can handle ajax request. i also want to know how should i send response from my Action to AJAX request.
i know how to use AJAX with simple servlet doget, dopost methods. but if any body can help me or show me simple example to use it with web work than it will be great.
thanks in advance.
Vikas
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what i wan to know is that what changes should i make in my xwork.xml so that i can handle ajax request

You don't have to do anything special at all, just define your action as usual.
i know how to use AJAX with simple servlet doget, dopost methods. but if any body can help me or show me simple example to use it with web work than it will be great.

With WebWork, there is no difference at all.
All what you can do with raw Servlets you can do with WebWork action.

 
vikas prasad
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but the problem is after the action runs, and it maps to :
<action name="admission" class="frontPageAction" method="aboutUs">
<result name="success" type="freemarker">
<param name="location">/template/home/content/Admission.ftl</param>
</result>
</action>

parameter as defined in my result. it reloads the page. i think do i need to use simple servlet dopost methods or doget methods where i dont return any thing. then it will work.
because when we return Success in my execute method it maps to the param that i have defined. i my Xwork.
so is there any other way i can do this
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think do i need to use simple servlet dopost methods or doget methods where i dont return any thing.

If you don't return any thing, why you are using Ajax?
The most basic use of Ajax is to update parts of the page.
parameter as defined in my result. it reloads the page.

What is the type of your result, forward or redirect?
I think you have to set it forward (if it not already is).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic