Blog Archives

classNotFoundException : Javax.Servlet.Jsp.Jstl.Core.Config


Are you trying to leverage JSTL tags in JSP but getting classNotFoundException? This might be the case if you are deploying your web application in tomcat (I came across this while migrating from one container to other). Many JEE containers provides this, but not tomcat.
To solve this, Include following dependency in project to fetch the jar and bundle it with library

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version> 
</dependency>

Spring data -yet another abstraction -quickly getting started


We started with JDBC, then ORM which abstracted the underlying relation DB. Then came JPA -which abstracted the underlying ORM. Now Spring Data

But the kind of versatility we see today in data storage -relational, distributed, nosql and others, to me Spring Data seems to server the purpose.

It abstracts the CRUD for “different” type of data as relational, nosql and just by coding to appropriate interface CRUD operations can be achieved. For getting started use this link for configuring the entity manage, transaction manager -basically the setup stuff.

Write a DaoInterface -here the magic goes, the extended interface decides type of data , relational, nosql etc.

public interface TestDao extends CrudRepository<TestData , Integer> {
}

And then for CRUD operations use this Interface :

@Service
public class TestService{
    @Autowired
    TestDao testDao;
 	public boolean saveTestData(TestData testData){
    	if(testData!=null){
    		testDao.save(user);
                return true;
        }
    	return false;
    }
}
     @Entity
	@Table (name="testtable")
	public class TestData {
	 
	    @Id
	    @GeneratedValue
	    private Long id;
	     
	    public Long getId() {
	        return id;
	    }
	 
	    public void setId(Long id) {
	        this.id = id;
	    }

I found it simple, yet flexible and power full considering the fact that although projects start with SQL, but down the line NOSQL is definitely on their road map -this abstraction will ensure least throwaway code!

Never depend on client side dates or any stuff which can be manipulated outside out control


Recently while doing a code review I came across a code which was using date functions in Action script (Adobe client side code) to print payment receipt date.
For persisting the payment date, it was being read from server -But for printing on receipt it was read from client machine.
I got an explanation that why to send a data which can be read same way on client (Referring to equivalent of getCurrentDate) -missing the point that we should never rely of stuff which can be manipulated outside out control.

Encoding vs Encryption


Although these are most basic concepts for security, it’s not uncommon hear people using these two terms interchangeably.
Encoding : Convert data to some other representation –so that it abides by target expectation/protocol. Data transported over HTTP, FTP, compressed files –all are encoded , such that, on arriving at target, HTTP protocol, FTP protocol and compression utility get data in which they can process.
Encryption can be as simple as “Reorganizing” the data –Adding some header, footer etc. or it could be conversion of character to some format –But the intent is not “securing” Data.

Encryption: Encryption could be encoding, but not vice versa. Intent is secure transfer –only intended recipient can decipher the data. It could be just simple encoding or it could use complex cipher algorithm and keys to abide by encryption.