You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sajidbigler <sa...@gmail.com> on 2009/03/09 19:27:47 UTC

Cross Browser issues!

Hi friends,
is 
How to resolve cross browser issues.i was doing dynamic tree in firefox it
works fine but in IE the div wont be updated .later i come to conclusion its
bcoz if innerHTML or table,tr,td tags.in the showcase example we don't use
any tables so it works fine onc u wanna use table it screws up .any help
(feedback) is appreciable
-- 
View this message in context: http://www.nabble.com/Cross-Browser-issues%21-tp22414428p22414428.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Cross Browser issues!

Posted by sajidbigler <sa...@gmail.com>.
can go with static initialization as shown in dynamic tree
example.composeMMS.jsp is where i am rendering the tree.other files are
propitiatory and cant share
-- 
View this message in context: http://www.nabble.com/Cross-Browser-issues%21-tp22414428p22427511.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Cross Browser issues!

Posted by Martin Gainty <mg...@hotmail.com>.
ShowDynamicTreeInitializeDAO.java?

Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 




> Date: Mon, 9 Mar 2009 11:50:38 -0700
> From: sajidbigler@gmail.com
> To: user@struts.apache.org
> Subject: Re: Cross Browser issues!
> 
> 
> dynamicTreeSelect.jsp
> 
> <%@taglib prefix="s" uri="/struts-tags"%>
> 
> <%@ taglib prefix="sx" uri="/struts-dojo-tags"%>
> 
> <html>
> <head>
> <sx:head cache="true" debug="true"  />
> <s:head/>
> </head>
> 
> 
> 
> <body>
> 	<%
> 		System.out.println("in jsp nodeId-->"+ request.getParameter("nodeId"));
> 		System.out.println("in jsp nodeName-->"+
> request.getParameter("nodeName"));
> 	%>
> 
> <!-- 
> Id:<s:property value="%{nodeId}" /><br/>
> Name:<s:property value="%{nodeName}" /><br/>
> 
> 
>   -->
> <s:form method="post" enctype="multipart/form-data" id="form1">
> 	<s:textfield name="nodeName" label="Selected Node Name" 
> value="%{nodeName}" />
> 	<s:textfield name="newNode" label="Add Node" />
> 	<s:hidden name="nodeId" label="nodeId" value="%{nodeId}" ></s:hidden>
> 
> 	
> <s:submit type="button" action="addNode"  ></s:submit>
> </s:form>  
> 
> </body>
> </html>
> 
> ComposeMMS.jsp
> 
> <%@ page contentType="text/html; charset=UTF-8" %>
> <%@ taglib prefix="s" uri="/struts-tags"%>
> <%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
> <html>
> <head>
> <title>Service Owner</title>
> <link href="<s:url value='/css/main.css'/>" rel="stylesheet"
> 	type="text/css" />
> <sx:head cache="true" debug="true"/>
> </head>
> 
> <script language="JavaScript" type="text/javascript">
>     dojo.event.topic.subscribe("treeSelected", function
> treeNodeSelected(node) {
>            dojo.io.bind({
>             url: "<s:url
> value='/dynamicTreeSelectAction.action'/>?nodeId="+node.node.widgetId,
>             load: function(type, data, evt) {
>                 var divDisplay = dojo.byId("displayId");
>                 divDisplay.innerHTML=data;
>                  },
>             mimeType: "text/html"
>         });
>     });
> </script>
> 
> <body>
> <div id="container">
> <div id="sitename">
> <h1>MMS Application</h1>
> Subscriptions Management System </div>
> 
> <div id="nav">
> 
> <ul>
> 	<!-- <li> <s:url action= ">Home </li>  -->
> 	<li> "<s:url value='/pages/Home.jsp'  ">Home </li>
> 		<s:if
> test="(#session.ownerobj.role).equalsIgnoreCase('ApplicationOwner')">
> 	<li > "<s:url value='/pages/ServiceOwner.jsp'  ">Service Owner  </li>
> 	</s:if>
> 	<li id="current"> # MMS </li>
> 	<li> "<s:url value='/pages/UploadImages.jsp'  ">Images  </li>
> 	<li> "<s:url value='/pages/ComposeSMS.jsp'  ">SMS </li>
> 	<li> "<s:url value='/pages/ComposeSubscriptions.jsp'  ">Subscriptions 
> </li>
> 	<li> "<s:url value='/pages/CustomizeSubscriptions.jsp'  ">Categories  </li>
> </ul>	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;User  :   <s:property
> value="#session.ownerobj.username"/> 
> <p class="hide"> #top Back to top </p>
> </div>
> <div id="wrap1">
> <div id="wrap2">
> 
> <div id="topbox"><strong>Create MMS Message &raquo; </strong> "<%=
> request.getContextPath() % /logout.action">Logout </div>
> <div style="float:left; margin-right: 50px;">
> 
> <sx:tree 
>     id="tree"
>     rootNode="%{treeRootNode}" 
>     childCollectionProperty="children" 
>     nodeIdProperty="id"
>     nodeTitleProperty="name"
>     treeSelectedTopic="treeSelected">
> </sx:tree> 
> </div>
> 
> 
> <div id="content">
> 
> <s:actionerror /> <s:fielderror /> 
> <s:form action="MMSUpload"
> 	method="POST" enctype="multipart/form-data">
> 	<div id="displayId"></div>
> 	<s:textfield name="MMSFrom" label="MMS From " />
> 	<s:textfield name="MMSSubject" label="MMS Subject" />
> 	<s:textfield name="MMSText" label="MMS Text" />
> 	<s:textfield name="MMSName" label="MMS Name" />
> 	<s:file name="upload" label="File 1" />
> 	<s:file name="upload" label="File 2" />
> 	<s:file name="upload" label="File 3" />
> 	<s:file name="upload" label="File 4" />
> 	<s:file name="upload" label="File 5" />
> 	<s:file name="upload" label="File 6" />
> 	<s:file name="upload" label="File 7" />
> 	<s:file name="upload" label="File 8" />
> 	<s:file name="upload" label="File 9" />
> 	<s:file name="upload" label="File 10" />
> 	<s:submit align="center"/>
> 
> </s:form>
> 
> </div>
> 
> </div>
> <div id="footer">
> <p>&copy; 2009 Teleparadigm | Original design by 
> http://teleparadigm.com/contactus.html Teleparadigm </p>
> </div>
> </div>
> </div>
> </body>
> </html>
> 
> 
> struts.xml
> 
> 		<action name="showDynamicTreeAction"
> 		
> class="com.teleparadigm.mms.application.dynamictree.ShowDynamicTreeAction">
> 			<result name="error" type="redirect">/index.jsp</result>
> 			<result>/pages/ComposeMMS.jsp</result>
> 		</action>
> 		<action name="dynamicTreeSelectAction"
> 		
> class="com.teleparadigm.mms.application.dynamictree.DynamicTreeSelectAction">
> 			<result name="error" type="redirect">/index.jsp</result>
> 			<result>/pages/dynamicTreeSelect.jsp</result>
> 		</action>
> 		<action name="addNode"
> 		
> class="com.teleparadigm.mms.application.dynamictree.DynamicTreeAddNodeAction">
> 			<result name="error" type="redirect">/index.jsp</result>
> 			<result type="redirect">showDynamicTreeAction</result>
> 		</action>
> 
> 
> DynamicTreeAddNodeAction.java
> 
> package com.teleparadigm.mms.application.dynamictree;
> 
> import java.util.Enumeration;
> import java.util.Map;
> 
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
> import javax.servlet.http.HttpSession;
> 
> import org.apache.struts2.ServletActionContext;
> import org.apache.struts2.dispatcher.StrutsRequestWrapper;
> import org.apache.struts2.interceptor.ServletRequestAware;
> import org.apache.struts2.interceptor.ServletResponseAware;
> import org.apache.struts2.interceptor.SessionAware;
> 
> import com.opensymphony.xwork2.ActionSupport;
> import com.teleparadigm.mms.application.common.Owner;
> import com.teleparadigm.mms.application.utills.Configuration;
> 
> public class DynamicTreeAddNodeAction extends ActionSupport implements
> ServletRequestAware,ServletResponseAware,SessionAware
> {
> 
> 	Configuration conf = null;
> 	private String nodeId;
> 	private String nodeName;
> 	private String newNode;
> 	private Map session;
> 	private HttpServletRequest request;
> 	private HttpServletResponse response;
> 	public void setSession(Map session){
> 		session=this.getSession();
> 	}
> 	private Map getSession() {
> 		return session;
> 	}
> 	public void setServletRequest(HttpServletRequest request){
> 		this.request = request;
> 	}
> 
> 	public HttpServletRequest getServletRequest(){
> 		return request;
> 	}
> 
> 	public void setServletResponse(HttpServletResponse response){
> 		this.response = response;
> 	}
> 
> 	public HttpServletResponse getServletResponse(){
> 		return response;
> 	}
> 
> 
> 	public String execute() throws Exception {
> 
> 		HttpSession session=request.getSession(false);
> 		DynamicTreeAddNodeDAO dtadao=new DynamicTreeAddNodeDAO();
> 		if(session==null ){
> 
> 			addActionError("Invalid Session! Please Relogin!");
> 			return ERROR;	
> 		}
> 		Owner ownerobj=(Owner)session.getAttribute("ownerobj");
> 		if(ownerobj==null){
> 
> 			addActionError("Invalid User Session!");
> 			return ERROR;
> 		}
> 
> 		StrutsRequestWrapper requestwrapper = (StrutsRequestWrapper)
> ServletActionContext.getRequest();
> 		System.out.println("<----DynamicTreeAddNode-->");
> 		Enumeration enumeration=requestwrapper.getParameterNames(); 
> 		while(enumeration.hasMoreElements()){
> 			String name=(String)enumeration.nextElement();
> 			System.out.println("<----name-->"+name);
> 			String value= requestwrapper.getParameter(name);
> 			if(name.equalsIgnoreCase("nodeId")){
> 				value=value.replaceAll(",", "");
> 				System.out.println("<----value-long-->"+Long.parseLong(value));
> 				}
> 			else
> 			{
> 				System.out.println("<----value--->"+value);
> 			}
> 
> 		}
> 		dtadao.addSubNodeEditRootNode(Long.parseLong((getNodeId().replaceAll(",",
> ""))),getNodeName(),getNewNode(),ownerobj.getProviderid());
> 		return SUCCESS;
> 	}
> 	public String getNodeId() {
> 		return nodeId;
> 	}
> 	public void setNodeId(String nodeId) {
> 		this.nodeId = nodeId;
> 	}
> 	public String getNodeName() {
> 		return nodeName;
> 	}
> 	public void setNodeName(String nodeName) {
> 		this.nodeName = nodeName;
> 	}
> 	public String getNewNode() {
> 		return newNode;
> 	}
> 	public void setNewNode(String newNode) {
> 		this.newNode = newNode;
> 	}
> 
> 
> }
> 
> //START SNIPPET: treeExampleDynamicJavaSelected
> 
> DynamicTreeSelectAction.java
> 
> package com.teleparadigm.mms.application.dynamictree;
> 
> 
> import java.util.HashMap;
> import java.util.Map;
> 
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpSession;
> 
> import org.apache.struts2.interceptor.ServletRequestAware;
> 
> import com.opensymphony.xwork2.ActionSupport;
> import com.teleparadigm.mms.application.common.Owner;
> public class DynamicTreeSelectAction extends ActionSupport implements
> ServletRequestAware{
> 	private HttpServletRequest request;
> 	Category category=null;
> 	Map<String, String> catMap = null;
> 	public void setServletRequest(HttpServletRequest request){
> 		this.request = request;
> 	}
> 
> 	public HttpServletRequest getServletRequest(){
> 		return request;
> 	}
> 
> 	private String nodeId;
> 	private String currentCategoryName;
> 
> 
> 	public void setNodeId(String nodeId) {
> 		this.nodeId = nodeId;
> 	}
> 	public String getNodeId() {
> 		return nodeId;
> 	}
> 
> 
> 	public String execute() throws Exception {
> 
> 		HttpSession session=request.getSession(false);
> 
> 		if(session==null ){
> 
> 			addActionError("Invalid Session! Please Relogin!");
> 			return ERROR;	
> 		}
> 		Owner ownerobj=(Owner)session.getAttribute("ownerobj");
> 		if(ownerobj==null){
> 
> 			addActionError("Invalid User Session!");
> 			return ERROR;
> 		}
> 		System.out.println("nodeId--->"+nodeId);
> 		category=(Category)session.getAttribute("tree");
> 		catMap=(HashMap)session.getAttribute("treeMap");
> 		if(nodeId!=null ){
> 			nodeId=nodeId.replaceAll(",","");
> 			currentCategoryName = (String)catMap.get(nodeId);
> 		}
> 
> 		return SUCCESS;
> 	}
> 
> 
> 	public String getNodeName() {
> 		return currentCategoryName != null ? currentCategoryName : "Root";
> 	}
> }
> 
> //START SNIPPET: treeExampleDynamicJavaSelected
> 
> ShowDynamicTreeAction.java
> 
> package com.teleparadigm.mms.application.dynamictree;
> 
> import java.util.Iterator;
> import java.util.List;
> import java.util.Map;
> import java.util.Set;
> 
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpSession;
> 
> import org.apache.struts2.interceptor.ServletRequestAware;
> 
> import com.opensymphony.xwork2.ActionSupport;
> import com.teleparadigm.mms.application.common.Owner;
> import com.teleparadigm.mms.application.utills.TablesEntityManager;
> 
> //START SNIPPET: treeExampleDynamicJavaShow
> 
> public class ShowDynamicTreeAction extends ActionSupport implements
> ServletRequestAware{
> 	private HttpServletRequest request;
> 
> 	Category treeRootNode;
> 
> 	public void setServletRequest(HttpServletRequest request){
> 		this.request = request;
> 	}
> 
> 	public HttpServletRequest getServletRequest(){
> 		return request;
> 	}
> 	public String execute() throws Exception {
> 		Category category=null;
> 		HttpSession session=request.getSession(false);
> 		
> 		if(session==null ){
> 			
> 			addActionError("Invalid Session! Please Relogin!");
> 			return ERROR;	
> 		}
> 		Owner ownerobj=(Owner)session.getAttribute("ownerobj");
> 		if(ownerobj==null){
> 			
> 			addActionError("Invalid User Session!");
> 			return ERROR;
> 		}
> 
> 		long providerid=ownerobj.getProviderid();
> 		String initialRoot=null;
> 		ShowDynamicTreeInitializeDAO sdtidao=new ShowDynamicTreeInitializeDAO();
> 		
> 		sdtidao.initializeTree(providerid,session);
> 		category=(Category)session.getAttribute("tree");
> 		
> 		setTreeRootNode(category);
> 		return SUCCESS;
> 	}
> 	public Category getTreeRootNode() {
> 		return treeRootNode;
> 	}
> 	/*public Category getTreeRootNode() {
> 		HttpSession session=request.getSession(false);
> 		Owner ownerobj=(Owner)session.getAttribute("ownerobj");
> 		String providerid=ownerobj.getProviderid();
> 
> 		String initialRoot=category.initializeTree(providerid);
> 		System.out.println("Initial Root Node-->"+initialRoot);
> 
> 		System.out.println("ShowDynamicTreeAction
> category1.getById(Long.parseLong(initialRoot))-->"+(category1.getById(Long.parseLong(initialRoot))).getName());
> 		return category1.getById(Long.parseLong(initialRoot));
> 	}*/
> 
> 	public void setTreeRootNode(Category treeRootNode) {
> 		this.treeRootNode = treeRootNode;
> 	}
> }
> 
> //END SNIPPET: treeExampleDynamicJavaShow
> 
> Category.java
> 
> package com.teleparadigm.mms.application.dynamictree;
> 
> import java.util.ArrayList;
> import java.util.HashMap;
> import java.util.List;
> import java.util.Map;
> 
> /**
>  */
> public class Category {
> 
> 	private long id;
> 	private String name;
> 	private List<Category> children;
> 	private boolean toggle;
> 
> 	public Category(long id, String name, Category... children) {
> 		this.id = id;
> 		this.name = name;
> 		this.children = new ArrayList<Category>();
> 		for (Category child : children) {
> 			System.out.println("child.getName()->"+child.getName());
> 			if(child!=null && !child.getName().equalsIgnoreCase("dummy") ){
> 				System.out.println("Its added");
> 				this.children.add(child);
> 			}else{
> 				System.out.println("Child  Null or Dummy");
> 			}
> 		}
> 
> 	}
> 
> 	public long getId() {
> 		return id;
> 	}
> 
> 	public void setId(long id) {
> 		this.id = id;
> 	}
> 
> 	public String getName() {
> 		return name;
> 	}
> 
> 	public void setName(String name) {
> 		this.name = name;
> 	}
> 
> 	public List<Category> getChildren() {
> 		return children;
> 	}
> 
> 	public void setChildren(List<Category> children) {
> 		this.children = children;
> 	}
> 
> 	public void toggle() {
> 		toggle = !toggle;
> 	}
> 
> 	public boolean isToggle() {
> 		return toggle;
> 	}
> }
> 
> -- 
> View this message in context: http://www.nabble.com/Cross-Browser-issues%21-tp22414428p22415535.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
HotmailĀ® is up to 70% faster. Now good news travels really fast. 
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_70faster_032009

