struts integration
it would be great if someone had an example showingf how onw could integrate ActiveWidget directly into a struts framework. eg. display info returned from an action.
joe007
May 9,
...
...
...
public class ControlRolesTercerosAction extends MappingDispatchAction {
private static final int delta = 10;
public ActionForward inicioRolesTerceros(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
/*
Here I connect to a Data Base, get the elements inside
an array ob Object an pass it to a method to construct the
XML
*/
Object[] res = giveMeElementsFromDataBase();
String xml = this.getXMLRoles(res);
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
PrintWriter out = response.getWriter();
out.println(xml);
out.flush();
return null;
}
private String getXMLRoles(Object[] res ) throws Exception{
String xml += " <registros> " + ParametrosComunes.nuevaLinea;
for (Object o : res) {
RolForm rol = (RolForm)o;
xml += " <rolTercero>";
xml += " <id>" + rol.getId()+ "</id>";
xml += " <nombre>" + rol.getNombre() + "</nombre>";
xml += "<descripcion>" + rol.getDescripcion() + "</descripcion>";
xml += "<reservado>" + rol.getReservado() + "</reservado>";
xml += "<validoPersonas>" + rol.getValidoPersonas() + "</validoPersonas>";
xml += "<validoOrganizaciones>" + rol.getValidoOrganizaciones() + "</validoOrganizaciones>";
xml += " </rolTercero>";
}
xml += "</registros>";
return xml;
}
...
...
...
public class ControlRolesTercerosAction extends MappingDispatchAction {
private static final int delta = 10;
public ActionForward inicioRolesTerceros(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
/*
Here I connect to a Data Base, get the elements inside
an array ob Object an pass it to a method to construct the
XML
*/
Object[] res = giveMeElementsFromDataBase();
String xml = this.getXMLRoles(res);
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
PrintWriter out = response.getWriter();
out.println(xml);
out.flush();
return null;
}
private String getXMLRoles(Object[] res ) throws Exception{
String xml += " <registros> " + ParametrosComunes.nuevaLinea;
for (Object o : res) {
RolForm rol = (RolForm)o;
xml += " <rolTercero>";
xml += " <id>" + rol.getId()+ "</id>";
xml += " <nombre>" + rol.getNombre() + "</nombre>";
xml += "<descripcion>" + rol.getDescripcion() + "</descripcion>";
xml += "<reservado>" + rol.getReservado() + "</reservado>";
xml += "<validoPersonas>" + rol.getValidoPersonas() + "</validoPersonas>";
xml += "<validoOrganizaciones>" + rol.getValidoOrganizaciones() + "</validoOrganizaciones>";
xml += " </rolTercero>";
}
xml += "</registros>";
return xml;
}
This topic is archived.
ActiveWidgets is a javascript library for creating user interfaces. It offers excellent performance for complex screens while staying simple, compact and easy to learn. Deployed by thousands of commercial customers in more than 70 countries worldwide.
Copyright © ActiveWidgets 2021