Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Cannot Reproduce
-
4.1.1
-
None
-
Windows, Apache Tomcat 6.0, Firefox 2.0, Tapestry 4.1.1
Description
RenderBlock. When I tried to change block asynchronously from one to another which contains Form component(or another dojo component), old block removing, new tried to insert(application gets correct ajax responce) but init script runs before new block inserted, and fails because component form not exists yet(and in init script tapestry.registerForm(), try to register yet not existing Form).
When i try to update component which contains RenderBlock error occures:
FATAL exception raised: Form not found with id form
ERROR: 9:54:35: Error evaluating script: //<![CDATA[ dojo.require("tapestry.form");tapestry.form.registerForm("form", true); //]]> Error : Form not found with id form : http://localhost:8080/iTrack/app?service=asset&path=%2Fdojo%2Fdojo.js : line 15
Page gets such response which invokes error!
Probably it is not a bug, but a can't find what is wrong.
Its html code
<span jwcid="@Menu">
<table width = "100%">
<tr witdh = "100%" >
<td width="30%" valign="top" id="showTable">
<span jwcid="showTable@iTrack:JsTree" source="ognl:treeModel" jsVariableName="literal:nodesTree" value="ognl:myNode" >
<span jwcid="@DirectLink" listener="listener:treeStateChanged" async="true" parameters="ognl:myNode.id">
<span jwcid="@Insert" value="ognl:myNode.name" />
</span>
</span>
</td>
<td width="70%" valign="top">
<span id="showWindow">
<span jwcid="showWindow@RenderBlock" block="ognl:selectedBlock" />
</span>
</td>
</tr>
</table>
<span jwcid="addIssue@Block">
<h3>Adding issue to component <span id="editingComponent"><span jwcid="editingComponent@Insert" value="ognl:componentName" /></span></h3>
<span id="editingArea">
<span jwcid="@If" condition="ognl:message!=null"><h4><span jwcid="editingArea@Insert" value="ognl:message"/></h4></span>
</span>
<span jwcid="@bf:BeanForm"
bean="ognl:issueData"
save="listener:save"
save_value="message:add-issue"
properties="literal:name
,priority
{required}"
async="true"
focus="false"
/>
</span>
<span jwcid="empty@Block">
Hello all
</span>
<span jwcid="fullish@Block">
Bye bye every body
</span>
</span>
Its java code
package com.iTrack.pages;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.IScript;
import org.apache.tapestry.PageRenderSupport;
import org.apache.tapestry.TapestryUtils;
import org.apache.tapestry.annotations.EventListener;
import org.apache.tapestry.annotations.InjectScript;
import org.apache.tapestry.annotations.Persist;
import org.apache.tapestry.components.Block;
import org.apache.tapestry.engine.IPageLoader;
import org.apache.tapestry.event.BrowserEvent;
import org.apache.tapestry.html.BasePage;
import org.apache.tapestry.services.ResponseBuilder;
import org.apache.tapestry.spec.IComponentSpecification;
import com.iTrack.components.JsTree.model.SimpleTreeNode;
import com.iTrack.model.component.Component;
import com.iTrack.model.component.Issue;
import com.iTrack.model.component.Project;
import com.iTrack.model.user.User;
import com.iTrack.pages.showprojects.AbstractNode;
import com.iTrack.pages.showprojects.ComponentNode;
import com.iTrack.pages.showprojects.IssueNode;
import com.iTrack.pages.showprojects.ProjectNode;
import com.iTrack.pages.showprojects.RootNode;
import com.iTrack.util.DaoFactory;
public abstract class ShowProjects extends BasePage {
private SimpleTreeNode myNode;
private ArrayList<SimpleTreeNode> allNodes;
ArrayList<Block> blocks = new ArrayList<Block>();
public abstract IScript getScript();
@Persist
public abstract int getSelectedBlockId();
public abstract void setSelectedBlockId(int id);
public ArrayList<SimpleTreeNode> getTreeModel() {
setAllNodes(new ArrayList<SimpleTreeNode>());
SimpleTreeNode root = new RootNode((long) getAllNodes().size());
getAllNodes().add(root);
List<Project> projects = (List<Project>) DaoFactory.getComponentDao()
.getAllProjects();
for (Project project : projects)
return root.getPlainTree();
}
public SimpleTreeNode getMyNode()
{ return myNode; }public void setMyNode(SimpleTreeNode myNode)
{ this.myNode = myNode; } private SimpleTreeNode getTree(Component component) {
SimpleTreeNode ans;
if (component instanceof Project)
else
{ ans = new ComponentNode((long) getAllNodes().size(), component); }getAllNodes().add(ans);
Collection<Component> children = component.getSubComponents();
for (Component child : children)
Collection<Issue> issues = component.getIssues();
for (Issue issue : issues)
return ans;
}
public Block getSelectedBlock()
{ return blocks.get(getSelectedBlockId()); } public void treeStateChanged(Long id) {
setMessage(null);
SimpleTreeNode node = getAllNodes().get(id.intValue());
if (node instanceof ComponentNode)
}
public String getComponentName() {
if (getCurrentNode() != null)
return "";
}
@Override
public void finishLoad(IRequestCycle arg0, IPageLoader arg1,
IComponentSpecification arg2)
public void save(IRequestCycle cycle) {
if (getCurrentNode() == null)
getIssueData().setComponent(
(Component) ((ComponentNode) getCurrentNode()).getElement());
getIssueData().setCreator((User) DaoFactory.getUserDao().getById(1));
getIssueData().setLastUpdate(new Date(System.currentTimeMillis()));
DaoFactory.getIssueDao().save(getIssueData());
setIssueData(new Issue());
setMessage("issue successfully added");
cycle.getResponseBuilder().updateComponent("editingArea");
cycle.getResponseBuilder().updateComponent("showTable");
}
public void delete(IRequestCycle cycle) {
}
public ArrayList<SimpleTreeNode> getAllNodes()
{ return allNodes; }public void setAllNodes(ArrayList<SimpleTreeNode> nodes)
{ allNodes = nodes; } @Persist
public abstract AbstractNode getCurrentNode();
public abstract void setCurrentNode(AbstractNode currentNode);
@Persist
public abstract Issue getIssueData();
public abstract void setIssueData(Issue editingIssue);
@Persist
public abstract String getMessage();
public abstract void setMessage(String message);
}
Ajax response
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
<!ENTITY nbsp ' '>
]>
<ajax-response><response id="showWindow" type="element">
<h3>Adding issue to component <span id="editingComponent">firstChild1</span></h3>
<span id="editingArea">
</span>
<span>
<form method="post" action="/iTrack/app;jsessionid=E6183CDDDB726B0866BEA7DDB52134EE" id="form">
<div style="display:none;" id="formhidden"><input type="hidden" name="formids" value="notCustomized1
,rows,name,description,resolution,status,priority,notCustomized2,hasSave,save,hasCancel,hasRefresh,hasDelete"
/>
<input type="hidden" name="component" value="showWindowForm" />
<input type="hidden" name="page" value="ShowProjects" />
<input type="hidden" name="service" value="direct" />
<input type="hidden" name="session" value="T" />
<input type="hidden" name="submitmode" value="" />
<input type="hidden" name="submitname" value="" />
<input type="hidden" name="notCustomized1" value="T" />
<input type="hidden" name="rows" value="VBP_b_c_a_a" />
<input type="hidden" name="rows" value="VBP_b_d_c_b" />
<input type="hidden" name="rows" value="VBP_b_e_c_a" />
<input type="hidden" name="rows" value="VBP_b_f_a_c" />
<input type="hidden" name="rows" value="VBP_b_g_a_c" />
<input type="hidden" name="notCustomized2" value="T" />
<input type="hidden" name="hasSave" value="T" />
<input type="hidden" name="hasCancel" value="F" />
<input type="hidden" name="hasRefresh" value="F" />
<input type="hidden" name="hasDelete" value="F" />
</div>
<table id="table">
<span>
<span id="rows">
<tr id="informal">
<td class="bf_Left" id="informal_0"><label for="name">Name</label>:</td>
<td class="bf_Right" id="informal_1"><input type="text" name="name" value="" id="name"
class="text" /></td>
</tr>
</span><span id="rows_1">
<tr id="informal_2">
<td class="bf_Left" id="informal_3"><label for="description">Description</label>:</td
>
<td class="bf_Right" id="informal_4"><textarea name="description" id="description"><
/textarea></td>
</tr>
</span><span id="rows_2">
<tr id="informal_5">
<td class="bf_Left" id="informal_6"><label for="resolution">Resolution</label>:</td>
<td class="bf_Right" id="informal_7"><input type="text" name="resolution" value="" id
="resolution" class="text" /></td>
</tr>
</span><span id="rows_3">
<tr id="informal_8">
<td class="bf_Left" id="informal_9"><label for="status">Status</label>:</td>
<td class="bf_Right" id="informal_10"><select name="status" id="status">
<option value="0">[OPEN]</option>
<option value="1">[OPENNED]</option>
<option value="2">[INPROGRESS]</option>
<option value="3">[CLOSED]</option>
</select></td>
</tr>
</span><span id="rows_4">
<tr id="informal_11">
<td class="bf_Left" id="informal_12"><label for="priority">Priority</label>:</td>
<td class="bf_Right" id="informal_13"><select name="priority" id="priority">
<option value="0">[CRITICAL]</option>
<option value="1">[BLOCKER]</option>
<option value="2">[MAJOR]</option>
<option value="3">[MINOR]</option>
<option value="4">[TRIVIAL]</option>
</select></td>
</tr>
</span>
</span>
<span>
<tr>
<td colspan="2" class="bf_Buttons">
<span><input type="submit" name="save" id="save" value="Add issue" class="button" /></span>
</td>
</tr>
</span>
</table>
</form>
</span>
</response><response id="initializationscript" type="script"><script>
//<![CDATA[
dojo.require("tapestry.form");tapestry.form.registerForm("form", true);
//]]>
</script></response></ajax-response>