Re: Cross Browser issues!

Posted by sajidbigler <sa...@gmail.com>.
dynamicTreeSelect.jsp

<%@taglib prefix="s" uri="/struts-tags"%>

<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>

<html>
<head>
<sx:head cache="true" debug="true"  />
<s:head/>
</head>



<body>
	<%
		System.out.println("in jsp nodeId-->"+ request.getParameter("nodeId"));
		System.out.println("in jsp nodeName-->"+
request.getParameter("nodeName"));
	%>

<!-- 
Id:<s:property value="%{nodeId}" /><br/>
Name:<s:property value="%{nodeName}" /><br/>


  -->
<s:form method="post" enctype="multipart/form-data" id="form1">
	<s:textfield name="nodeName" label="Selected Node Name" 
value="%{nodeName}" />
	<s:textfield name="newNode" label="Add Node" />
	<s:hidden name="nodeId" label="nodeId" value="%{nodeId}" ></s:hidden>

	
<s:submit type="button" action="addNode"  ></s:submit>
</s:form>  

</body>
</html>

ComposeMMS.jsp

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<html>
<head>
<title>Service Owner</title>
<link href="<s:url value='/css/main.css'/>" rel="stylesheet"
	type="text/css" />
<sx:head cache="true" debug="true"/>
</head>

