Struts Dynamic includes

Hello all

I want to update dynamic contents in one JSP with structs.

i have following scenerio.

Main.jsp which includes include1.jsp and include2.jsp.

In include1.jsp i display a table when item in table row is clicked , I would call one more Action(execute method) which should update include2.jsp.

I tried to forward from execute()method to main.jsp .

Regards

PAC

[414 byte] By [fiveohga] at [2007-11-27 6:37:29]
# 1

You can try AJAX call. When you click table row in include1.jsp call this ajax action. Have a DIV tag in your include2.jsp, output of your ajax call goes into there.

function getHTTPObject() {

var xmlhttp;

if (window.XMLHttpRequest) // if Mozilla, Safari etc

xmlhttp = new XMLHttpRequest();

else if (window.ActiveXObject){ // if IE

try {

xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

}

catch ( e ){

try{

xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

}

catch ( e ){}

}

}

return xmlhttp;

}

function myAJAX(string1) {

var URL = "requiredAction.do";

var queryString = "name="+escape(string1);

httpObject.open( "Post", URL, true );

httpObject.onreadystatechange = callBackFn;

httpObject.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );

httpObject.send(queryString);

}

function callBackFn() {

if (httpObject.readyState == 4)

{

if (httpObject.status == 200)

{

var result = httpObject.responseText;

//put this result in the <DIV> tag in your include2.jsp

}

}

}

skp71a at 2007-7-12 18:05:54 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...