Re: Specific PHP/JSP questions

From: Date: Fri, 16 Feb 2001 22:00:52 +0000
Subject: Re: Specific PHP/JSP questions
Groups: php.general 
Request: Send a blank email to php-general+get-40237@lists.php.net to get a copy of this message
Addressed to: Gerald Gutierrez <pozix@home.com> php-general@lists.php.net ** Reply to note from Gerald Gutierrez <pozix@home.com> Thu, 15 Feb 2001 01:04:30 -0800 > 2) In JSPs, it is possible to do server-side page redirection, i.e. > "forward" a request from page A to page B, as if the user actually > requested page B. There is no browser involvement in the redirection; it is > complete on the server. In this scenario, there are two "page scopes", and > one "request scope". How is this server-side redirection done in PHP? You might do something like: pageA.php ------------------------------------- <? if( user_realy_wants_page_b ) { include( 'pageb.php' ); exit; } ?> Page A starts here... ------------------------------------- That all happens on the server, and does not require anything outside of page A to implement. > 3) In doing the server-side page redirection, variables can be added to a > "request" object, which embodies parameters related to a request. Page A > can add variables to the request object (perhaps values from an SQL > select), which page B can then retrieve and display. How is this done in PHP? In the example above, any variables set in page A will be visible in page B when it is included. The values must be set BEFORE the include() is hit. > 5) On a JSP site, I typically arrange things such that a particular JSP (or > servlet) accepts requests, processes them and then forwards them to one of > a number of different pages, depending on the outcome of the processing. > This is in contrast to the alternative approach where one simply goes to a > page, which does some processing and then displays the contents of the > requested page. What is the typical way to achieving this "funnel all > requests to a single point and have it forward the correct response to the > user" paradigm? <? switch ( $Desired_Action ) { case 'PageA' : include( 'pagea.php' ); break; case 'PageB' : include( 'pageb.php' ); break; case 'PageC' : include( 'pagec.php' ); break; default: include( 'defailt.php' ); break; } would be one possibility. Rick Widmer Internet Marketing Specialists http://www.developersdesk.com

« previous php.general (#40237) next »