What is Spring Boot
Spring Boot is a project that is built on the top of the Spring
Framework.
It provides an easier and faster way to set up, configure, and run
both simple and web-based applications.
It is a Spring module that provides the RAD (Rapid Application
Development) feature to the Spring Framework.
Spring Boot is module of spring from which we speed up the
development .
What is JavaScript
JavaScript (js) is a light-weight object-oriented programming
language which is used by several websites for scripting the
webpages.
It is an interpreted, full-fledged programming language that
enables dynamic interactivity on websites when applied to an
HTML document.
It was introduced in the year 1995 for adding programs to the
webpages in the Netscape Navigator browser.
Features of JavaScript
All popular web browsers support JavaScript as they provide built-
in execution environments.
JavaScript follows the syntax and structure of the C programming
language. Thus, it is a structured programming language.
It is a light-weighted and interpreted language.
It is a case-sensitive language.
Document Object Model
The document object represents the whole html document.
When html document is loaded in the browser, it becomes a document
object.
It is the root element that represents the html document. It has
properties and methods.
By the help of document object, we can add dynamic content to our
web page.
JavaScript Form Validation
It is important to validate the form submitted by the user because it can have
inappropriate values. So, validation is must to authenticate user.
JavaScript provides facility to validate the form on the client-side so data processing
will be faster than server-side validation.
Most of the web developers prefer JavaScript form validation.
JavaScript Form Validation Example
In this example, we are going to validate the name and password. The name
can’t be empty and password can’t be less than 6 characters long.
<script>
function validateform(){
var name=document.myform.name.value;
var password=document.myform.password.value;
if (name==null || name==""){
alert("Name can't be blank");
return false;
}else if(password.length<6){
alert("Password must be at least 6 characters long.");
return false;
}
}
</script>
<body>
<form name="myform" method="post" action="abc.jsp" onsubmit="return valid
ateform()" >
Name: <input type="text" name="name"><br/>
Password: <input type="password" name="password"><br/>
<input type="submit" value="register">
</form>
JavaScript Retype Password Validation
1. <script type="text/javascript">
2. function matchpass(){
3. var firstpassword=document.f1.password.value;
4. var secondpassword=document.f1.password2.value;
5.
6. if(firstpassword==secondpassword){
7. return true;
8. }
9. else{
10. alert("password must be same!");
11. return false;
12. }
13. }
14. </script>
15.
16. <form name="f1" action="register.jsp" onsubmit="return matchpass()">
17. Password:<input type="password" name="password" /><br/>
18. Re-enter Password:<input type="password" name="password2"/><br/>
19. <input type="submit">
20. </form>
javaScript Number Validation
Let's validate the textfield for numeric value only. Here, we are using isNaN()
function.
1. <script>
2. function validate(){
3. var num=document.myform.num.value;
4. if (isNaN(num)){
5. document.getElementById("numloc").innerHTML="Enter Numeric value only";
6. return false;
7. }else{
8. return true;
9. }
10. }
11. </script>
12. <form name="myform" onsubmit="return validate()" >
13. Number: <input type="text" name="num"><span id="numloc"></span><br/>
14. <input type="submit" value="submit">
15. </form>
JSP directives
The jsp directives are messages that tells the web container how to translate a JSP
page into the corresponding servlet.
There are three types of directives:
o page directive
o include directive
o taglib directive
Syntax of JSP Directive
1. <%@ directive attribute="value" %>
JSP page directive
The page directive defines attributes that apply to an entire JSP page.
Syntax of JSP page directive
1. <%@ page attribute="value" %>
Attributes of JSP page directive
o import
o contentType
o extends
o info
o buffer
o language
o isELIgnored
o isThreadSafe
o autoFlush
o session
o pageEncoding
o errorPage
o isErrorPage