Re: Fwd: Re: Fwd: how to use Request and other 'special objects'?

Peter Smith <[email protected]>
Newsgroups gmane.comp.java.webmacro.user
Message-ID <[email protected]>
OK, fixed it.  At first I tried this:

  WM _wm = new WM(this);

But that was getting me some nice
NullPointerExceptions - I eventually figured out that
I wasn't calling 'super.init(cfg)' in my servlet's
init() method (inherited code, yo!).  Fixed.

I also tried the WebContext thing, separately, and
that worked as well.  I didn't realize there was a
Context and a WebContext - I'm doing servlet and
non-servlet environments and was using Context in both
cases.  That also worked.  

Not using WebContext would explain why I was getting
the error '$Request is not defined' (or, similar) when
I first tried using $Request in a template.

Thanks all!


--- Marc Palmer <[email protected]> wrote:
> Peter Smith wrote:
> > I think I've failed to effectively communicate my
> > situation.  Here's another try:
> > 
> >   Is it possible to implicitly access the 
> >   HttpServletRequest object in a WebMacro 
> >   template (in a servlet environment), just 
> >   as in a JSP page?
> 
> Yes, it works out of the box, in $Request.
> 
> I'm in JSP-land at the moment at work... but am a
> seasoned WM user.
> 
> The RequestTool is enabled by default in
> Webmacro.defaults for as long 
> as I can remember, so there is nothing to do to make
> this work.
> 
> 
> What does the following template do for you?
> 
> <html>
> <body>
> <b>Request is: $Request</b>
> </body>
> </html>
> 
> ? For as long as I can remember this just works out
> of the box, as long 
> as you are using a WebContext (WM.getWebContext())
> to use when 
> evaluating the page.
> 
> Cheers
> 
> 
> -- 
> Marc Palmer    [email protected]
> 			
> Wangjammers - Java, J2ME and Web Consultants
>    ~ http://www.wangjammers.org/
> 
> 
> 
>
-------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space
> Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
>
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
> _______________________________________________
> Webmacro-user mailing list
> [email protected]
>
https://lists.sourceforge.net/lists/listinfo/webmacro-user
> 

--peter-- 
http://shmooth.blogspot.com/


		
__________________________________ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.