Posts

Showing posts with the label Java

How to get IP address and MAC address of client in java | #CodeFactory

- Java access to the client IP address and MAC address -  In JSP, method to obtain the client's IP address is: request.getRemoteAddr (), this method is effective in most cases. -  After the agent, because between the client and the service increased intermediate layer, so the server can not be directly to the IP client, server application is not directly by forwarding the requested address is returned to the client. -  But in the HTTP header information request, increase the XFORWARDEDFOR information. To track the original client IP address and the original client requests the server address. -  When we visit index.jsp/, In fact, we are not true to the browser to access the index.jsp file on the server, But the proxy server to access the index.jsp , The proxy server will access to the results returned to the browser, Because it is a proxy server to access the index.jsp, So the index.jsp through the request.getRemoteAddr () method to obtain the IP is actually the...

Java DOM Parser - Parse XML Document | Code Factory

Image
File : ReadXMLFile.java package com.codeFactory; import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class ReadXMLFile { public static void main(String[] args) { // TODO Auto-generated method stub try { File folder = new File("./src/com/codeFactory"); File[] listOfFiles = folder.listFiles(); // get all files details for (int i = 0; i File : staff.xml yong mook kim mkyong 100000 low yin fong fong fong 200000 low yin fong fong fong 200000 low yin fong fong fong 200000 File : staff1.xml yong mook kim mkyong 100000 low yin fong fong fong 200000 low yin fong fong fong 200000 low yin fong fong fong 200000 Tags : Java DOM Parse...