Method Post and Get with TiniHttpServer
Doc Gloumy <[email protected]>
| Newsgroups | gmane.comp.hardware.microcontrollers.tini |
|---|---|
| Message-ID | <[email protected]> |
I want to pass data to a servlet, and I dot understand how I can use the
post and get method with TiniHttpServer, I use two servlet, one with the
form, and the other wich display data,
This is the first :
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class HelloServlet extends HttpServlet {
public void service( ServletRequest request,ServletResponse
response) throws ServletException, IOException {
response.setContentType( "text/html" );
PrintWriter out = response.getWriter();
out.println( "<FORM Method=\"GET\"
Action=\"http://10.10.10.81/servlet/HelloServletDeux\">" );
out.println( "Nom :<INPUT type=text size=20 name=nom><BR>" );
out.println( "Prénom :<INPUT type=text size=20
name=prenom><BR>" );
out.println( "Age :<INPUT type=text size=2 name=age><BR>" );
out.println( "<INPUT type=submit value=Envoyer></FORM>" );
}
}
and the twice :
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
public class HelloServletDeux extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<HTML>\n<BODY>\n" +
"<H1>Recapitulatif des informations</H1>\n" +
"<UL>\n" +
" <LI>Nom: "
+ request.getParameter("Nom") + "\n" +
" <LI>Prenom: "
+ request.getParameter("Prenom") + "\n" +
" <LI>Age: "
+ request.getParameter("Age") + "\n" +
"</UL>\n" +
"</BODY></HTML>");
}
}
The compil is ok, and I arrive to display the html but the data are
"null", is there an good method to pass data enter two servlet ?
If not, can I put these two servlet in only one ? but i dont know how to
use the send button as a condition in a if structure
PS : Thanks to Kelly Smith and Shawn for their help with TiniHttpServer,
it run good now ;)
--
/**************************************************
GARCIA Patrick alias Doc Gloumy
BTS Informatique et Reseaux pour l'Industrie et les Services
Port : 06-89-51-54-01 Tel : 05-61-07-65-58
Trésorier, electricien,
Responsable logistique et materiel de PcRézoo
www.pcrezoo.net
[email protected]
ICQ : 94469133
MSN : [email protected]
**************************************************/
_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini