Gerald Gutierrez wrote:
> Hi all.
>
> I understand that a lot of JSP Vs. PHP questions have been asked on this
> list, but they've been philosophical and general in nature. I have some
> specific questions and was hoping that someone might be able to entertain them:
>
> 1) JSPs can persist variables at the page, request, session and application
> scopes. I believe PHP variables are implicitly page-scoped, and session
> management can be used for session-scoping. Are there equivalents to
> request and application scoping?
>
My understanding of this is that the language itself doesn't handle this. PHP
is a language. Java is a language. Neither implicity handle application
variables. However,
Java running in a java application server handles these for you, similar to how
VBScript running under ASP handles this. You would need an overriding architecture
in PHP that would handle this for you. Someone suggested an autoprepend - we
use one main file which handles all this for you (sessions, applications, etc) and
includes
whatever classes are necessary to process a specific request. As all logic passes
through
one file, that file can handle all session/app variable handling, as well as
security, logging,
error handling, templating and other things.
>
> 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?
>
Not directly possible, although storing session info, then doing a 'redirect'
to another page via Location: header should accomplish the same thing. We
have a redirect function which handles this - I can set my session vars, then
redirect()
and it'll close the session, then redirect, pick up the session, and continue
processing.
*probably* equivalent to what you're looking for?
>
> 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?
>
See above. We've not tried adding things to the request object, but store things
in sessions between pages.
>
> 4) JSPs, being a part of J2EE, can use a security system that does
> authentication and authorization. What is the commonly accepted way to do
> security with PHP?
There are multiple security models out there for implementation in PHP projects -
it comes down to the requirements of the task at hand. There isn't a
'common' way, yet, anyway, which is both positive and negative.
>
> 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?
>
Have all your requests go to a single URL, with parameters after them.
blah.com/PHPfile/param1/param2
blah.com/PHPfile/param4/param3
Both requests go to PHPfile, and get processed accordingly. Not sure why you
need to redirect, and couldn't simply include() the logic you need in the
main file.
>
> 6) JSPs can be packaged up as an application (a WAR file), and that WAR
> file has descriptors that allow mapping of URLs to JSPs and servlets. This
> allows me to just drop in a WAR file to a JSP container, like Tomcat, and
> have it run. Are there equivalents to the "pack it up as an application"
> and URL mapping concepts in PHP?
>
Not to my knowledge, although I don't doubt someone, somewhere is working
on a similar approach.
>
> 7) JSPs can be mapping to multiple URLS, e.g. /alpha/mypage and
> /beta/mypage can both go to the same JSP. Is there an equivalent to this in
> PHP?
Again, it's a server thing, not a language thing. This is best accomplished
at the web server level, with aliases of some type.
>
> I have several more, but this is a sample. Answers to these questions are
> quite important to me because at the moment I'm trying to decide whether I
> should choose JSPs (J2EE actually), PHP or Zope for some projects.
>
Some of this decision will come down to the comfort level of the developers.
I somewhat don't care how great Zope is - if I needed a project done on a deadline,
I wouldn't use it, because I'm not familiar with it. If you and/or everyone on
your
team knows Java, there's little reason to use Zope or PHP, I'd think.
Using something like the APC or zend cache, the "compilation time" of PHP scripts
is nothing, especially compared with JSP (at least, my limited experiences with
JSP).
Also, given the JVM, JSP pages may run fairly slowly. The zdnet "shootout" from a
few weeks ago pointed out that PHP was much faster than JSP, at least for a
standard benchmark app they used.
Lies, damn lies, and benchmarks. :)
>
> Thanks.
>
> Gerald.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]