Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
23. May 2008, 16:49 CET | Link

Hej!

I am relatively new to Seam community and i am developing one portal together with Seam. I am currently stuck in middle, i would like to use Seam together with my custom servlet which extends HttpServlet. I don't have a clue how to connect Seam entities to work with my custom servlet. Now i have entity Itemcategory in Seam and works well with JSF showing data, but when i try to create Itemcategory object in my custom servlet i get this message No application context active.

So i searched for help through net, and found that i need to use some kind of context from Seam. So i am now asking for some useful working example of how to implement Seam functionality into my custom servlet.

I thank you for your help in advance

3 Replies:
24. May 2008, 00:36 CET | Link

You need to SeamFilter installed, which relies on the SeamContextFilter to establish Seam contexts around a custom servlet. Then you can get a Seam component as follows:

Component.getInstance(componentName);

 

Dan Allen | mojavelinux.com | Author of Seam in Action

04. Jun 2008, 13:24 CET | Link

Hi Dan, Have you tried it? Do you have any example? Thanks,

04. Jun 2008, 22:12 CET | Link

You can also wrap your servlet request in a ContextualHttpServletRequest in doGet etc.


protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  new ContextualHttpServletRequest(request) {
    public void process() throws Exception {
      // Access seam stuff with Component.getInstance(...)
    }
  }.run();
}

 

If a man speaks in the forest and there is no woman around to hear him, is he still wrong?