Hi ! ModuleConfig config = org.apache.struts.util.RequestUtils.getModuleConfig(pageContext); // since 1.1b3
-- Andrew Kuzmin ----- Original Message ----- From: "Zheng, Gang" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 04, 2003 7:48 PM Subject: RE: Obtaining valid ModuleConfig. > Hi, > > I just subscribe to the mailing list and this is exactly what I got from the > example code. > > The ModuleConfig is actually stored in the ServletContext (application > context) rather than request context. So you have to modify the code to: > > ModuleConfig config = (ModuleConfig) pageContext.getServletContext() > .getAttribute(org.apache.struts.Globals.MODULE_KEY); > > I tested it and it works. > > Hope this is helpful. > > -Gang > > > -------------------------- > Hi, > > I'm using the following snippet in taglib code but it fails as config==null. > (Stuts 1.1 b3) > > public int doEndTag() throws JspException { > <snip> > ModuleConfig config = (ModuleConfig) pageContext.getRequest() > .getAttribute(org.apache.struts.Globals.MODULE_KEY); > if (config == null) { > System.out.println("config == null"); > } > if (config.getPrefix() == null) { > System.out.println("config.getPrefix() == null"); > } > try { > pageContext.forward(config.getPrefix() + page); > } catch (Exception e) { > throw new JspException(e.toString()); > } > return (SKIP_PAGE); > } > > The code is based on the example that comes with struts. I presume I'm > missing something obvious but I'm new to Struts and can't track it down. > Could someone give me some pointers before I tear all my hair out ;-) > > Regards > > /James > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]