Here we will see the example on transforming XML to HTML using XSLT. We can also use Java code to transform XML to HTML but that would require a many LoC to finish the job but using XSLT it is quite easy to transform. XSLT stands for XSL Transformations. The Extensible Stylesheet Language (XSL) is a family of recommendations and styling language for defining XML document transformation and presentation. It consists of three parts:
XSL Transformations (XSLT) : a language for transforming XML;
The XML Path Language (XPath) : an expression language used by XSLT (and many other languages) to access or refer to parts of an XML document;
XSL Formatting Objects (XSL-FO) : an XML vocabulary for specifying formatting semantics.
Continue reading “Transforming XML to HTML using XSLT”
This tutorial will show you how to solve HackerRank Valid Username Checker using Kotlin. In different web applications we define certain rules for choosing the username, such as, it should consists of maximum 30 characters; it should not have any special character; it may contain one or more digits; it must starts with a letter, etc. So here also we have some certain rules for choosing the username and we will check valid username regular expression in Kotlin language.
Please read here how to create Kotlin project in Eclipse.
Continue reading “HackerRank Solution: Valid Username Regular Expression using Kotlin”
This tutorial will shoe you how to solve HackerRank Tag Content Extractor. In a tag-based language like XML or HTML, contents are enclosed between a start tag and an end tag like
<tag>contents</tag>. Note that the corresponding end tag starts with a
Given a string of text in a tag-based language, parse this text and retrieve the contents enclosed within sequences of well-organized tags meeting the following criterion:
The name of the start and end tags must be same. The HTML code
<h1>Hello World</h2> is not valid, because the text starts with an h1 tag and ends with a non-matching h2 tag.
Tags can be nested, but content between nested tags is considered not valid. For example, in
<h1><a>contents</a>invalid</h1>, contents is valid but invalid is not valid.
Continue reading “HackerRank Solution: Tag Content Extractor using Kotlin”
This example will show you how to do a SOAP web service call from Java class. Normally you would use the web service library for invoking the SOAP service but in some cases this could be useful and quick. For example, you may have problems generating a client proxy with a web service library or if you only need some small specific parts of the response. It is just a SOAP call over HTTP, from a plain piece of Java code without using any Java library. In fact you can invoke SOAP service from any language being web service platform independent.
Now in order to consume the service or SOAP web service call from Java class, we must have the service deployed somewhere. So please read Spring SOAP WebService Producers using Gradle before consuming this SOAP service. We will create here client which will consume the service in the given link. If you want to use library to consume the service then you can read Spring SOAP WebService Consumers using Gradle
Continue reading “How to do a SOAP Web Service call from Java class”
This tutorial will show you how to solve HackerRank Subarray using Kotlin.
A subarray of an n-element array is an array composed from a contiguous block of the original array’s elements. For example, if array=[1,2,3], then the subarrays are , , , [1,2], [2,3], and [1,2,3]. Something like [1,3] would not be a subarray as it’s not a contiguous subsection of the original array.
Please go through first how to create Kotlin project in Eclipse
Continue reading “HackerRank Solution: Subarray using Kotlin”
In this tutorial I will show you how to create Kotlin project in Eclipse. This example shows you how to create Kotlin gradle project or Kotlin maven project.
Kotlin is statically typed programming language for modern multiplatform applications. Kotlin has 100% compatibility with Java or vice-versa.
Salient Features of Kotlin
Drastically reduces the amount of boilerplate code.
Avoids entire classes of errors such as null pointer exception.
Leverages existing libraries for the JVM, Android and the browser.
Choose any Java IDE or build from the command line.
Continue reading “Creating Kotlin Project in Eclipse”
JNDI data source is very similar to JDBC data source. The JNDI data source accesses a database connection that is pre-defined and configured in the application server and published as a JNDI resource or service. Instead of specifying a driver and database as we do with JDBC data sources, we only need to specify the JNDI resource name in our application server.
Why do we use JNDI DataSource
JNDI comes in rescue when you have to move an application between environments: development -> integration -> test -> production. If you configure each application server to use the same JNDI name, you can have different databases in each environment but you need not to change your code. You just need to drop the deployable WAR file in the new environment.
You may also like to read Spring Data JPA CRUD Example and Spring Data JPA Entity Graphs
Continue reading “Configure JNDI DataSource with Spring Boot”
Autocomplete allows you to easily create autocomplete and auto-suggest boxes for text input fields. When you start a search on Google, you can find the information you are looking for using search predictions. Search predictions are possible search terms you can use that are related to the terms you are typing and what other people are searching for. Spring Boot MVC autocomplete example will show you exactly the same thing here.
Autocomplete is a feature in which an application predicts the rest of a word a user is typing. In graphical user interfaces, users can typically press the tab key to accept a suggestion or the down arrow key to accept one of several.
Autocomplete speeds up human-computer interactions when it correctly predicts the word a user intends to enter after only a few characters have been typed into a text input field. The autocomplete is a normal text input enhanced by a panel of suggested options. Continue reading “Spring Boot MVC AutoComplete using jQuery”
We have seen a popular choice for sending real time data from server to client in web application is using WebSocket in our previous tutorials Messaging with STOMP over WebSockets using Spring and ActiveMQ and Spring Boot WebSocket AngularJS Gradle Example. WebSocket opens bidirectional connections between server and client. So both server and client can send messages. But sometimes we face situations, where the application needs only one way communication, i.e., sending data from server to the client and for this Spring provides a simpler solution using Server Sent Events (SSE). SSE is a technology that allows you to stream data from server to the browser (Push Notifications) within one HTTP connection in one direction. For example, pushing stock price changes in real-time or showing progress of long-running process or real time showing of cricket or football scores on display board etc.
SSE are supported in most modern browsers. Only Microsoft’s IE and Edge browsers do not have a built in implementation. But there is a way out because Server-Sent Events uses common HTTP connections and can therefore be implemented with the following libraries to support IE and Edge browsers.
Continue reading “Server Sent Events with Spring – Push Notifications”
Sometimes we need to check username availability instantly before a user presses the submit button after filling a long-sized signup form. In this case we can use AJAX with any technologies like PHP, Codeigniter, Servlet, Struts, JSF, Spring etc. for checking whether the input username is avaialable or already occupied by someone else. So if we give instant result to the user for username availability then sometimes it makes more sensible than while pressing the submit button and goes top of the signup form to rectify the username input field if input username is not available.
This tutorial shows how to check username availability using Servlet, AJAX and MySQL. So after finishing this example you will be able to apply the same logic to any Servlet based web framework or any server side technologies such as PHP, Codeigniter etc. Continue reading “Username availability check using Servlet, AJAX and MySQL”