<script language="JavaScript" type="text/javascript">
    dojo.event.topic.subscribe("treeSelected", function
treeNodeSelected(node) {
           dojo.io.bind({
            url: "<s:url
value='/dynamicTreeSelectAction.action'/>?nodeId="+node.node.widgetId,
            load: function(type, data, evt) {
                var divDisplay = dojo.byId("displayId");
                divDisplay.innerHTML=data;
                 },
            mimeType: "text/html"
        });
    });
</script>

<body>
<div id="container">
<div id="sitename">
<h1>MMS Application</h1>
Subscriptions Management System </div>

<div id="nav">

<ul>
	<!-- <li> <s:url action= ">Home </li>  -->
	<li> "<s:url value='/pages/Home.jsp'  ">Home </li>
		<s:if
test="(#session.ownerobj.role).equalsIgnoreCase('ApplicationOwner')">
	<li > "<s:url value='/pages/ServiceOwner.jsp'  ">Service Owner  </li>
	</s:if>
	<li id="current"> # MMS </li>
	<li> "<s:url value='/pages/UploadImages.jsp'  ">Images  </li>
	<li> "<s:url value='/pages/ComposeSMS.jsp'  ">SMS </li>
	<li> "<s:url value='/pages/ComposeSubscriptions.jsp'  ">Subscriptions 
</li>
	<li> "<s:url value='/pages/CustomizeSubscriptions.jsp'  ">Categories  </li>
</ul>	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;User  :   <s:property
value="#session.ownerobj.username"/> 
<p class="hide"> #top Back to top </p>
</div>
<div id="wrap1">
<div id="wrap2">

<div id="topbox"><strong>Create MMS Message &raquo; </strong> "<%=
request.getContextPath() % /logout.action">Logout </div>
<div style="float:left; margin-right: 50px;">

<sx:tree 
    id="tree"
    rootNode="%{treeRootNode}" 
    childCollectionProperty="children" 
    nodeIdProperty="id"
    nodeTitleProperty="name"
    treeSelectedTopic="treeSelected">
</sx:tree> 
</div>


<div id="content">

<s:actionerror /> <s:fielderror /> 
<s:form action="MMSUpload"
	method="POST" enctype="multipart/form-data">
	<div id="displayId"></div>
	<s:textfield name="MMSFrom" label="MMS From " />
	<s:textfield name="MMSSubject" label="MMS Subject" />
	<s:textfield name="MMSText" label="MMS Text" />
	<s:textfield name="MMSName" label="MMS Name" />
	<s:file name="upload" label="File 1" />
	<s:file name="upload" label="File 2" />
	<s:file name="upload" label="File 3" />
	<s:file name="upload" label="File 4" />
	<s:file name="upload" label="File 5" />
	<s:file name="upload" label="File 6" />
	<s:file name="upload" label="File 7" />
	<s:file name="upload" label="File 8" />
	<s:file name="upload" label="File 9" />
	<s:file name="upload" label="File 10" />
	<s:submit align="center"/>

