bablu singh

Ranch Hand
+ Follow
since Nov 14, 2011
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
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by bablu singh

No 3 is also correct. I am not sure about no 4 because as far as I know it should return positive integers but when I googled I found that we get a negative integer after the overflow. Negative hashcode is perfectly valid! It is perfectly legal to have negative hash codes.  Can you please share your thoughts.
2 years ago
The link is really helpful and to your question it is just like the second bullet point in that link:
"If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result."

Does this mean that Option 1 is the correct answer?
2 years ago
Which of the following statements are true about hashCode in java?
1. if two objects are declared equal using the equals() method then they must have the same hash codes.
2. if two objects are declared equal using the equals() method then they may or may not have the same has codes.
3. during the execution of the java application if the hashCode() method is called on the same object multiple times then the method must return the same integer value.
4. the object class has a hashCode() method that returns only positive integers.

Option 1 - 1 and 3
Option 2 - 2 and 4
Option 3 - 2, 3 and 4
Option 4 - 1, 3 and 4

Which option is true. I am confused in Option 2 and Option 3.
2 years ago
You were right, its not pickin up the property file. URL value is coming as null, not only URL but username and password also. Then I tried:Its again giving me java.sql.SQLException: Invalid Oracle URL specified: OracleDataSource.makeURL error.Its giving me null pointer exception. Its not initializing appConfig by Autowiring. Could you please point me out where I am wrong.
4 years ago
I am using oracle jdbc pool datasource - oracle.jdbc.pool.OracleDataSource (ojdbc7- and it's working properly using first approach. This Spring based application is not having any configuration XML file, Its purely a java based configuration. URL and credentials are configured in properties file. It's not using LDAP for authentication.
4 years ago
Hi Mohammed, Thanks for looking into it.
As you suggested, all jars are in place, building using maven.
I checked the database connection with SQLDeveloper, its connecting properly.
Also, tried debugging and I am getting the error at line no 53. Please see the logs.
Connection URL is also valid and its in the jdbc: oracle:thin:@localhost:9080:xe format. Also, same is working using first approach, as I mentioned earlier.
4 years ago
I am making connection with Oracle DataSource and I am able connect with DB using first approach. But getting error using second approach. I want to use second approach. I want to make data connection in impl class.

First Approach

Second Approach:

Could you please guide me. Thanks in advance.
4 years ago
Hi All,

I am a newbie to MB/MQ things. I got to know there is a Message Broker, it has got so many Execution groups. Further Execution groups has got Message flows.

Also we can start and stop the message flows. If we want to stop all then we can stop execution group. It will stop all the message flows.

So the thing, Can we start and stop the Execution group and message flows from Java?

Can we store the information about the execution group and message flows in an array list, because there can be any number of execution groups and message flows?

Any Suggestions...
6 years ago
Thanks for the suggestions...

But, it first uploads the file to a particular location like

and after that we can read the content of the file.

Is there any way, we can read the contents without uploading to a location.
6 years ago
Hi All,

I am uploading XML file from JSP:

on submit action is getting called and going to servlet.
To read the content of the file I am using below code:

I am getting below output:

But I want only the xml portion. So that I can read the node contents.

Please help.
6 years ago
I am working on an application that includes a jsp page, having 5 columns and checkbox corresponding
to a row to edit a particular row.

ProjID ProjName ProjDesc ProjEmail Edit
101 Proj101 ProjDesc101 checkbox
102 Proj102 ProjDesc102 checkbox
103 Proj103 ProjDesc103 checkbox

on page load all the fields are readonly, when click on checkbox I can edit Projname, projdesc, email.
e.g. I have checked 3 checkboxes and I am making an array in javascript. The values in array:

So I am able to get the value in the servlet using
String[] newVals = request.getParameterValues("editedVals");

I have a class having 4 fields and getter setters.

I was trying this code, but nothing happened. I want to set "101","Proj1010","ProjDesc1010",""
to one object of ProjPojo and the number of values comes from UI. After that want to update these fields in DB.

Any Suggestion..
6 years ago
That is fine, we should use the JEE built in securing web applications functionality rather than creating own. But, customization is also one of the key area in applications.
So, I tried using the following code:

When I execute, I am getting the following error:

Then I changed my action to:

Now the user is getting logged in, but it returns to Login page again saying that email id and password can not left blank, as it should redirect to Welcome.jsp
Any Suggestion.
6 years ago
Hi guys,
I created a SessionInterceptor that checks whether the user information is present in session and session is expired or not. If the session is null or empty then I want to return the control to Login page. But the problem is when I enter valid username and password it goes to the session interceptor class, and it says session is null and it return to login page again.

How would session will be created if the user does not logged in, as it redirects me before logging in the user.
Any Suggestion.
6 years ago
You can try with the following
6 years ago