Showing posts with label JSF. Show all posts
Showing posts with label JSF. Show all posts

Tuesday, November 24, 2009

JSF refresh current document

If you ever wanted to refresh the current document to reflect new information...below is the method that you will need...

    public void RefreshCurrentDocument() {
        FacesContext context = FacesContext.getCurrentInstance();
        String currentView = context.getViewRoot().getViewId();
        ViewHandler vh = context.getApplication().getViewHandler();
        UIViewRoot x = vh.createView(context, currentView);
        context.setViewRoot(x);
    }

Good Luck...

Read more...

JSF SelectOneMenu valueChangeListener

Today I used the following code in one of my projects...(the below is just a pseudo code..)



Inside the bean I had:
    public void mymethod(ValueChangeEvent ve)
    {
      ...
      ...
    }


I hoped that changing value on the select menu would fire the method but instead nothing happened...if you are also stuck at this point...change the code as follows:



Notice the onchage attribute that is newly added...this will fire the method...

Hope this helps...

Read more...

Thursday, October 29, 2009

EJB entity relations onetomany

Using @OneToMany and @ManyToOne entity relationship might sound little difficult and confusing in the beginning but actually it is very easy. I recently used it in one of my projects and it worked great.

Here is how the code in your entities should look like...

Assuming table 1 and table 2 have one to many relationship...then...

in the table 1 entity...you have...

...
    @OneToMany(mappedBy="table2mapping")
    private Collection table2list;
   ..associated getter and setter...


in the table2 entity..you have...
@JoinColumn(name = "table2ID", referencedColumnName = "table1ID", insertable=false, updatable=false)
    @ManyToOne
    private table1 table2mapping;

@JoinColumn should be changed depending upon your requirements...
Let me know if you have any questions...

Read more...

Thursday, October 1, 2009

Tomahawk datatable sorting

Guys,


If you are trying to use sorting on Tomahawk datatable, I suggest that you use the latest tomahawk jar file. The one that worked for me is tomahawk-1.1.9.jar


1. there is no need to write any additional code in the backing bean

2. your column should look in the following format...the below is just an example...
















In the above code notice that sortable=true attribute...it takes care of everything...also notice that by setting arrow=true would have eliminated the additional code of including your own images...

let me know if you have any questions...

Read more...

About This Blog

In this blog you will find simple but great ideas on various topics ranging from food recipes to investment strategies. I hope the ideas presented in this blog will help you all in some way or other. Also included are the recent and hot news around the world...

Go ahead and grasp my ideas...

Disclaimer and Terms of Use

All the ideas and opinions provided herein are intended to share and inform simple and useful information. They come with no warranty of any kind. If you should choose to interpret graspmyideas.blogspot.com information as perfect working ideas, or advice or if you want to completely rely on these ideas, you do so at your own risk.

This site is offered as is and without warranties of any kind. We are not responsible for timeliness, accuracy, unavailability or interruptions in availability, viruses or other defects in the site or its contents. In no event shall graspmyideas.blogspot.com site or its authors are responsible for any damages to users or their computer systems.


Your Ad Here

  © Blogger template AutumnFall by Ourblogtemplates.com 2008

Back to TOP