But that Date Picker can only navigate in month level, so i would like to add previous year and next year also. I made the following changes on the Date Picker class. Continue reading Java – Swing DatePicker @ 2→
But most of the time we would like to read them file instead. The following Class demonstrate how to write the config.properties. Continue reading Java – Read .properties→
If you want to convert a String into InputStream, you can use the following piece of code.
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
public class ConvertStringToInputStream {
public static void main(String[] args) {
try {
// Convert the String into InputStream
String eurekaUrl = "https://ykyuen.wordpress.com";
InputStream is = new ByteArrayInputStream(eurekaUrl.getBytes("UTF-8"));
// Use Apache Commons IO to get the content of the InputStream
System.out.println(IOUtils.toString(is, "UTF-8"));
} catch (Exception e) {
e.printStackTrace();
}
}
}
Recently, i have created a simple Java Servlet server which could parse a request xml from the HTTP POST Request and then return the HTTP Response together with the response xml. In the server implementation, i need to convert an InputStream into a String. The following code shows you how to make it.
The Java Naming and Directory Interface (JNDI) is the standard Java API for multiple naming and directory services such as Lightweight Directory Access Protocol (LDAP).
Active Directory is a group of network services like account authentication and it supports LDAP. Therefore, you can write a Java program using JNDI in order to obtain the account credentials in the Active Directory of a Windows Server. Here comes the example. Continue reading Java – Connect Windows Active Directory Through LDAP @ 1→
In this article, i will show you how to integrate the Selenium tests into a Maven webapp project using the selenium-maven-plugin and cargo-maven2-plugin.
In this example, i used JUnit as the testing framework. There is no problem if you use TestNG to replace JUnit. This example is a simple Java webapp Maven project which only shows a simple html page (index.jsp). During the build, a Selenium Server is started with the webapp deployed in the Embedded Jetty. It then runs an Unit Test (Selenium Test) during the Maven integration-test life cycle. Here comes to the code. Continue reading Selenium – Integrate the Selenium Tests into Maven Build→