Note that there are some explanatory texts on larger screens.

plurals
  1. POtomcat resource missing, servlet not running
    primarykey
    data
    text
    <pre><code>import javax.servlet.*; import java.io.*; public class MyServlet implements Servlet { public void init(ServletConfig con) {} public void service(ServletRequest req, ServletResponse res) throws IOException,ServletException { res.setContentType("text/html"); PrintWriter out=res.getWriter(); String s="blah"; String s1="blah"; out.println("&lt;html&gt;&lt;body&gt;"); if((s.equals(req.getParameter("firstname")))&amp;&amp;(s1.equals(req.getParameter("pwd")))) out.println("passwords match"); else out.println("password and name combo does not match"); out.println("&lt;/body&gt;&lt;/html&gt;"); } public void destroy() {} public ServletConfig getServletConfig() { return null;} public String getServletInfo() { return null;} } </code></pre> <p>this is my java file with the servlet class.its saved with the name MyServlet.java and so is the class file.</p> <p>and here is the xml file:</p> <pre><code>&lt;web-app&gt; &lt;servlet&gt; &lt;servlet-name&gt;demoo&lt;/servlet-name&gt; &lt;servlet-class&gt;MyServlet&lt;/servlet-class&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;demoo&lt;/servlet-name&gt; &lt;url-pattern&gt;/demo&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;/web-app&gt; </code></pre> <p>i have made the folder as WEB-INF and then classes... WEB-INF also contains the .xml file</p> <p>but when i try to run the servlet , it says resource not found <strong>ps- i am already looking for the servlet with the name :demo</strong> </p> <p><em>localhost:8081/s1/demo</em>* s1 is the war file *</p> <blockquote> <p>a html file in the war file seems to run fine on the server though.</p> </blockquote> <p>*</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload