Maksims Medveckis

+ Follow
since Dec 23, 2017
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Maksims Medveckis

Ok, but why when I use this method of the servlet, of course, with multi-part configs , it works fine with getParameter() method (without forwarded request from the filter) :

When I use the same servlet but forwarded request from the filter, which can get type param from url ("?type=add_athlete"), request object that comes from the filter doesn't contain body request, it contains only this type param, of course, it can be because
request body is overrided by url params, but ,never mind,  the key point is that filter can not parse multi-part request themself, so using what kind of libriraies should I do that? I need to get only one "type" param.
1 week ago
Good evening, consider the following:

req.getParamter() method should return type param value but it returns null value instead. The calling page is here:

When I use type param in url(like this "?type=add_athlete") it works correctly, but when this request is forwarded to the servlet , I receive NullPointerException, maybe it is because I use POST method?
Actually, I don't understand why it doesn't work, can anybody help me to deal with it?
1 week ago
Good day, programmers, I have a little bit silly question but it can not leave me alone. So, I have to create connection to a db using jdbc, and in jdbc version 4.0 or higher loading driver is not necessary :

In previous versions of JDBC, to obtain a connection, you first had to initialize your JDBC driver by calling the method Class.forName. This methods required an object of type java.sql.Driver. Each JDBC driver contains one or more classes that implements the interface java.sql.Driver. The drivers for Java DB are org.apache.derby.jdbc.EmbeddedDriver and org.apache.derby.jdbc.ClientDriver, and the one for MySQL Connector/J is com.mysql.jdbc.Driver. See the documentation of your DBMS driver to obtain the name of the class that implements the interface java.sql.Driver.

Any JDBC 4.0 drivers that are found in your class path are automatically loaded. (However, you must manually load any drivers prior to JDBC 4.0 with the method Class.forName.)

  This quote is from jdbc tutorial that I have found on Oracle website.
So, if I use this approach without registering driver it works fine with console-based app. When it comes to the Tomcat 8 , there are problems. I know that .jar file of the MySQL connector should be either in classpath or in %CATALINA_HOME%/lib directory of Tomcat 8.
The problem is that, without manually registering driver app doesn't work. If I don't manually register driver I have the following issue: 
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/dbName .
I have also checked .jar file and found Driver class and there are :

Why using console-based approach, I mean without servlet container, I don't need to manually register driver, but with the servlet container I must do it?
1 month ago

Rob Spoor wrote:Welcome to the Ranch!

Did you override the equals method in your Athlete class (and by association also the hashCode method)? Because if you haven't, the class will inherit the implementation from its super class. If that's Object, then equals will simply use ==, and that will return false for two different instances, even if they have the same content.

Thank you a lot, of course, it's  my fault, I didn't override either equals() nor hashCode() methods in Athlete class(
1 month ago
Hello, I have a problem, consider the following:

This is a code that should take all athletes from db(mysql) and return them as a list of athletes. The problem is, that object called athlete11 and athlete22 doesn't match in this list. As if athlete11 and athlete22  are not in the list. I try to debug this code, and the objects in the list and athlete11 and athlete22 are the same all the time. I have made several screenshots of my db rows and the debug log( I use IntellijIDEA), wich you can find in the attachment, from wich I can make a conclusion that objects should be the same, but in some reason, they aren't. What is the root of the porblem and how I can fix it?
1 month ago