JSP equivalent to PHP $_SERVER?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • comp.lang.php

    JSP equivalent to PHP $_SERVER?

    I looked up System.getPrope rties, but to be honest, I have no clue how
    to use it in light of what I can do in PHP, which is this:

    <?php echo $_SERVER['HTTP_USER_AGEN T'] . ' ' . $_SERVER['SERVER_URI'];
    ?>

    it would be very nice to find the JSP equivalent of <? phpinfo(); ?>
    (anyone know who knows both PHP and JSP?) but until then, what on earth
    do I do?

    Thanx
    Phil

  • James Westby

    #2
    Re: JSP equivalent to PHP $_SERVER?

    comp.lang.php wrote:[color=blue]
    > I looked up System.getPrope rties, but to be honest, I have no clue how
    > to use it in light of what I can do in PHP, which is this:
    >
    > <?php echo $_SERVER['HTTP_USER_AGEN T'] . ' ' . $_SERVER['SERVER_URI'];
    > ?>
    >
    > it would be very nice to find the JSP equivalent of <? phpinfo(); ?>
    > (anyone know who knows both PHP and JSP?) but until then, what on earth
    > do I do?
    >
    > Thanx
    > Phil
    >[/color]


    User agent is a Http header right?

    If so you want

    String getHeader(Strin g) on the HttpServletRequ est

    e.g.

    request.getHead er("User-Agent");

    this returns a String that you can do what you like with.

    I don't know php, but looking up phpinfo() it seems like there wont be a
    single Java equivalent, as no object has all that information at its
    disposal. Some of the information is probably availabel through
    different methods though.

    James

    Comment

    • phillip.s.powell@gmail.com

      #3
      Re: JSP equivalent to PHP $_SERVER?

      Thanx, I just had no info on that one, sorry. In PHP $_REQUEST and
      $_SERVER and $_ENV are completely different collections, so I had no
      reference coming into Java.

      Phil

      James Westby wrote:[color=blue]
      > comp.lang.php wrote:[color=green]
      > > I looked up System.getPrope rties, but to be honest, I have no clue how
      > > to use it in light of what I can do in PHP, which is this:
      > >
      > > <?php echo $_SERVER['HTTP_USER_AGEN T'] . ' ' . $_SERVER['SERVER_URI'];
      > > ?>
      > >
      > > it would be very nice to find the JSP equivalent of <? phpinfo(); ?>
      > > (anyone know who knows both PHP and JSP?) but until then, what on earth
      > > do I do?
      > >
      > > Thanx
      > > Phil
      > >[/color]
      >
      >
      > User agent is a Http header right?
      >
      > If so you want
      >
      > String getHeader(Strin g) on the HttpServletRequ est
      >
      > e.g.
      >
      > request.getHead er("User-Agent");
      >
      > this returns a String that you can do what you like with.
      >
      > I don't know php, but looking up phpinfo() it seems like there wont be a
      > single Java equivalent, as no object has all that information at its
      > disposal. Some of the information is probably availabel through
      > different methods though.
      >
      > James[/color]

      Comment

      Working...