Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
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
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Struts
Logic Iterate
manjiri chunekar
Greenhorn
Posts: 13
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Integration of
struts
and spring
jdbc
Not getting output...
help me....
i can retieve data through text box but not through table
Employee.java(BEAN)
public class Employee extends ActionForm{ private static final long serialVersionUID = 1L; private int emp_id; private String emp_nm; List emplist = new ArrayList(); public int getEmp_id() { return emp_id; } public void setEmp_id(int emp_id) { this.emp_id = emp_id; } public String getEmp_nm() { return emp_nm; } public void setEmp_nm(String emp_nm) { this.emp_nm = emp_nm; } public List getEmplist() { return emplist; } public void setEmplist(List emplist) { this.emplist = emplist; }
EmployeeAction
public class EmployeeAction extends Action{ private EmployeeDAO obj = null; private final static String SUCCESS = "success"; List l = new ArrayList(); public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // System.out.println("In Action Class"); WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext( request.getSession().getServletContext()); obj=(EmployeeDAO)context.getBean("EmployeeDAO"); System.out.println("In Action Class"); //emp.getEmp_Id(); //emp.getEmp_Name(); Employee employee = (Employee) form; l = obj.Select(); employee.setEmplist(l); //System.out.print(l.get(0)); for(int i=0;i<l.size();i++) { Map m =(Map)l.get(i); //System.out.print(m.entrySet()); int empid = ((Number) m.get("Emp_Id")).intValue(); employee.setEmp_id(empid); //System.out.print(""+m.get("Emp_Id")); //employee.setEmp_id(98); //System.out.print("8888888777*"+employee.getEmp_id()); // employee.getEmp_id(); String empnm = (m.get("Emp_Name")).toString(); employee.setEmp_nm(empnm); // employee.getEmp_name(); //System.out.print(employee.getEmp_name(empnm))); } return mapping.findForward(SUCCESS); }
success.jsp
<table style="border:1px solid;" width="40%"> <tr><td>Employee Table</td></tr> </table> <table border="1" width="40%"> <tr> <td>Emp Id</td> <td>Emp Name</td> </tr> <logic:present name="Employee"> <logic:iterate id="emp" name="Employee" property="emplist"> <tr> <td align="center"><bean:write name="emp" property="emp_id"/></td> <td align="center"><bean:write name="emp" property="emp_nm"/></td> </tr> </logic:iterate> </logic:present> </table>
help me....
[JB: added code tags]
Sriram Ture
Greenhorn
Posts: 23
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
I am not seeing the list set in the request in your action class,
so that it can be available to your presentation layer.
If you set the list to the request then it can be retrieved in you view.
Thanks
Yeah, but is it art? What do you think tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
spring jdbc and action class
INDEX PROPERTY <html:form> with nested beans
simple login n home(w/ iterate tag)
List of checkboxes and Array/ArrayList data binding not working.
Problem in composite key mapping in eclipselink
More...