Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Getting current url in jQuery

Sometimes we need to identify which is the current URL of JSP page to perform some functionality. We can do this very easily by adding the below line in you on load function:   $(function(){ var url = window.location.href; ...

Error: javax.servlet.jsp.PageContext cannot be resolved to a type

Running a Maven web project in eclipse was giving errors on jsp pages: javax.servlet.jsp.PageContext cannot be resolved to a type javax.servlet.jsp.JspException cannot be resolved to a type The server was running fine, even the project w...

What are different types of scripting elements in jsp

JSP supports various programming language codes. With the help of scripting elements, you can write java code inside the jsp page. There are three types of scripting elements which are really useful for inserting java code. scriplet tag ...

How to open another page with button click in jQuery?

Sometimes we need to open another page on button click. We can do this in tow ways either by using "window.location" or "window.open()". Example: In the below example I have put conditions on "blur" event for checking whether the input fiel...

How to implement select event of Autocomplete feature in jsp?

Sometimes we need do functionality when we select any item from the suggestions that display by autocomplte feature. Example: In the below example I'm using autocomplete() function to get suggestions with the provided keyword. As below by impl...

How to implement autocomplete feature with AJAX in jsp?

Sometimes wee need to call an API or action to get matching list with the provide keyword in Search box, for this we usually implemente autocomplete feature to input field for searching purpose by doing AJAX call. Example: In the below example...

How to apply autocomplete feature to textbox with jQuery?

Sometimes we need to implement autocomplete feature to input field for searching purpose. We can do this by using "autocomplete()" with jQuery. Example: In the below example I have created an array of country names and passed that as source to...

How to implement validation for empty input field with jQuery?

Whenever we create a form, we always have a requirement to put validation for empty fields on some input fields. We usually implement this functionality by putting checks on "blur" and onFocus events of the input field. Example: In the below e...

How to implemente confirm password functionality with jQuery?

At the time of registration or change password we need to provide password, so for this we usually implement Confirm password functionality. Example: In the below example I want to confirm password on form submit, so for this I have created a ...

How to select option of drop down with Jquery?

Sometimes we need select option of a drop-down dynamically by clicking on a button or on some other action. We can do this by using "selected" property. Example- In the below example I have a drop-down for distance and I want to select option ...

How to appned li elements to ul dynamically with jQuery?

Sometimes we need to add li elements to ul dynamically based on some list. We can do this by using append() method. Example- In the below example I have a list "users" and I want to display user names dynamically on page. <html> ...

How to show div after some time period with jQuery?

Sometimes we need to display some alert or dive after some period on Web page. We can do this by using setTimeout method as below: <html> <head> <title>Demo to show div</title> <script type="...

How to hide a message after some time interval with jQuery?

Whenever we submit a form or do some task, we usually display a success message, but sometimes it is required to hide this message automatically after some time period. We can do this by two ways: By using setTimeout method: ...

How to add/remove class to an element on keyup event with jQuery?

We can add or remove a class to an element very easily by using addClass() and removeClass() methods. To do this on keyup event of a textbox we just need call these functions when we bind keyup event to textbox. Example: <input id="sear...

How to enable/disable a button with jQuery?

Sometimes we need to enable/disable a button based on some condition. We can do this easily by using "disable" attribute of a button. Example: <button type="button" id="voteButton">vote</button> To disable a button write t...

How to refresh a function after a particular time in jsp?

To refresh a function after a particular time interval to refresh the values on the page. We can do this by using setInterval() function on page load. Write the below code where refresh() function will be the function that you want to refresh...

How to resolve problems with Request parameters encoding?

When we type any Accented char(not all) in input field and try to submit it gets encoded to some other chars automatically. To resolve this we need to enable CharacterEncoding. Follow the below steps in order to resolve problems with Request ...

How to put if/else condition in JSTL?

Sometimes we need to show HTML based on some conditions, so for this we use JSTl in JSP file. Example: In the below code I'm changinf heading based on condition. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <h...

How to apply conditional operators in JSTL?

In JSP file sometimes we need to put conditional operators through JSTL. Example: In the below example I am applying && and || operators. <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <html> <head&g...

How to find the size of a file while uploading in JSP?

Sometimes we need to find the size of a file at the time of uploading to prevent the file that is greater than a particular size. We can achieve this by handling "change" event of a input-file. Examlpe: Suppose I want to upload a file less tha...

How to find the extension of a file to be uploaded in JSP?

Sometimes we need to find the extension (file-type) of a file at the time of uploading to apply some validation on it. We can do this by handling "change" event of input-file. Example: In the below example I want to upload the file having exte...

How to display location on Google Map in JSP in JAVA?

Sometimes we need to display Google Map on a JSP page, for this you just need pass lat/long to JSP. Use below code to initialize map in script: var marker = null; var map = null; var markers = []; function initial...
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: