Buscar
Social
Ofertas laborales ES
« Liberada la Beta 3 de Tomcat 4.0 que soluciona los | Main | Cómo averiguar el tamaráo de un objeto »
domingo
abr012001

Cómo hacer el primer servlet

C�mo hacer el primer servlet




© dr7tbien@wanadoo.es




import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HolaMundo extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("");
out.println("<head>Mi primer servlet</head></title>");<br/>out.println("<i>Que paza mundooooooooooo</i></font>");<br/>out.println("");<br/>}<br/>}<br/></pre> </div> </div> <div class="journal-entry-tag journal-entry-tag-post-body"> <div class="journal-entry-tag-post-body-line1"><span class="posted-by"> <a href="/antiguo_javahispano_org/author/javahispano"> <img title="Author" alt="Author" class="inline-icon user-registered-icon" rel="dark" src="/universal/images/transparent.png" />javaHispano</a></span> | <span class="post-comments"><a href="/antiguo_javahispano_org/2001/4/1/como-hacer-el-primer-servlet.html#comments"> <img title="Comment" alt="Comment" class="inline-icon comment-icon" rel="dark" src="/universal/images/transparent.png" />Post a Comment</a></span> | <span class="share-item"><a href="javascript:noop();" onclick="Squarespace.Interaction.shareLink(this,'%2Fantiguo_javahispano_org%2F2001%2F4%2F1%2Fcomo-hacer-el-primer-servlet.html','C%C3%B3mo%20hacer%20el%20primer%20servlet');"> <img title="Share Article" alt="Share Article" class="inline-icon share-icon" rel="dark" src="/universal/images/transparent.png" />Share Article </a></span> </div> <div class="journal-entry-tag-post-body-line2"><span class="posted-in">in <span class="tag-element"><a rel="tag" href="/antiguo_javahispano_org/category/j2ee"> <img title="Category" alt="Category" class="inline-icon category-icon" rel="dark" src="/universal/images/transparent.png" />j2ee</a></span></span> </div> <div class="journal-entry-tag-post-body-line3"></div> </div> <div class="clearer"></div> </div> </div> </div> <div class="journal-comment-area-wrapper"> <div id="comments" class="journal-comment-area"> <h3 class="caption">Reader Comments </h3> <div class="text">There are no comments for this journal entry. To create a new comment, use the form below.</div> </div> </div> <div class="journal-add-comment-area-wrapper"> <script type="text/javascript"> // <![CDATA[ var isAddCommentsVisible = true; function toggleReferenceMode() { if (isAddCommentsVisible) { hideObject(document.getElementById("add-comment-area")); showObject(document.getElementById("add-reference-area")); } else { showObject(document.getElementById("add-comment-area")); hideObject(document.getElementById("add-reference-area")); } isAddCommentsVisible = !isAddCommentsVisible; } E.addListener("postform", "keydown", Squarespace.SessionAuthorizationKey.acquireAuthKey, ''); // ]]> </script> <form method="post" style="margin: 0; padding: 0;" name="postform" id="postform" action="/process/CreateJournalEntryComment?moduleId=12023488&entryId=12867659"> <div class="notice-box" style="margin-top: 2em;" id="add-comment-area"> <div class="caption-text"> <strong>Comentarios deshabilitados</strong><br/> Comentarios deshabilitados en esta noticia. </div> </div> </form> <script type="text/javascript"> // <![CDATA[ function toggleNotify() { document.getElementById("followOptIn").click(); } function submitContent(isFinal) { if (isFinal) { document.getElementById("postform").action += "&finalize=true"; Squarespace.StorableFields.save("authorName", "authorEmail", "authorUrl"); } Squarespace.Form.smartSubmit("postform"); } // ]]> </script> </div> </div></div> <!-- Content --> </div></div> <!-- Page Body --> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/es_LA/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(document).ready(function() { $('.journal-entry-tag-post-body-line3').each(function(index) { var url = $('.title a').get(index); $(this).append('<div class="fb-like" data-href='+url+' data-send="true" data-width="450" data-show-faces="true"></div>'); }); }); </script> <div id="pageFooterWrapper"><div id="pageFooter"> © 2001-2020 Asociación javaHispano <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-1784820-1"; urchinTracker(); </script> </div></div> </div></div> <!-- Canvas --> <script type="text/javascript"> SyntaxHighlighter.config.clipboardSwf = 'storage/scripts/clipboard.swf'; SyntaxHighlighter.all(); </script> <div class="clearer" id="bodyClearer"></div> </body> </html>