Sunday, November 30, 2008

Seam Interview Questions

  1. How a Transaction can be managed in Seam Application.
  2. What are the Different Seam Components.
  3. What is the Use of @Transient Annotation.
  4. @WebRemote How It works in Seam AJAX Implementation.
  5. Can we have stateless session bean for Conversation Context.
  6. Attribute for Synchronized AJAX REQUEST in AJAX4JSF?
  7. What is the difference between s:link and h:commandLink.
  8. What is the difference between h:commandLink and h:outputLink.
  9. How Event Handling is being done in Seam Framework.
  10. What are the Implicit and Explicit Conversation.
  11. In which phase of JSF Life Cycle the Implicit Conversation will be started and Destroyed.
  12. In which phase of JSF Life Cycle the explicit will be started and Destroyed.
  13. How Can you set the Conversation Time out in Seam Application.
  14. What is the Annotation for Synchronized Access to a Action Listener Method.






Answers:
What is the difference between s:link and h:commandLink?

The s:link tag renders an HTML anchor tag with an "href" attribute. The display value of the link can also be obtained from a message bundle to support internationalization (I18N). This link does not submit an HTML form when included on the page.

This tag facilitates the construction of Seam conversation-aware HTML hyperlinks by allowing you to include invoke JSF backing bean actions using browser-friendly hyperlinks. The Seam conversationId parameter is included automatically in the request by this tag.

Example:





HTML Output

Open Project

What is Bijection in Seam.


The combination of injection and outjection is known as bijection.Bijection is managed by a method interceptor. Injection occurs prior tothe method being invoked, and outjection occurs when the invocation iscomplete. You can think of the context variables participating in thisinteraction as flowing through the component as it's invoked. Injectiontakes context variables from the Seam container and assigns them toproperties on the target instance, and outjection promotes the value ofits properties to context variables.

Seam Bijection Support the Following:
  • Two-way propagation of references: A component can have a reference injected by the container, and a component can also “outject” a reference to the enclosing context as well
  • Dynamic updates: Instead of doing one-time injection of references, bijection is done on each invocation of the component. This is key in the Seam component model, since components can be stateful, and therefore they and their dependent beans can evolve across invocations.
  • Multiple contexts: Dependencies (incoming and outgoing) can be established across multiple Seam contexts, rather than being forced to exist within a single context. So a session-scoped component can inject request-scoped beans and outject application-scoped beans, for example.
Bijection differs from IoC in that it is dynamic, contextual, and bidirectional. You can think of it as a mechanism for aliasing contextual variables (names in the various contexts bound to the current thread) to attributes of the component. Bijection allows auto-assembly of stateful components by the container. It even allows a component to safely and easily manipulate the value of a context variable, just by assigning to an attribute of the component.

Monday, November 24, 2008

Generics and Wildcards.

1.What will be the output of This program?

public class ArrayToCollection {
   public static void main(String s[]){
       int a[]=new int[10];
       for(int i=0;i<10;i++){
         a[i]=i;
       }

       for(Integer i:a){
         System.out.print(" "+i);
       }
   }
}
Answer :0 1 2 3 4 5 6 7 8 9

2.