• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts 2 Ajax Dojo.js reload problem

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am using struts 2 and Dojo to achieve ajax functionality.
Basically i am using two pages parent and child,
Parent page has tabbed panel while child has optiontransferselct control.
I am loading child page through a action called against s:url configured in the parent page , the output is targeted onto a s iv tag on the parent page.
Individually the child page and the ajax control on the page works well. but When i am trying to load the page output on the parent i am getting debug message from dojo ..
"inhibit dojo.js from loading again." When i am click anywhere on the ajax control from the child page , i am getting object expected error.

Please advice how shld i handle this situation.


parent page :
***************************************************************************
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>Main page </title>
<s:head theme="ajax" debug="true" />
</head>
<body>
<s:form id="parent" >
<s:url value="/loadClientFunction.do" id="getClientFunctionList"/>
hello main functions
<s:tabbedPanel id="test" cssStyle="width: 700px; height: 100px;" labelposition="top">
<s iv theme="ajax" id="firstDiv" labelposition="top" label="TP" executeScripts="true">
<s:a theme="ajax" name="a" href="%{getClientFunctionList}" targets="functionListDiv">TP Give application level functions</s:a>
<s:a theme="ajax" name="b" href="%{getClientFunctionList}" targets="functionListDiv">TP Give admin level functions</s:a>
</s iv>
<s iv theme="ajax" id="secondDiv" labelposition="top" label="Xyz" executeScripts="true">
<s:a theme="ajax" name="c" href="%{getClientFunctionList}" targets="functionListDiv">Xyz Give application level functions</s:a>
<s:a theme="ajax" name="d" href="%{getClientFunctionList}" targets="functionListDiv">Xyz Give admin level functions</s:a>
</s iv>
</s:tabbedPanel>
</s:form>
<s iv id="functionListDiv" theme="ajax" cssStyle="border: 1px solid yellow;" href="%{getClientFunctionList}" executeScripts="true" separateScripts="True"/>
</body>
</html>
***************************************************************************
child page :
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<s:head theme="ajax" debug="true" />
</head>
<body>
<s:form id="childForm">
<s ptiontransferselect
label="Employee Records"
name="leftSideEmployeeRecords"
leftTitle="sdfdsf"
rightTitle="JavaJazzUp"
list="{'Deepak Kumar', 'Sushil Kumar','Vinod Kumar','Deepak Monthy',
'Deepak Mihanti', 'Sushil Kumar', 'Ravi Kant Kumar'}"
headerKey="headerKey"
headerValue="--- Please Select ---"
doubleName="rightSideEmployeeRecords"
doubleList="{'Amar Deep Patel', 'Amit Kumar','Chandan Kumar',
'Noor Kumar','Tammana Kumari'}"
doubleHeaderKey="doubleHeaderKey"
doubleHeaderValue="--- Please Select ---" />
</s:form>
</body>
</html>
***************************************************************************
struts.xml
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.action.extension" value="do" />
<package name="helloworldPackage" extends="struts-default" >
<action name="HelloWorld" class="helloworldPackage.HelloWorld" >
<result>/JSP/Login.jsp</result>
</action>
<action name="Logon" class="helloworldPackage.Logon" >
<result name="input">/JSP/Login.jsp </result>
<result>/JSP/MainPage.jsp</result>
</action>
<action name="functionLoad" class="helloworldPackage.functionLoad">
<result>/JSP/ClientApplicationfunctions.jsp</result>
</action>
<action name="loadClientFunction" class="helloworldPackage.functionLoad">
<result>/JSP/ClientApplicationfunctions.jsp</result>
</action>
<action name="*" >
<result>/JSP/{1}.jsp</result>
</action>
<!-- Add your actions here -->
</package>
</struts>
***************************************************************************

[ July 17, 2008: Message edited by: vikram pancholi ]
[ July 17, 2008: Message edited by: vikram pancholi ]
 
vikram pancholi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Debugging out the page rendered, it turned up that when i am loading the child page into the parent page s iv tag, there was problem with the optionselecttransfer control javascript. So included
<script type="text/javascript" src="struts/optiontransferselect.js"></script>
in the head tag of the parent page, which removed all the errors.
I think something is wrong with the separateScripts or executescript attritube on the s iv tag.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic