struts2 - how we can add one by one row in table by using struts -
i want show data in tabular format when click add button 1 one keep adding in table . use struts 2 not ajax , jquery.
home.jsp <%@ page language="java" contenttype="text/html; charset=utf-8" pageencoding="utf-8"%> <%@ taglib prefix="s" uri="/struts-tags"%> <%@ taglib prefix="sx" uri="/struts-dojo-tags"%> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> </head> <body> <table> <tr> <td><s:textfield label="sainumber" name="stockcreationbean.sainumber" /></td> <td><table><tr><td><sx:datetimepicker name="stockcreationbean.saidate" displayformat="mm-dd-yy" label="saidate" /></td></tr></table></td> <td><s:textfield label="challan" name="stockcreationbean.challan"></s:textfield></td> <td><table><tr><td><sx:datetimepicker name="stockcreationbean.challandate" displayformat="mm-dd-yy" label="challandate"></sx:datetimepicker></td></tr></table></td> </tr> <tr> <td><s:textfield label="billnumber" name="stockcreationbean.billnumber"></s:textfield></td> <td><table><tr><td><sx:datetimepicker name="stockcreationbean.billdate" displayformat="mm-dd-yy" label="billdate"></sx:datetimepicker></td></tr></table></td> <td><s:textfield name="stockcreationbean.ponumber" label="ponumber"></s:textfield></td> <td><table><tr><td><sx:datetimepicker name="stockcreationbean.podate" displayformat="mm-dd-yy" label="podate"></sx:datetimepicker></td></tr></table></td> </tr><tr><td><s:textfield name="stockcreationbean.filenumber" label="filenumber"></s:textfield></td> </tr> </table> <table> <s:iterator value="toparraylist"> <tr> <s:iterator value="tablelist"> <td><s:property value="saidate"/></td> </s:iterator> </tr> </s:iterator> </table> <s:submit value="submit" onclick="formsubmit(this.form)"></s:submit> </body> </html>
this action class can use adding data in array list .one local array list , other global array list call getdata() method when click add button add local arraylist object global arraylist object
displayaction.java public class displayaction extends actionsupport { arraylist<object> toparraylist = new arraylist<object>(); public string execute() { return "success"; } public string getdata() throws namingexception, exception { arraylist<object> tablelist=new arraylist<object>(); tablelist.add(stockcreationbean); toparraylist.add(tablelist); return "success"; } public arraylist<object> gettoparraylist() { return toparraylist; } public void settoparraylist(arraylist<object> toparraylist) { this.toparraylist = toparraylist; } }
@mack struts 2 server-side framework java. if decode requirement tells me want update on table(at client)
, gets updated on-by-one using struts 2(at server)
.
ajax fits requirement , solution requirement, updating table asynchronous call server.
Comments
Post a Comment