[jboss-user] [JBoss Seam] - Need SeamServletFilter Example

jefffry do-not-reply at jboss.com
Thu Oct 26 03:24:08 EDT 2006


I've been trying to access my seam components within my servlet without success.  I keep getting null instances.  Have I performed the steps correctly?

1.Added SeamServletFilter to web.xml.

  | <!-- propogate seam context to servlets -->
  | <filter>
  |      <filter-name>Seam Servlet Filter</filter-name>
  |       <filter-class>org.jboss.seam.servlet.SeamServletFilter</filter-class>
  | </filter>
  | <filter-mapping>
  |      <filter-name>Seam Servlet Filter</filter-name>
  |      <url-pattern>*.serv</url-pattern>
  | </filter-mapping>
  | 

2. Explicitly passed conversation id to my servlet.

  | <h:outputLink rendered="#{test.script!=null}" value="/TestSuiteAdmin/downloadTestScript.serv">
  |      <f:param name="conversationId" value="#{conversation.id}"/>
  |      <h:outputText value="download scipt"/>
  | </h:outputLink>
  | 

3.  Restore the conversation and get my instance in my servlet.

  | 	protected void doGet(HttpServletRequest req, HttpServletResponse resp) 
  | throws ServletException, IOException {
  | 		// TODO Auto-generated method stub
  | 		super.doGet(req, resp);
  | 		
  | 		Manager mgr = Manager.instance();
  | 		String conversation = req.getParameter("conversationId");
  | 		mgr.restoreConversation(req.getParameterMap());
  | 		Test test = (Test)Component.getInstance("test",false);
  | 		
  | 		resp.setContentType("text/plain");
  | 		
  | 		resp.getWriter().print(test.getScript());
  | 	}
  | 

"test" is always null.

What am I doing wrong?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3980925#3980925

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3980925



More information about the jboss-user mailing list