aspose file tools*
The moose likes Struts and the fly likes Struts 2.1.6: keeping information in the same div - using tree node Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2.1.6: keeping information in the same div - using tree node" Watch "Struts 2.1.6: keeping information in the same div - using tree node" New topic
Author

Struts 2.1.6: keeping information in the same div - using tree node

Mick Smith
Greenhorn

Joined: Dec 10, 2009
Posts: 14
Hello All

I am fairly new to struts. I have been trying to implement the dynamic tree example using <sx:tree> as demonstration in struts-showcase-2.1.6: Tree Example (dynamic).

I have the tree appearing fine and when I click on my nodes the corresponding dojo.bind executes fine and delivers my returned jsp page in the correct div.

However it is when I process information on the resulting jsp in that div, I get taken out of the div! I want to stay in that div and have all future information displayed there.

What do I need to do to constantly keep the executed form on that jsp page, within the div element?

Below are the relevent bits in my jsp page:


dojo.io.bind({

url: "<s:url value='retrieveWBSElementDetail-"+wbsId+".action'/>",

load: function(type, data, evt) {

var divDisplay = dojo.byId("wbsDetails");

divDisplay.innerHTML=data;

},

mimeType: "text/html"

});




<div id="tree">

<sx:tree
id="tree"
rootNode="%{treeRootNode}"
childCollectionProperty="children"
nodeIdProperty="id"
nodeTitleProperty="name"
toggle="explode"
cssClass="tdLabel"
selectedNotifyTopics="treeSelected"
/>
</div>





<sx:div label="WBS" id="wbsDetails" loadingText="Loading..."/>


So when a node is clicked on the tree, wbsDetails div gets popuplated fine. However in the resulting page that gets rendered in the div, when I execute a submit or edit in that div, I get taken out of that page altogether & end up in a new jsp based on actions result. I need to stay in that div. The page that gets rendered in wbsDetails div is a standard jsp page with a form. The form has a submit button, whose target I have put to be wbsDetails. But as already mentioned this doesnt work. I was hoping when i submit that form, the target will take into effect and update my div.





I have also tried to used <sx:bind> on the form containing the page that is rendered in the div. however, as soon as I process something new on this page, I go out of my div and into the resulting jsp as per the struts.xml

help is very much appreciated.

Thanking you so much in advance.

Michael
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts 2.1.6: keeping information in the same div - using tree node