Click here to Skip to main content
12,078,370 members (47,692 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Java Perl
#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
print header;
print start_html("Environment");
 
foreach my $key (sort(keys(%ENV))) {
print "$key = $ENV{$key}
\n";
}
 
print end_html;





how can write same logic in java. its urgent for me please help me
Posted 22-May-13 20:57pm
Comments
Bernhard Hiller 23-May-13 2:38am
   
First step: understand what the program does.
Second step: implement a program in Java which does the same...
And: it is not at all urgent for anyone giving answers on CodeProject.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Something like
import java.util.Map;
 
// ...

	Map<string,> env = System.getenv();
	System.out.format("Environment variables:%n");
	for (String envName : env.keySet()) {
	    System.out.format("\t%s=%s%n", envName, env.get(envName));
	}
  Permalink  
Comments
Member 10066544 23-May-13 7:04am
   
its giving my system env varibales details. is there any way to get client ip address along with data about what client visited in my site
Member 10066544 23-May-13 7:06am
   
i have used one javscript file for creating cookies. but i dint how to apply in my project and its working environment
Member 10066544 23-May-13 7:10am
   
is there any way to create cookies using client ip address. further i need to store client's visited data in database for future purpose
Richard MacCutchan 23-May-13 7:45am
   
Your tag and your question relate to Java. You are now talking about Javascript - they are not the same thing.
Member 10066544 23-May-13 8:14am
   
yes i know but. i tried with java script.. but its not suitable for my application. now i want to achieve this one using java
Richard MacCutchan 23-May-13 8:23am
   
Then you need to provide proper details about what you are trying to do, we cannot guess.
Member 10066544 24-May-13 0:12am
   
i have capture visitors ip address by using the following.
InetAddress localhost = InetAddress.getLocalHost();
System.out.println(" IP Addr: " + localhost.getHostAddress());


now ineed to record website visitors data using visitor's ip address. how can i do this one
Richard MacCutchan 24-May-13 2:58am
   
See http://forums.asp.net/t/1801725.aspx/1. Note, that I found this quite easily via Google.
Member 10066544 24-May-13 4:45am
   
thanks for your support. But my problem is not that one. Am getting ip address of client's. but i need implement one generic function for capturing website visitors data further i need to store data in database.I meant to say in side my website what visitors are doing that i need to get into my function. Like one webservice method LogthisEvent(website Name, IpAddress, Event performed, Date and time). then i log this information into DB.
Richard MacCutchan 24-May-13 5:53am
   
Sorry but I don't know how you would do that. But I am sure that Google could find you some samples, or you could try the CodeProject articles, or even some of the samples on the ASP.NET website.
Member 10066544 24-May-13 6:43am
   
ok thank u
Member 10066544 25-May-13 3:29am
   
hi..
how can i get original url in struts tiles. we can forward to many pages. but in browser it ll display only one url like ...../*.do. but how can i get original urls of forward pages. here i tried with the following but gives null values

code:

request.getAttribute("javax.servlet.forward.query_string)
request.getAttribute(Globals.ORIGINAL_URI_KEY)).toString()
request.getAttribute("javax.servlet.forward.request_uri")

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160212.1 | Last Updated 23 May 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100