473,698 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Jan 16 '06 #1
2 6874
comp.lang.php wrote:
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

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
Jan 16 '06 #2
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:
comp.lang.php wrote:
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

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


Jan 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
9786
by: chops | last post by:
I need the path of the script that is running. Unfortunately it is not in the $_SERVER array when running a script through the CLI. Through a browser I can strip the script name off, e.g $_SERVER => "C:/Apache2/htdocs/test/filename.php" However through the CLI the path doesn't appear in $_SERVER. Only the script name. Actually $_SERVER, $_SERVER and
4
3852
by: Larry Kahm | last post by:
Is there a PHP equivalent to the javascript statement history.go(-1)? Thanks! Larry
7
12277
by: deko | last post by:
Why is $_SERVER returning multiple IP Addresses? Actually, I'm not sure if it's $_SERVER -- or which if/else statement -- that's the problem, but what I'm getting as a value for $visip looks like this: 172.16.42.181, 62.138.35.94 Why am I getting more than one IP Address? Which IP is the originating IP Address? Is there a way to get only the originating IP?
4
2498
by: CPD | last post by:
I can't parse $_SERVER when using the alphabetic key instead of the numeric index of the array. Below is some of the line-numbered code, followed by the corresponding output. For this posting, IP address and domains shown are fictitious. Note how the REMOTE_HOST is resolved by gethostbyaddr() using a hard-coded IP address or the array index "10", but it fails completely when the literal key REMOTE_ADDR is used. Any help with this will...
12
4458
by: Don | last post by:
What's the PHP equivalent for the following? if(window.location == "http:/site.com/page1.html") { } else { }
1
4192
by: Michael Brennan-White | last post by:
If I submit my for using a get action the resulting page loads . If I use a post action I get an error page saying "The page cannot be found". I am calling the originating page!!! This happens in IE as well as FireFox. This code has been tested on a Win2003 server, IIS6, PHP 5.0.3, mySQL 4.1.8 and it works fine. The problem server is a Win2k server, IIS5, PHP 5.0.4, mySQL 4.1.11.
1
5806
by: jerrygarciuh | last post by:
Hello, I am finding that on a new server where I am developing $_SERVER and $_SERVER Do not show up in $_SERVER when I when they should be defined I test using print_r($_SERVER) or this
10
5252
by: Jim Carlock | last post by:
Looking for a way to extract the path from the pfqpn (partially full qualified path name). $sThisServer = $_SERVER; // returns either aquaticcreationsnc.com or www.aquaticcreationsnc.com $sThisServer = $_SERVER; // returns aquaticcreationsnc.com whether or not the end-user typed // in the preceding www.
3
4549
by: Frank Moyles | last post by:
What is the equivalent for retrieving server side variables? For example in PHP, one such predefined variable is: $_SERVER
0
8612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8880
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7743
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.