</s:form>

</div>

</div>
<div id="footer">
<p>&copy; 2009 Teleparadigm | Original design by 
http://teleparadigm.com/contactus.html Teleparadigm </p>
</div>
</div>
</div>
</body>
</html>


struts.xml

		<action name="showDynamicTreeAction"
		
class="com.teleparadigm.mms.application.dynamictree.ShowDynamicTreeAction">
			<result name="error" type="redirect">/index.jsp</result>
			<result>/pages/ComposeMMS.jsp</result>
		</action>
		<action name="dynamicTreeSelectAction"
		
class="com.teleparadigm.mms.application.dynamictree.DynamicTreeSelectAction">
			<result name="error" type="redirect">/index.jsp</result>
			<result>/pages/dynamicTreeSelect.jsp</result>
		</action>
		<action name="addNode"
		
class="com.teleparadigm.mms.application.dynamictree.DynamicTreeAddNodeAction">
			<result name="error" type="redirect">/index.jsp</result>
			<result type="redirect">showDynamicTreeAction</result>
		</action>


DynamicTreeAddNodeAction.java

package com.teleparadigm.mms.application.dynamictree;

import java.util.Enumeration;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.dispatcher.StrutsRequestWrapper;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;
import com.teleparadigm.mms.application.common.Owner;
import com.teleparadigm.mms.application.utills.Configuration;

