Ashish Malik

Ranch Hand
+ Follow
since Jul 11, 2010
Merit badge: grant badges
For More
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ashish Malik

I have:

interface I { someMethod(); }

class A implements I { someMethod(){} }
class B implements I { someMethod(){} }

In some class i want to do:

class Logic {
I obj;

run(boolean x){
if(x){
obj = new A();
} else {
obj = new B();
}
obj.someMethod();
}

I can do this easily with plain Java but, i how to do using spring?
Before that, is there any design problem with that code?
10 years ago
Validator interface is obvious. What i need pattern for are the rules. What i have done for another validator is create classes say: AValidator, BValidator, CValidator. (Rules were divisible into 3 categories)
Each class has set of rules defines in protected methods so that CustomeAValidator could override that method and rest would remain as such.

Each class has following structure:
11 years ago
I am processing an application and it involves validating it. Validation process has many rules to process. Like usual case, application passes through a set of rules and if one rule invalidates it, rest of rules don't execute and application is rejected.
Also rules tend to change for different customers. At one time only one set of customer rules will be active. How should i design my validator class so that it would only suffice to change code for the changed rule and not all rules.
11 years ago
As all validations are independent i would fallback on



Thanks!
11 years ago
I have, for now, had it to be boolean so that i could make:



This didn't seem a good solution to me!
11 years ago
I want to execute certain methods linearly in a way that if any of the methods says the data passed to it is invalid, it should not let methods to be called after it to execute.
For example, my code has following calls:

If validateB() says 'someData' is invalid then validateC() should not execute. What can be a good solution to that? (Probably without using exception as flow control!)
11 years ago
I am getting this error when deploying my application to glassfish cluster. Full stack trace is appended below.
I checked the versioning problem discussed in some other forum. My application uses asm-1.5.3 I checked that no glassfish lib contains versions not recommended.

When i deploy this code on some other machine it works fine, where could i find dependencies in environments of two machines? I checked maven repositories, glassfish libraries, jvm versions.

Please help

I need to include Build version(SVN) and Build date in Manifest file of my ear. I am using Maven to build. Please help!
12 years ago
Debuting at EJB3, i wrote a simple application, deployed it on Glassfish server and i am now getting this frustrating error since around 48 hours. Can anyone tell me where i am missing?
Here's my code.

Remote Interface:


Bean:




Servlet that calls on bean:




Exeption:


This is my snippet from JSP(struts):



I need some class to provide this iteratable_object like returning one or something, so that i can do...




or something like this.
12 years ago
I have written following code inside my jsp:





'listofStudents ' is ofcourse the list of 'student' object.
'student' object contains 'studentCourses' as set of 'Courses' object that contains courseName.

Now the problem is, rendered page does not prints out courseName(s). All other things such as 'rollNum' are printing perfectly.
URGENT!
12 years ago
Apparently only Opera is able to show the page at back button hit after including the response headers.
12 years ago
I have used the addition of 'user object' in the session so no problems there.
Also i tried to set these headers in response from where the jsp page is spit out. No use.
12 years ago
Where do i need to put this? In the servlet that 'logout' link lands on? There i have only invalidated the session....
I put it there and it didn't work.
12 years ago
I have created a web app that only accepts authorized users to view certain pages. After user logs out, he can however view the pages by using browser's 'back' button, although they cannot interact with it i.e any link is forbidden. I want them not to be able to even view those pages after they logged out.


12 years ago