Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Struts 2 | How to populate a form by selecting a value from a table in the same page

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the following code what I want is when I click edit in a particular row of the table showing list of employee number and employee name passing employee number as parameter............. the name and employee number should be populated in the form so that I can edit and resubmit the form .

when edit will be clicked a topic will be published with parameter as employee number and wanted to use dojo plugin to populate the same in the form.

Please help to get the code in "//WHAT TO WRITE HERE"


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>#### Gurgaon | Welcome</title>
<sx:head debug="true" cache="false" parseContent="true"/>
<script type="text/javascript">
dojo.event.topic.subscribe("/submittedTopic", function(event, widget){
dojo.byId("empName").value="";
dojo.byId("empCode").value="";

});
dojo.event.topic.subscribe("/editTopic", function(data, type, request){


//WHAT TO WRITE HERE


}
})
</script>
</head>
<body>



<s:form action="addEmpAction" id="addEmp">
<s:textfield id="empName" name="employee.name" label="Name"/>
<s:textfield id="empCode" name="employee.employeeCode" label="Employee Code"/>
<sx:submit highlightColor="blue" highlightDuration="2000" targets="tableDiv" afterNotifyTopics="/submittedTopic"
/><s:reset/>
</s:form>
<s:if test = "employeeList.size > 0">
<table border=1 >
<tr>
<th >Name</th>
<th>Code</th>
</tr>
<s:iterator value="employeeList" status="stat">
<tr class="row${stat.count % 2} first${stat.first} last${stat.last}">
<td><s:property value="name" /></td>
<td><s:property value="employeeCode" /></td>
<td><s:url var="deleteUrl" action="deleteEmp">
<s:param name="employee.employeeCode" value="employeeCode"/>
</s:url>
<sx:a highlightColor="blue" highlightDuration="2000" href="%{deleteUrl}" targets="tableDiv" notifyTopics="/deletedTopic">Delete</sx:a>
</td>
<td><sx:a id="a_%{employeeCode}" notifyTopics="/editTopic">edit</sx:a></td>
</tr>
</s:iterator>
</body>
</html>
 
Ranch Hand
Posts: 247
MyEclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please use code tags..
 
The two armies met. But instead of battle, they decided to eat some pie and contemplate this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic