package Addressbook; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.w3c.dom.*; import org.xmldb.api.base.*; import org.xmldb.api.modules.*; import org.apache.xpath.*; import org.apache.xpath.objects.*; import java.net.*; import java.util.Vector; import java.util.Hashtable; // Class for adding circunstancias al ingreso records to the database. public class AddCircunstancias extends Action { // Add document to the datbase using values passed in via form-post public boolean addCircu(HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { Collection col = null; try { // Get los parametros a introducir String Fecha = request.getParameter("FECHAADMISION"); String Modo = request.getParameter("MODOADMISION"); String Especialidad = request.getParameter("ESPECIALIDADADMISORA"); String Motivo = request.getParameter("MOTIVOINGRESO"); // Get a reference to the session HttpSession session = request.getSession(true); // Get a collection instance col = getCollection(request,response); // Get the documentKey for this particular Person String dockey = request.getParameter("DOCKEY"); // Create an XObject to be used in Xpath query XObject xo = new XObject(); //recuperar un documento de una coleccion: XMLResource resource =(XMLResource) col.getResource(dockey); // Convert to DOM object Document doc = (Document) resource.getContentAsDOM(); //localizo los nodos a rellenar XPathQueryService service = (XPathQueryService)col.getService("XPathQueryService",XMLDBAPIVERSION); // defino xpath para cada parametro y le asigno el valor del formulario String xpath = "/person/DatosMensajeAlta/AdministracionAltaPaciente/DatosAdmision"; //asigno el valor tomado del formulario al nodo especificado xo = XPathAPI.eval(originalnode, "/person/AdministracionAltaPaciente/DatosAdmision/EspecialidadAdmisora"); table.put("Especialidad", xo.toString()); person.setSegundoApellido(doc); doc.setEspecialidadAdmision(Especialidad); originalnode.setNodeValue(xpath, Especialidad); setNodeValue(xpath, Modo); setNodeValue(xpath, Fecha); //sirven????? //String xpath ="/person/AdministracionAltaPaciente/DatosAdmision"; ResourceSet resultSet = service.query(xpath); ResourceIterator results = resultSet.getIterator(); while(results.hasMoreResources()){ Resource res= results.nextResource(); //almaceno los datos tomados del formulario person.setFechaAdmision("FechaAdmision")=FechaAdmision; } } catch ( Exception e) { e.printStackTrace(); // there's not much else we can do if the response is committed if (response.isCommitted()) return true; // Catch the exception and send the user to the error page if (e.getMessage() != null ) { response.sendRedirect("/Addressbook/error.jsp?error=" + URLEncoder.encode(e.getMessage()) ); } else { response.sendRedirect("/Addressbook/error.jsp" ); } } return true; } } e-REdING. Biblioteca de la Escuela Superior de Ingenieros de Sevilla.


GESTIÓN DE INFORMES DE ALTA CON TECNOLOGÍA JAVA Y BASE DE DATOS XML NATIVAS

: Lavado Gómez, Irene
: Ingeniería Telecomunicación
Contenido del proyecto: