kiran kumar reddy

Ranch Hand
+ Follow
since Jun 28, 2012
kiran kumar likes ...
Eclipse IDE Java Oracle
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
12
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by kiran kumar reddy

i have index.jsp which is defined under welcome-file-list tag. here it goes



it has a forward action now the request is forwarded to contacts.html but in my application there is no contacts.html page under any directory but has a page contact.jsp under web-inf folder. when i run my application as a default it goes to welcome file page and now that it is forwarded to contacts.html page and since i don't have contacts.html it must show me an error right? but instead it is showing me contact.jsp page which is in web-inf folder.

web.xml file.
6 years ago

Tim Holloway wrote:I really don't recommend writing your own login code. The J2EE standard security system is far more secure and it was written and debugged over 10 years ago.

However, if you must, it's much better to do a "SELECT COUNT(*) FROM USER WHERE USERID = ? AND PASSWORD = ?" and check for a return value of 0 (failed) , 1 (success), or (just in case) many (which shouldn't happen if you have everything set up properly, but real life can be unkind.

Use a parameterized query like I showed, not a string-built SQL or Bobby's mom will get you (http://xkcd.com/327/).

The reason for doing the SELECT COUNT instead of actually retrieving the user ID/password and comparing them is that it keeps the actual password from being pulled into server RAM where a rogue process might be able to capture it and send it off to the Bad Guys.


even i used parameterized query at first attempt i getting a success message and with the same details on second request i am getting failure message and stacktrace in console saying

6 years ago

Ashwini Kashyap wrote:You should process something like:

1) Store database matched values in some variables:
while (rs.next ()){
userName=rs.getString("username");
password=rs.getString("password");
}

2) Compare incoming values against database values:

if ( (userName.equals(name) && (password.equals(pass)){
out.println("login success");
}

Thanks,
Ashwini Kashyap | www.infocepts.com



this is done in my code. when we execute sql query if the combination is present in the database it will return a table and then rs.next() will return true and then it is the returned to calling method and so loginstatus becomes true and there are if and else statements to do remaining stuff rite, and i think there is no need to compare the incoming values because if the combination is not present in the database specified then the there won't be any table returned. and rs.next() will give a false. correct me if i am wrong.
6 years ago
i have a simple application which takes username and password as input and checks weather this combination is in database or not. At my first request when i gave correct username and password it says "loginsuccess" but when i gave second request it says "login failure" even though i gave correct details. But when i restart my web server and gave a first request(as i did a restart) it again says "login success". but at second request it again a failure statement.



6 years ago
i followed this link "How to add hibernate javadocs in Eclipse?" but not able to attach javadoc for hibernate in eclipse. i am using eclipse kepler. this is how i tried to attach javadocs for hibernate, and this is one of the way i tried.

i just go to a Class name say Session or configuration i put cursor on it with ctrl key pressed it will show a link and when i click it will show an option of adding javadocs if no one present. i do have javadoc with my hibernate 3.6.10 folder. jovadoc is present in ...\hibernate-distribution-3.6.10.Final-dist\hibernate-distribution-3.6.10.Final\documentation\javadocs, when i gave this path nothing is happening. where i went wrong?

K. Tsang wrote:If you are using annotations all the way, I suggest you adding @Column(name="blabla") to each of those attributes in the Address class.


my problem is solved by updating my hibernate version, my version doesn't support element collection annotation.

K. Tsang wrote:No I meant the <hibernate-mapping> stuff defining DB columns to POJO attributes


you mean creating xml file other than hibernate.cfg.xml. here in this application it won't be needed because we are using annotations here. it will be done automatically by hibernate. class name will be converted in to table name and the member variables names will be coonverted in to column names. and this is a video tutorial found in the internet. i did what exactly he did in that tutorial. and he has entire collection of hibernate tutorials and i have been following it from the first video tutorial. now i got stuck in this topic.

K. Tsang wrote:How are you mapping your Address class to DB table?


Address class is embeddable it means it is embedded in other class ie. userdetail class. you want me to annotate 'entity' for address class also? if yes, i tried it but got same result.
i am trying a simple application to know how collections are persisted in the database using hibernate. i am using eclipse, hibernate 3.3. as far as my knowledge goes i did it correct. but console error says that i am wrong.console error goes as follows,

21:33:51,354 INFO Version:15 - Hibernate Annotations 3.4.0.GA
21:33:51,363 INFO Environment:560 - Hibernate 3.3.2.GA
21:33:51,364 INFO Environment:593 - hibernate.properties not found
21:33:51,366 INFO Environment:771 - Bytecode provider name : javassist
21:33:51,369 INFO Environment:652 - using JDK 1.4 java.sql.Timestamp handling
21:33:51,416 INFO Version:14 - Hibernate Commons Annotations 3.1.0.GA
21:33:51,417 INFO Configuration:1474 - configuring from resource: /hibernate.cfg.xml
21:33:51,418 INFO Configuration:1451 - Configuration resource: /hibernate.cfg.xml
21:33:51,475 INFO Configuration:1589 - Configured SessionFactory: null
21:33:51,477 INFO HibernateSearchEventListenerRegister:53 - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
21:33:51,510 INFO AnnotationBinder:419 - Binding entity from annotated class: com.hibernate.CollectionDemo.UserDetail
21:33:51,533 INFO EntityBinder:422 - Bind entity com.hibernate.CollectionDemo.UserDetail on table USER_DETAIL_COLLECTIONS
21:33:51,562 INFO AnnotationConfiguration:369 - Hibernate Validator not found: ignoring
Exception in thread "main" org.hibernate.MappingException: Could not determine type for: java.util.Set, at table: USER_DETAIL_COLLECTIONS, for columns: [org.hibernate.mapping.Column(listOfAddress)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:292)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:276)
at org.hibernate.mapping.Property.isValid(Property.java:207)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:458)
at org.hibernate.mapping.RootClass.validate(RootClass.java:215)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1149)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1334)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at com.hibernate.CollectionDemo.TestUserDetail.main(TestUserDetail.java:15)


and my model class goes here



here contains the address class which will be embedded in the userdetail class,



here goes my config file

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/testDb</property>
<property name="connection.username">root</property>
<property name="connection.password"></property>
<!-- <property name="hibernate.default_schema">TESTSCHEMA</property> -->

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">2</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>

<!-- Enable Hibernate's current session context -->
<property name="current_session_context_class">thread</property>

<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>

<!-- name of the annotated entity class -->
<mapping class="com.hibernate.CollectionDemo.UserDetail"/>

<!--<mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/>
<mapping resource="org/hibernate/tutorial/domain/Person.hbm.xml"/>

-->
</session-factory>

</hibernate-configuration>

i have done it correctly to my knowledge but still iam getting an error , i am using eclipse and mysql4.0 and the error is shown below

18:26:48,990 INFO Version:15 - Hibernate Annotations 3.4.0.GA
18:26:48,999 INFO Environment:560 - Hibernate 3.3.2.GA
18:26:49,000 INFO Environment:593 - hibernate.properties not found
18:26:49,002 INFO Environment:771 - Bytecode provider name : javassist
18:26:49,004 INFO Environment:652 - using JDK 1.4 java.sql.Timestamp handling
18:26:49,051 INFO Version:14 - Hibernate Commons Annotations 3.1.0.GA
18:26:49,057 INFO Configuration:1474 - configuring from resource: /hibernate.cfg.xml
18:26:49,057 INFO Configuration:1451 - Configuration resource: /hibernate.cfg.xml
18:26:49,108 INFO Configuration:1589 - Configured SessionFactory: null
18:26:49,122 INFO Dialect:175 - Using dialect: org.hibernate.dialect.MySQLDialect
18:26:49,176 INFO AnnotationBinder:419 - Binding entity from annotated class: com.hibernate.OnetoOneMapping.Person
18:26:49,198 INFO EntityBinder:422 - Bind entity com.hibernate.OnetoOneMapping.Person on table Person
18:26:49,230 INFO AnnotationBinder:419 - Binding entity from annotated class: com.hibernate.OnetoOneMapping.PersonDetail
18:26:49,231 INFO EntityBinder:422 - Bind entity com.hibernate.OnetoOneMapping.PersonDetail on table PersonDetail
18:26:49,247 INFO AnnotationConfiguration:369 - Hibernate Validator not found: ignoring
18:26:49,270 INFO SchemaExport:226 - Running hbm2ddl schema export
18:26:49,271 DEBUG SchemaExport:242 - import file not found: /import.sql
18:26:49,271 INFO SchemaExport:251 - exporting generated schema to database
18:26:49,273 INFO DriverManagerConnectionProvider:64 - Using Hibernate built-in connection pool (not for production use!)
18:26:49,273 INFO DriverManagerConnectionProvider:65 - Hibernate connection pool size: 2
18:26:49,273 INFO DriverManagerConnectionProvider:68 - autocommit mode: false
18:26:49,276 INFO DriverManagerConnectionProvider:103 - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/testDb
18:26:49,276 INFO DriverManagerConnectionProvider:109 - connection properties: {user=root, password=****}
alter table Person drop foreign key FK8E4887753CCF9E77
18:26:49,347 DEBUG SchemaExport:377 - alter table Person drop foreign key FK8E4887753CCF9E77
drop table if exists Person
18:26:49,423 DEBUG SchemaExport:377 - drop table if exists Person
drop table if exists PersonDetail
18:26:49,426 DEBUG SchemaExport:377 - drop table if exists PersonDetail
create table Person (personId integer not null auto_increment, personName varchar(255), pDetail_FK integer, primary key (personId))
18:26:49,427 DEBUG SchemaExport:377 - create table Person (personId integer not null auto_increment, personName varchar(255), pDetail_FK integer, primary key (personId))
create table PersonDetail (detailId-pk integer not null auto_increment, income double precision not null, job varchar(255), zipcode varchar(255), primary key (detailId-pk))
18:26:49,467 DEBUG SchemaExport:377 - create table PersonDetail (detailId-pk integer not null auto_increment, income double precision not null, job varchar(255), zipcode varchar(255), primary key (detailId-pk))
18:26:49,470 ERROR SchemaExport:348 - Unsuccessful: create table PersonDetail (detailId-pk integer not null auto_increment, income double precision not null, job varchar(255), zipcode varchar(255), primary key (detailId-pk))
18:26:49,470 ERROR SchemaExport:349 - Syntax error or access violation, message from server: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '-pk integer not null auto_increment, income double precision no"
alter table Person add index FK8E4887753CCF9E77 (pDetail_FK), add constraint FK8E4887753CCF9E77 foreign key (pDetail_FK) references PersonDetail (detailId-pk)
18:26:49,470 DEBUG SchemaExport:377 - alter table Person add index FK8E4887753CCF9E77 (pDetail_FK), add constraint FK8E4887753CCF9E77 foreign key (pDetail_FK) references PersonDetail (detailId-pk)
18:26:49,471 ERROR SchemaExport:348 - Unsuccessful: alter table Person add index FK8E4887753CCF9E77 (pDetail_FK), add constraint FK8E4887753CCF9E77 foreign key (pDetail_FK) references PersonDetail (detailId-pk)
18:26:49,471 ERROR SchemaExport:349 - Syntax error or access violation, message from server: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '-pk)' at line 1"
18:26:49,471 INFO SchemaExport:268 - schema export complete
18:26:49,472 INFO DriverManagerConnectionProvider:170 - cleaning up connection pool: jdbc:mysql://localhost:3306/testDb
18:26:49,476 INFO HibernateSearchEventListenerRegister:53 - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
18:26:49,481 INFO DriverManagerConnectionProvider:64 - Using Hibernate built-in connection pool (not for production use!)
18:26:49,482 INFO DriverManagerConnectionProvider:65 - Hibernate connection pool size: 2
18:26:49,482 INFO DriverManagerConnectionProvider:68 - autocommit mode: false
18:26:49,482 INFO DriverManagerConnectionProvider:103 - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/testDb
18:26:49,482 INFO DriverManagerConnectionProvider:109 - connection properties: {user=root, password=****}
18:26:49,487 INFO SettingsFactory:114 - RDBMS: MySQL, version: 4.0.18-max-debug
18:26:49,487 INFO SettingsFactory:115 - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.0.11-stable ( $Date: 2004/02/04 02:47:36 $, $Revision: 1.27.2.34 $ )
18:26:49,497 INFO Dialect:175 - Using dialect: org.hibernate.dialect.MySQLDialect
18:26:49,498 INFO TransactionFactoryFactory:59 - Using default transaction strategy (direct JDBC transactions)
18:26:49,500 INFO TransactionManagerLookupFactory:80 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
18:26:49,500 INFO SettingsFactory:161 - Automatic flush during beforeCompletion(): disabled
18:26:49,500 INFO SettingsFactory:165 - Automatic session close at end of transaction: disabled
18:26:49,500 INFO SettingsFactory:172 - JDBC batch size: 15
18:26:49,500 INFO SettingsFactory:175 - JDBC batch updates for versioned data: disabled
18:26:49,501 INFO SettingsFactory:180 - Scrollable result sets: enabled
18:26:49,501 INFO SettingsFactory:188 - JDBC3 getGeneratedKeys(): enabled
18:26:49,501 INFO SettingsFactory:196 - Connection release mode: auto
18:26:49,502 INFO SettingsFactory:220 - Maximum outer join fetch depth: 2
18:26:49,502 INFO SettingsFactory:223 - Default batch fetch size: 1
18:26:49,502 INFO SettingsFactory:227 - Generate SQL with comments: disabled
18:26:49,502 INFO SettingsFactory:231 - Order SQL updates by primary key: disabled
18:26:49,502 INFO SettingsFactory:235 - Order SQL inserts for batching: disabled
18:26:49,502 INFO SettingsFactory:397 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
18:26:49,504 INFO ASTQueryTranslatorFactory:47 - Using ASTQueryTranslatorFactory
18:26:49,504 INFO SettingsFactory:243 - Query language substitutions: {}
18:26:49,504 INFO SettingsFactory:248 - JPA-QL strict compliance: disabled
18:26:49,504 INFO SettingsFactory:253 - Second-level cache: enabled
18:26:49,504 INFO SettingsFactory:257 - Query cache: disabled
18:26:49,508 INFO SettingsFactory:382 - Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
18:26:49,509 INFO RegionFactoryCacheProviderBridge:61 - Cache provider: org.hibernate.cache.NoCacheProvider
18:26:49,509 INFO SettingsFactory:267 - Optimize cache for minimal puts: disabled
18:26:49,509 INFO SettingsFactory:276 - Structured second-level cache entries: disabled
18:26:49,512 INFO SettingsFactory:296 - Echoing all SQL to stdout
18:26:49,512 INFO SettingsFactory:305 - Statistics: disabled
18:26:49,512 INFO SettingsFactory:309 - Deleted entity synthetic identifier rollback: disabled
18:26:49,513 INFO SettingsFactory:324 - Default entity-mode: pojo
18:26:49,513 INFO SettingsFactory:328 - Named query checking : enabled
18:26:49,534 INFO SessionFactoryImpl:193 - building session factory
18:26:49,638 INFO SessionFactoryObjectFactory:105 - Not binding factory to JNDI, no JNDI name configured
Hibernate: insert into PersonDetail (income, job, zipcode) values (?, ?, ?)
18:26:49,698 WARN JDBCExceptionReporter:100 - SQL Error: 1146, SQLState: S1000
Exception in thread "main" org.hibernate.exception.GenericJDBCException: could not insert: [com.hibernate.OnetoOneMapping.PersonDetail]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:64)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2176)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2656)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)18:26:49,698 ERROR JDBCExceptionReporter:101 - General error, message from server: "Table 'testdb.persondetail' doesn't exist"

at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:535)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:527)
at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:241)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:292)
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:240)
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:193)
at org.hibernate.engine.Cascade.cascade(Cascade.java:154)
at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:454)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:288)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:563)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:551)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:547)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:342)
at $Proxy9.save(Unknown Source)
at com.hibernate.OnetoOneMapping.TestPerson.main(TestPerson.java:35)
Caused by: java.sql.SQLException: General error, message from server: "Table 'testdb.persondetail' doesn't exist"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1905)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1109)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1203)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2090)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1680)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1527)
at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:94)
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)
... 37 more


here are my three class files



second file

3rd file


E Armitage wrote:Since you are on eclipse just do

CTR + SHIFT + T

and search for that class. Eclipse will tell you which jar file it's in.


thank you i found it in ejb3-persistence.jar file

E Armitage wrote:It's part of the JPA api so maybe you have hibernate-jpa-api.jar?



no, here are my jar files in the below image
hello guys,
i am using eclipse to run hibernate applications. i collected all the jar files required to run a simple hibernate application. i made it and i was successful in running my first hibernate app. many said that javax.persistence.Entity is present in javaee.jar. but there is no such jar file with me. but my app ran very successfully. how can i find javax.persistence.Entity class?

Bear Bibeault wrote:A few observations:

  • You should be using a prepared statement. Otherwise, you are wide open for SQL injection attacks.
  • As the existence of the record is all that matters, doing "select *" is needless; do "select count(*)".
  • You might want to refactor your try/ctach structure; what you've got is rather unweildly.


  • i don't know what SQL injection attacks means and what does prepared statement means? as this is simple application to learn please ignoring about sql injection attacks.
    i have tried select count(*) from lara WHERE username="+uid+" or password="+pw+";" in servlet but got same result. again it gave me unexpected result.
    i couldn't get whats the problem with try catch block. it seems solution you are trying to give me is wide to my knowledge in servlets. could you please narrow it down. where i got wrong?

    in authenticateuser() in servlet it is not returning true when i actually enter true username and password present in database it seems. how can it give return when i enter true values?
    i created a simple application which takes username and password from browser and it will check the availability of those credentials in database if correct it will give "login success" if not "login failure"

    even though in my application if i gave correct credentials which are present in my database it is showing as "login failure" i am using mysql database. where lara is database name and in that there is one table names lara.
    here are my files.

    below is my web.xml file

    below is my html file