(3) Action Class to Access the Attribute Set in the Plugin
package com.visualbuilder;
import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;
public class TestPluginAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)throws Exception { System.out.println(servlet.getServletContext().getAttribute("testPlugin")); return mapping.findForward("SUCCESS"); }}
(4) Output
Note:-The program will just print "The plug in initialized" when the server starts and Print "Testing for the object" when you call the "/plugin.do" action.
© copyright 1999-2010 VisualBuilder.com