JQuery event trigger result in WebWork 2.2.x and Struts2, Part 2

Posted Oct 20, 2008 // 3 comments
Jed:

In my last post I showed you how to create a JQuery result type for Struts and WebWork 2.2.x. This post will illustrate how to make use of the result. You will need 3 JSPs: an editor page, a list page, and a “container” page. The container page will typically contain some wrapper-type HTML, a link to add an object and other data that is essentially static in this context. The list page displays the list of objects, and the editor page contains the editor form and its fields.In my last post I showed you how to create a JQuery result type for Struts and WebWork 2.2.x. This post will illustrate how to make use of the result.

You will need 3 JSPs: an editor page, a list page, and a “container” page. The container page will typically contain some wrapper-type HTML, a link to add an object and other data that is essentially static in this context.

The list page displays the list of objects, and the editor page contains the editor form and its fields. The container page has divs that will contain the list and the editor. The contents of each div come from AJAX requests for actions that render the list and editor pages upon success.

We also bind the document the refreshList event that we defined as the “success” result in part 1 to refresh the list when the page is loaded or the editor dialog is closed.

We can also define a delete action that maps success to this event to delete objects from the list and display the result. This is a summary of how to hook this up.

I had originally intended to include code samples and such but I wasn’t sure they would make a whole lot of sense out of context, so I scrapped that idea. Maybe if there is some interest I’ll put together some sample code. Let me know if you’re interested in seeing examples!

About Jed

Senior Software Engineer Jed Prentice brings more than 15 years of experience developing business applications to Phase2 when he works on our client projects. He is an expert in the field of object-oriented software development, and he ...

more >

Read Jed's Blog

Comments

by Ricardo (not verified) on Thu, 11/06/2008 - 05:03

Hi! I find very interesting

Hi!
I find very interesting this post because I’m planing to implement something very similar.
Did you finally uploaded the code anywhere?
Thanks in advance

by Jed on Thu, 11/06/2008 - 08:40

Not Yet

It has proven difficult to come up with god sample code out of context, but at some point I will try to post some.

by Rashid Rashidov (not verified) on Wed, 10/21/2009 - 00:38

Code Sample

Hello there! This is exactly the same case I was dealing with. I was looking for a solution in the internet for days. This morning I was lucky and I found you blog. So I will be very happy if you put a sample code. Thanks in advance. Best regards!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <a> <strong> <code> <p> <img> <ul> <ol> <li> <h2> <h3> <h4> <b> <u> <i>
  • You may insert videos with [video:URL]

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.