[mod_python] reg forward page

Graham Dumpleton grahamd at dscpl.com.au
Wed Jan 18 16:57:22 EST 2006


python eager wrote ..
> Hi
>      from python, how to forward the psp page and how retain the values
> which are getting in python, that should be display in python server pages
> (psp). Please help me. 
>    
>   Note : in java struts is mainted this logic using findforward. Automatically
> the struts forwarded to particular jsp page. Like that i need.

It is not totally clear what you mean in some of what you ask. I would
suggest three areas of psp/mod_python that you should look at and work
out for yourself if they may or may not be appropriate in the context of
how you are doing things.

First off is that mod_python.psp pages do support the 'include' statement.

  <%@ include file="/file/to/include"%>

This will allow you to include another PSP page into the first at the point
required. It should still have access to the same request object as the parent.
See:

  http://www.modpython.org/live/current/doc-html/pyapi-psp.html

For details on PSP syntax.

If you want to be able to include within a PSP page the output of a completely
different handler into a PSP page, you may be able to use req.internal_redirect().
This method of the request object allows you to direct Apache to process a
sub request for a different URI. The URI may even map to static files or handlers
written in something other than mod_python.

Passing data through a req.internal_redirect() call can be trick. Only ways of
really doing it are to store the data in the 'notes' or 'subprocess_env'. See:

  http://www.modpython.org/live/current/doc-html/pyapi-mprequest-meth.html
  http://www.modpython.org/pipermail/mod_python/2005-April/017920.html
  http://www.modpython.org/pipermail/mod_python/2005-April/017922.html
  
Ensure you track back and forth through the mailing list discussion about
passing data through req.internal_redirect() to get the full picture.

Finally, if you want to chain the output of multiple handlers together, ie., add
after the complete output of the PSP page output from some other handler. You
can use req.add_handler(). Again see:

  http://www.modpython.org/live/current/doc-html/pyapi-mprequest-meth.html

Graham


More information about the Mod_python mailing list