public class DynamicTreeAddNodeAction extends ActionSupport implements
ServletRequestAware,ServletResponseAware,SessionAware
{

	Configuration conf = null;
	private String nodeId;
	private String nodeName;
	private String newNode;
	private Map session;
	private HttpServletRequest request;
	private HttpServletResponse response;
	public void setSession(Map session){
		session=this.getSession();
	}
	private Map getSession() {
		return session;
	}
	public void setServletRequest(HttpServletRequest request){
		this.request = request;
	}

	public HttpServletRequest getServletRequest(){
		return request;
	}

	public void setServletResponse(HttpServletResponse response){
		this.response = response;
	}

	public HttpServletResponse getServletResponse(){
		return response;
	}


	public String execute() throws Exception {

		HttpSession session=request.getSession(false);
		DynamicTreeAddNodeDAO dtadao=new DynamicTreeAddNodeDAO();
		if(session==null ){

			addActionError("Invalid Session! Please Relogin!");
			return ERROR;	
		}
		Owner ownerobj=(Owner)session.getAttribute("ownerobj");
		if(ownerobj==null){

			addActionError("Invalid User Session!");
			return ERROR;
		}

		StrutsRequestWrapper requestwrapper = (StrutsRequestWrapper)
ServletActionContext.getRequest();
		System.out.println("<----DynamicTreeAddNode-->");
		Enumeration enumeration=requestwrapper.getParameterNames(); 
		while(enumeration.hasMoreElements()){
			String name=(String)enumeration.nextElement();
			System.out.println("<----name-->"+name);
			String value= requestwrapper.getParameter(name);
			if(name.equalsIgnoreCase("nodeId")){
				value=value.replaceAll(",", "");
				System.out.println("<----value-long-->"+Long.parseLong(value));
				}
			else
			{
				System.out.println("<----value--->"+value);
			}

		}
		dtadao.addSubNodeEditRootNode(Long.parseLong((getNodeId().replaceAll(",",
""))),getNodeName(),getNewNode(),ownerobj.getProviderid());
		return SUCCESS;
	}
	public String getNodeId() {
		return nodeId;
	}
	public void setNodeId(String nodeId) {
		this.nodeId = nodeId;
	}
	public String getNodeName() {
		return nodeName;
	}
	public void setNodeName(String nodeName) {
		this.nodeName = nodeName;
	}
	public String getNewNode() {
		return newNode;
	}
	public void setNewNode(String newNode) {
		this.newNode = newNode;
	}


}

