- This topic has 1 reply, 2 voices, and was last updated 15 years, 4 months ago by support-joy.
-
AuthorPosts
-
bipien@yahoo.comMemberemployee.jsp
<script type=”text/javascript”>
function updateEmployee()
{
if(validateEmployee(document.forms[0]))
{
document.forms[0].action=”/UPS2/employee.do?reqCode=updateEmployee”;
document.forms[0].submit();
}
}
function addEmployee()
{
if(validateEmployee(document.forms[0]))
{
document.forms[0].action=”/UPS2/employee.do?reqCode=saveEmployee”;
document.forms[0].submit();
}
}
function deleteEmployee()
{
document.forms[0].action=”/UPS2/employee.do?reqCode=deleteEmployee”;
document.forms[0].submit();
}
</script>
</head><body>
<html:form action=”/employee?reqCode=updateEmployee” method=”post” focus=”roll”>
<html:javascript formName=”employee”/>
<table border=”0″>
<tr>
<td>Employee Id:</td>
<logic:equal value=”edit” property=”status” name=”employee”>
<td><html:text property=”roll” readonly=”true”/></td>
</logic:equal>
<logic:equal value=”save” property=”status” name=”employee”>
<td><html:text property=”roll” readonly=”false” /></td>
</logic:equal>
</tr>
<tr>
<td>Employee Name:</td>
<td><html:text property=”name” /></td>
</tr>
<tr>
<td>Employee Address:</td>
<td><html:text property=”city” /></td>
</tr>
<tr>
<td colspan=”2″ align=”center”>
<logic:equal value=”edit” property=”status” name=”employee”>
<html:button property=”button” value=”Edit” onclick=”updateEmployee()”/>
</logic:equal>
<logic:equal value=”edit” property=”status” name=”employee”>
<html:button property=”button” value=”Delete” onclick=”deleteEmployee()”/>
</logic:equal>
</td>
<td colspan=”2″ align=”left”>
<logic:equal value=”save” property=”status” name=”employee”>
<html:button property=”buttton” value=”Save” onclick=”addEmployee()”/>
</logic:equal>
</td>
</tr>
</table>
</html:form>
<%
if(request.getAttribute(“msg”)!=null)
{
out.print(request.getAttribute(“msg”));
}
%>
</body>
</html:html>
//home.jsp
<script type=”text/javascript”>
function callEdit(roll)
{
document.forms[0].action=”/UPS2/employee.do?reqCode=edit&roll=”+roll;
document.forms[0].submit();
}
</script>
</head><body>
<html:form action=”/employee” method=”post”>
<table border=”5″ bordercolor=”red”>
<tr bordercolor=”blue”>
<th bordercolor=”green”>Employee Roll</th>
<th bordercolor=”green”>Employee Name</th>
<th bordercolor=”green”>Employee City</th>
</tr>
<logic:iterate id=”employee” name=”searchFormBean” property=”emplist” type=”search.vo.SearchVO”>
<tr bordercolor=”pink”>
<td bordercolor=”yellow”><a href=”javascript:callEdit(<bean:write name=”employee” property=”roll” />)”><bean:write name=”employee” property=”roll” /></a></td>
<td bordercolor=”yellow”><bean:write name=”employee” property=”name” /></td>
<td bordercolor=”yellow”><bean:write name=”employee” property=”city” /></td>
</tr>
</logic:iterate>
</table>
</html:form>
</body>
</html:html>
//searcFormBean.java
package search.form;import java.util.List;
import org.apache.struts.action.ActionForm;
public class SerachFormBean extends ActionForm {
List emplist;public List getEmplist() {
return emplist;
}public void setEmplist(List emplist) {
this.emplist = emplist;
}}
support-joyMember -
AuthorPosts