formluario registroclientes.jsp
Código PHP:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<HTML>
<HEAD>
<TITLE>Registro de Clientes</TITLE>
</HEAD>
<BODY>
<CENTER>
<H1>Ingresa Cliente</H1>
<br>
<FORM ACTION= "basic.jsp" METHOD= "POST" >
RUT:
<INPUT TYPE= "TEXT" NAME= "TEXT1" >
<BR>
<BR>
Nombre:
<INPUT TYPE= "TEXT" NAME= "TEXT2" >
<BR>
<BR>
Direccion:
<INPUT TYPE= "TEXT" NAME= "TEXT3" >
<BR>
<BR>
Telfono:
<INPUT TYPE= "TEXT" NAME= "TEXT4" >
<BR>
<BR>
<INPUT TYPE= "SUBMIT" VALUE= "Guardar" ><INPUT TYPE= "RESET" VALUE= "Limpiar" >
</FORM>
</CENTER>
</BODY>
</HTML>
Código PHP:
<%@ page import = "java.io.*" %>
<HTML>
<HEAD>
<TITLE>Ingreso de Clientes</TITLE>
</HEAD>
<BODY>
<H1>Registro a Sastifacion</H1>
<BR>
<BR>
<%
String rut = request.getParameter ( "TEXT1" ) ;
String nombre = request.getParameter ( "TEXT2" ) ;
String direccion = request.getParameter ( "TEXT3" ) ;
String telefono = request.getParameter ( "TEXT4" ) ;
String file = application.getRealPath ( "/" ) + "Clientes.txt" ;
FileWriter filewriter = new FileWriter ( file, true ) ;
filewriter.write ( "<B>RUT: </B>" + rut + "<BR>" ) ;
filewriter.write ( "<B>Nombres: </B><BR>" ) ;
filewriter.write ( nombre + "<BR><BR>" ) ;
filewriter.write ( "<B>Direccion: </B><BR>" ) ;
filewriter.write ( direccion + "<BR><BR>" ) ;
filewriter.write ( "<B>Telefono: </B><BR>" ) ;
filewriter.write ( telefono + "<BR><BR>" ) ;
filewriter.close () ;
%>
<jsp:include page= "Clientes.txt" flush= "true" />
</BODY>
</HTML>