//START SNIPPET: treeExampleDynamicJavaSelected

DynamicTreeSelectAction.java

package com.teleparadigm.mms.application.dynamictree;


import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.interceptor.ServletRequestAware;

import com.opensymphony.xwork2.ActionSupport;
import com.teleparadigm.mms.application.common.Owner;
public class DynamicTreeSelectAction extends ActionSupport implements
ServletRequestAware{
	private HttpServletRequest request;
	Category category=null;
	Map<String, String> catMap = null;
	public void setServletRequest(HttpServletRequest request){
		this.request = request;
	}

	public HttpServletRequest getServletRequest(){
		return request;
	}

	private String nodeId;
	private String currentCategoryName;


	public void setNodeId(String nodeId) {
		this.nodeId = nodeId;
	}
	public String getNodeId() {
		return nodeId;
	}


	public String execute() throws Exception {

		HttpSession session=request.getSession(false);

		if(session==null ){

			addActionError("Invalid Session! Please Relogin!");
			return ERROR;	
		}
		Owner ownerobj=(Owner)session.getAttribute("ownerobj");
		if(ownerobj==null){

			addActionError("Invalid User Session!");
			return ERROR;
		}
		System.out.println("nodeId--->"+nodeId);
		category=(Category)session.getAttribute("tree");
		catMap=(HashMap)session.getAttribute("treeMap");
		if(nodeId!=null ){
			nodeId=nodeId.replaceAll(",","");
			currentCategoryName = (String)catMap.get(nodeId);
		}

		return SUCCESS;
	}


	public String getNodeName() {
		return currentCategoryName != null ? currentCategoryName : "Root";
	}
}

//START SNIPPET: treeExampleDynamicJavaSelected

ShowDynamicTreeAction.java

package com.teleparadigm.mms.application.dynamictree;

import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.interceptor.ServletRequestAware;

import com.opensymphony.xwork2.ActionSupport;
import com.teleparadigm.mms.application.common.Owner;
import com.teleparadigm.mms.application.utills.TablesEntityManager;

//START SNIPPET: treeExampleDynamicJavaShow

public class ShowDynamicTreeAction extends ActionSupport implements
ServletRequestAware{
	private HttpServletRequest request;

	Category treeRootNode;

	public void setServletRequest(HttpServletRequest request){
		this.request = request;
	}

	public HttpServletRequest getServletRequest(){
		return request;
	}
	public String execute() throws Exception {
		Category category=null;
		HttpSession session=request.getSession(false);
		
		if(session==null ){
			
			addActionError("Invalid Session! Please Relogin!");
			return ERROR;	
		}
		Owner ownerobj=(Owner)session.getAttribute("ownerobj");
		if(ownerobj==null){
			
			addActionError("Invalid User Session!");
			return ERROR;
		}

		long providerid=ownerobj.getProviderid();
		String initialRoot=null;
		ShowDynamicTreeInitializeDAO sdtidao=new ShowDynamicTreeInitializeDAO();
		
		sdtidao.initializeTree(providerid,session);
		category=(Category)session.getAttribute("tree");
		
		setTreeRootNode(category);
		return SUCCESS;
	}
	public Category getTreeRootNode() {
		return treeRootNode;
	}
	/*public Category getTreeRootNode() {
		HttpSession session=request.getSession(false);
		Owner ownerobj=(Owner)session.getAttribute("ownerobj");
		String providerid=ownerobj.getProviderid();

		String initialRoot=category.initializeTree(providerid);
		System.out.println("Initial Root Node-->"+initialRoot);

		System.out.println("ShowDynamicTreeAction
category1.getById(Long.parseLong(initialRoot))-->"+(category1.getById(Long.parseLong(initialRoot))).getName());
		return category1.getById(Long.parseLong(initialRoot));
	}*/

	public void setTreeRootNode(Category treeRootNode) {
		this.treeRootNode = treeRootNode;
	}
}

//END SNIPPET: treeExampleDynamicJavaShow

Category.java

package com.teleparadigm.mms.application.dynamictree;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 */
public class Category {

	private long id;
	private String name;
	private List<Category> children;
	private boolean toggle;

	public Category(long id, String name, Category... children) {
		this.id = id;
		this.name = name;
		this.children = new ArrayList<Category>();
		for (Category child : children) {
			System.out.println("child.getName()->"+child.getName());
			if(child!=null && !child.getName().equalsIgnoreCase("dummy") ){
				System.out.println("Its added");
				this.children.add(child);
			}else{
				System.out.println("Child  Null or Dummy");
			}
		}

	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<Category> getChildren() {
		return children;
	}

	public void setChildren(List<Category> children) {
		this.children = children;
	}

	public void toggle() {
		toggle = !toggle;
	}

	public boolean isToggle() {
		return toggle;
	}
}

-- 
View this message in context: http://www.nabble.com/Cross-Browser-issues%21-tp22414428p22415535.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Cross Browser issues!

Posted by mitch gorman <mg...@shadowtv.biz>.
sajidbigler wrote:
> Hi friends,
> is 
> How to resolve cross browser issues.i was doing dynamic tree in firefox it
> works fine but in IE the div wont be updated .later i come to conclusion its
> bcoz if innerHTML or table,tr,td tags.in the showcase example we don't use
> any tables so it works fine onc u wanna use table it screws up .any help
> (feedback) is appreciable
>   
    try turning off loading text in your s:div.  once IE displays the
"Loading..." message, it becomes very confused about what it's supposed
to be doing.
   

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org