-4

I'm following this tutorial to built a login page (link) but i'm using "postgresql" for database.

I have only 2 columns in my table. One is usr and second one is password. I am using Tomcat7 server in Eclipse IDE. I changed url, driver, database, name, password only in valid.java page.

Please help...

Output shows like :
HTTP Status 404 - /new/login type Status report message /new/login description The requested resource is not available. Apache Tomcat/7.0.70

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
V.Ahlawat
  • 51
  • 1
  • 8
  • http://stackoverflow.com/help/how-to-ask – Tom Sep 23 '16 at 12:15
  • what is the url you are trying? and what is the dynamic web application name you have given , is it same what you are using in your url? – Rishal Sep 23 '16 at 14:37
  • url is "jdbc:postgresql://localhost:5432/form","postgres","vijit1". And i'm using "Eclipse mars.2". – V.Ahlawat Sep 24 '16 at 05:28

1 Answers1

1

Check if you have proper entry for Login servlet in web.xml you should mention full package structure of Login servlet class

For e.g for class in src folder src\com\servlet\FirstServ.java

its entry should be like below in web.xml

    <servlet> 
        <servlet-name>FirstServ</servlet-name>
        <servlet-class>com.servlet.FirstServ</servlet-class>
      </servlet>
      <servlet-mapping>    
  <servlet-name>FirstServ</servlet-name>
        <url-pattern>/FirstServ</url-pattern>
     </servlet-mapping>

mention full package structure for Login servlet in web.xml inside servlet-class tags.

Tried same example and its worked.For implementing application as provided in link then PFB screenshot of directory structure of eclipse.

enter image description here

shripad vade
  • 199
  • 7
  • I changed it as u say....but it occurs same error.. – V.Ahlawat Sep 24 '16 at 05:26
  • Try by proper clean-building project once and then restart. In eclipse go to Project menu >Clean > Build project. – shripad vade Sep 24 '16 at 05:53
  • @vijit find my updated above comment. try by clean build and check directory structures are proper and you are using same web.xml as its mentioned in your link – shripad vade Sep 24 '16 at 06:26
  • Yes i'm using same web.xml as mentioned in link. Can u plz tell me how many jar file r requied for it ??? – V.Ahlawat Sep 24 '16 at 06:54
  • No any additional jars required for me as I am not have SQL DB but running this mysql jar is required to have in lib. i have just created new Dynamic Web project. Only JRE System Library and Apache tomcat library as seen in attached screenshot above which is coming by default once you are creating Dynamic Web project. To create dynamic Web project through eclipse go to File > New >Project >Dynamic Web project(Inside web folder). Also try clean Project menu >Clean > Build . then run project on server like Right click on your project > Run As > Run on server then next next. – shripad vade Sep 24 '16 at 07:24
  • I am not connecting to SQL DB and As I don't have My sql jar its throwing me "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver" error on console and I have set boolean st =true; in Validate class checkUser method so its throwing error and its catched in same class and just printed over there so as I am setting flag as true its showing me welcome message. – shripad vade Sep 24 '16 at 07:28
  • there is no option of Clean > build. – V.Ahlawat Sep 24 '16 at 07:31
  • in eclipse go to Project >Clean...> Select clean All projects option and select below Start a build immediately checkbox from that select build entire work-space option – shripad vade Sep 24 '16 at 07:36
  • finally i run that .....there was an error in mapping in web.xml page. – V.Ahlawat Sep 24 '16 at 09:28
  • @Vijit okies great – shripad vade Sep 24 '16 at 09:37