Tutorials 5
Pretty Time Format :Java
Pretty time format is used mainly in social media site like twitter, Facebook. If you mark your posts in Facebook then you can see message like “posted 2mins ago”, “posted 1day ago”. These formats are pretty time format. Download the jar file from:- http://repo1.maven.org/maven2/com/ocpsoft/ocpsoft-pretty-time/1.0.7/ocpsoft-pretty-time-1.0.7.jar Project Structure:- Test the Pretty Time:- package com.sandeep.pretty.demo;import java.util.Calendar;import […]
Json and Jquery Demo
Building Project Structure : Download the Google GSON from this link download gson. Create a dynamic web project and put the gson jar file in lib folder of WEB-INF.Refer the screen shot below. JsonDemoServlet : Create a Java Servlet to process request from client (browser) .The response type of the servlet be application/JSON. package com.sandeep.example.servlet;import […]
Escaping Html : Apache Common lang3
Apache Common Lang library provides some Util classes for the developer. One of the mostly used util class is StringEscapeUtil. It has many methods for escaping html,xml,java etc. download apache common lang:- download apache common Project Structure:- Demo Data:- package com.sandeep.apache.common.data;/* * HtmlDataService.java * */public class HtmlDataService { public static String getHtmlString(){ return "Sandeep […]
Apache : PdfBox API
Apache PdfBox Api: Apache pdf-box library is an open source project. This library can be used for creating pdf,extracting text from pdf,bookmarking pdf etc. jar files required:- pdfbox-1.7.1.jar, fontbox-1.7.1.jar, commons-logging-1.1.1.jar . Apache Project Structure: PdfBox Demo java Program: package com.sandeep.pdfbox.demo;import java.io.IOException;import org.apache.pdfbox.exceptions.COSVisitorException;import org.apache.pdfbox.pdmodel.PDDocument;import org.apache.pdfbox.pdmodel.PDPage;import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;import org.apache.pdfbox.pdmodel.font.PDFont;import org.apache.pdfbox.pdmodel.font.PDType1Font;public class PdfBoxDemo { /** * @param args […]