Tuesday, July 31, 2012

Episode 02 : Dude, Solution is not

He was speechless & tried say something to me. “I won’t be able live without her, I won’t…”

He said, "She is rejecting me, I sent hundreds of SMS to her, she never replied". I confirmed myself about what has happened to Kodiak. I asked reasons about sudden change of Cookie; he said nothing wrong about her. But he criticized himself. I just searched Youtube & played a song which those two guys used play when others were in similar type of condition http://www.youtube.com/watch?v=qG9D3hmYiIw&feature=related.

I directly went to Cookie's house. She called by my name & started to cry. She closed her eyes by both hands & started to criticize about Kodiak. I cannot believe how she can talk like this; I thought Cookie may angry with Kodiak. But the things she was telling is very crucial for both of them as a lovers to carrying their affair, so I keep myself silent and I tried to look at her face. I can see some guilty feeling from her eyes.

So I started to speak; please Cookie, please, you two guys were one of most loving couples I ever seen. Don’t be silly. You know Kodiak more than me. Please, if you two have problems, don’t criticize each other, try to find out a solution. Cookie, you are the person who changed Kodiak's life , who gave him love and hope, who care about you more than anybody else. Kodiak also did more than that, Is that true Cookie? Is that true?. He sacrificed lot of things to be with you….

Every things has its up & down times, So its same you all. But we will only when we understood it. Love is not accomplishing what you desire (what you want). Its always state how you sacrifice, how you believe & how you care

TO BE CONTINUED

Monday, July 30, 2012

Dude, Solution is not 99 bottles....

This is not TECHIE blog post of me. This is a tribute to real lover

This is in real; one of my real closest (name as “*Kodiak*” here after) where this has started to happen from few months ago. Kodiak called me asked for help, even though I was damn tired (only couple of hours after long journey from Sydney). I have many places and special person to meet. But I couldn’t throw his request away.

I went to Kodiak’s place, but he wasn’t there after couple of hours of sleep. But I can hear heart breaking nice song of James Blunt (http://www.youtube.com/watch?v=wVyggTKDcOE) its repeating , I hate saying good bye somebody I really love to see back (meanwhile so I am also remembering lot of my sweet memories too).

So suddenly I was lean into his room & but I was damn surprised by seen his room (damn I don’t know what happened to myself by seeing this). It’s like someone kept me upside down. I suddenly dragged his computer’s chair & sit.

I stopped the player & try to find out what has happened to him. I closed my eyes very hardly & tried to find out, why this fellow is so crazy. I cannot believe myself how he became so alcoholic, hence he was huge oppose for the alcoholic products. I tried to look around I found lot of various brands. I realize something uncommon in his wall, all the photos has been rotated. But I can see only one photo is in its correct view. I can hear someone is coming, but I can recognize who is in that photo. She is Cookie, Kodiak’s girlfriend. Kodiak came to room with very expensive alcoholic product. I saw, tears were falling from his eyes. I asked what happened to f***ing idiot?

TO BE CONTINUED

Tuesday, October 26, 2010

Tuesday, September 14, 2010

JQuery UI datepicker doesn't work in a struts 2 ajax page

If you use struts2 dojo plug-in to get Ajax supports
Ty the parameter executeScripts="true"

Sunday, September 12, 2010

Reason for java.lang.InstantiationException

When I was adding a new DTO class, I was came up "* java.lang .InstantiationException*". So I had little bit annoyed but I found that the default constructor is missing.

Tuesday, April 8, 2008

How to add paging to your web page using spring mvc pattern?

How to add paging to your web page using spring mvc pattern?
Its just matter of writing two controllers as you normally do like to others.
But here we have to use the built in functionality of the Spring mvc.
That is the RefreshablePagedListHolder:
(RefreshablePagedListHolder is a PagedListHolder subclass with reloading capabilities. It automatically re-requests the List from the source provider, in case of Locale or filter changes.
Data binding works just like with PagedListHolder. The locale can be specified in Locale's toString syntax, e.g. "locale=en_US". The filter object can be of any custom class, preferably a bean for easy data binding from a request. An instance will simply get passed through to PagedListSourceProvider.loadList. A filter property can be specified via "filter.myFilterProperty")

Now I hope that you are having some idea about what is “RefreshablePagedListHolder is”
So we can now move to game of paging
these are my main Controllers classes

  1. FooReportDisplayController this will load the all the Foo Details to the command view
    by the size of page given

    package nalin.report.paging;
    import org.springframework.validation.BindException;
    import org.springframework.web.servlet.ModelAndView;
    import org.springframework.web.servlet.support.RequestContextUtils;
    import org.springframework.web.servlet.mvc.SimpleFormController;
    import org.springframework.web.bind.ServletRequestDataBinder;
    import org.springframework.beans.support.RefreshablePagedListHolder;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.util.ArrayList;
    import java.util.List;
    /**
    * this will get Foo details from the DB
    * according the the user inputs and will put that
    * details to the page list holder
    */
    public class FooReportDisplayController extends SimpleFormController {
    private FooCommandAndView fooCommandAndView;
    private FooDetailsService fooDetailsService;
    private int nofRecordsperPage;
    private static final String FOOS = "foos";
    private static final String FORCE_REFRESH ="forceRefresh" ;
    private static final String CURRENT_FOOS = "fooList";
    protected ModelAndView onSubmit(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse,
    Object o, BindException e) throws Exception {
    final String fooName = fooCommandAndView.getFooName();
    List fooList;
    fooList = new ArrayList();
    fooList=fooDetailsService.findFooDetails(fooName);
    // this will add the Foo list to the RefreshablePagedListHolder
    // and set the page size that means the number of records per page
    // this will set at the bean
    RefreshablePagedListHolder listHolder = new RefreshablePagedListHolder();
    listHolder.setSource(fooList);
    listHolder.setPageSize(nofRecordsperPage);
    //this will add page list holder by name "foos" to refer anyware
    httpServletRequest.getSession(true).setAttribute(FOOS, listHolder);
    ServletRequestDataBinder binder = new ServletRequestDataBinder(listHolder, FOOS);
    binder.bind(httpServletRequest);
    listHolder.setLocale(RequestContextUtils.getLocale(httpServletRequest));
    boolean forceRefresh = httpServletRequest.getParameter(FORCE_REFRESH) != null;
    listHolder.refresh(forceRefresh);

    //now your page list is in the commandandview you can acces it in anyware
    fooCommandAndView = new FooCommandAndView();
    fooCommandAndView.setListHolder(listHolder);
    return new ModelAndView(getSuccessView(), CURRENT_FOOS, fooCommandAndView);

    }
    public FooCommandAndView getFooCommandAndView() {
    return fooCommandAndView;
    }
    public void setFooCommandAndView(FooCommandAndView fooCommandAndView) {
    this.fooCommandAndView = fooCommandAndView;
    }
    public FooDetailsService getFooDetailsService() {
    return fooDetailsService;
    }
    public void setFooDetailsService(FooDetailsService fooDetailsService) {
    this.fooDetailsService = fooDetailsService;
    }
    public int getNofRecordsperPage() {
    return nofRecordsperPage;
    }
    public void setNofRecordsperPage(int nofRecordsperPage) {
    this.nofRecordsperPage = nofRecordsperPage;

    }

    }

  2. FooReportPagingDisplayController this will load the Foo Details by the page number

    package nalin.report.paging;
    import org.apache.log4j.Logger;
    import org.springframework.beans.support.RefreshablePagedListHolder;
    import org.springframework.web.servlet.ModelAndView;
    import org.springframework.web.servlet.support.RequestContextUtils;
    import org.springframework.web.servlet.mvc.Controller;
    import org.springframework.web.bind.ServletRequestDataBinder;

    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    /**
    * this will provide the facility to
    * load page by given page number
    */
    public class FooReportPagingDisplayController implements Controller {
    private final static Logger logger=Logger.getLogger(FooReportPagingDisplayController.class);
    private static final String FOOS = "foos";
    private static final String FORCE_REFRESH = "forceRefresh";
    private FooCommandAndView fooCommandAndView;
    private static final String CURRENT_FOOS = "fooList";
    private String successView;
    public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
    throws Exception {
    if (logger.isInfoEnabled()) {
    logger.info("Creating a RefreshablePagedListHolder ");
    }
    //get the page list holder by providing the name eralier set RefreshablePagedListHolder listHolder = (RefreshablePagedListHolder) httpServletRequest.getSession(true).getAttribute(FOOS);
    if ((listHolder != null)) {
    // apply binder to custom target object
    ServletRequestDataBinder binder = new ServletRequestDataBinder(listHolder, FOOS );
    //Bind the given property values to this binder's target
    binder.bind(httpServletRequest);
    //Set the Locale that the source provider should use for loading the list.listHolder.setLocale(RequestContextUtils.getLocale(httpServletRequest));
    boolean forceRefresh = httpServletRequest.getParameter(FORCE_REFRESH) != null;
    listHolder.refresh(forceRefresh);
    booCommandAndView.setListHolder(listHolder);
    //return the list of foo details to page
    return new ModelAndView(successView, CURRENT_FOOS, fooCommandAndView);
    }
    return null;
    }

    public FooCommandAndView getFooCommandAndView() {
    return fooCommandAndView;
    }

    public void setFooCommandAndView(FooCommandAndView fooCommandAndView) {
    this.fooCommandAndView = fooCommandAndView;
    }

    public String getSuccessView() {
    return successView;
    }
    public void setSuccessView(String successView) {
    this.successView = successView;
    }

    }