Browsed by
Tag: jsp

JSP Servlet with AJAX Example

JSP Servlet with AJAX Example

JSP Servlet with AJAX Example Ajax is a great feature implemented almost in all the websites in some way. It gives really a very good user interface, since things are loading/populating without refresh. It is commonly used in username availability checking, register/login page db level/business level validations etc. We are going to use Ajax with JSP and servlet to calculate the EMI payable amount by giving amount, month and interest rate in single screen(without refreshing). Requirements: 1. Include jQuery library…

Read More Read More

661 total views, 1 views today

EMI Calculator using JSP, Servlet and Bootstrap

EMI Calculator using JSP, Servlet and Bootstrap

EMI Calculator using JSP, Servlet and Bootstrap: Designing a responsive website reduces the startups to invest separately on android and ios apps. Here we are writting a very simple web application for emi calculator using JSP, Servlet and bootstrap. We used bootstrap in this to integrate responsiveness with JSP pages.     Requirement: Download bootstrap CSS and JS files from here. Include the bootstrap css and JS files in the head section, <head> <meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″> <title>EMI Calculator</title> <link…

Read More Read More

1,462 total views, 2 views today

Pass values from one jsp to another jsp file

Pass values from one jsp to another jsp file

Pass values from one jsp to another jsp file: Form values from one jsp can be sent to another jsp file with action parameter in form and getParameter method in the second jsp file. Things to remember: Mention the jsp2.jsp file in the form action of jsp1.jsp file. In jsp2.jsp file use getParameter() method and pass the name of the form element inside to get the value whichever is passed from jsp1.jsp file.     jsp1.jsp file: <%@ page language=”java”…

Read More Read More

606 total views, no views today

clicked value passing from one jsp to another jsp

clicked value passing from one jsp to another jsp

Create the first jsp named main.jsp and paste the below code,   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <html> <head> <title>agn</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <meta name="GENERATOR" content="Rational Application Developer"> </head> <body> <!–<iframe src="http://www.w3schools.com"> <p>Your browser does not support iframes.</p> </iframe> –> <a href="/ToCapitalLetter?a=javadomain">click me</a> </body> </html> Create a servlet named ToCapitalLetter.java and paste the below code, import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * Servlet implementation…

Read More Read More

543 total views, 3 views today

Dynamically Add and Remove value to dropdown Javascript Example Program

Dynamically Add and Remove value to dropdown Javascript Example Program

Dynamically add & remove values to dropdownlist in javascript: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>My Jsp</title> </head> <body> <br> <br> Javadomain.in – Dropdown dynamic Values Add and Remove <br> <br> <script type="text/javascript"> function addMe() { var textValue = document.getElementById("txtId").value; var ddlstSize = document.getElementById("ddlstId").length; document.getElementById("ddlstId").options[ddlstSize] = new Option( textValue, textValue); //document.getElementById("ddlist").add(new Option(val,val)); alert(textValue + " is Added successfully"); } function removeMe() { var ddlstValue = document.getElementById("ddlstId");…

Read More Read More

971 total views, no views today

Passing clicked value from jsp to jsp/servlet

Passing clicked value from jsp to jsp/servlet

Passing value from jsp to jsp/servlet: We can pass the value from jsp to servlet using, request.getParameter(“text”); //servlet code to get the jsp value where text is the name of the input fields (text field). Passing clicked value from jsp to jsp/servlet: We have to pass the clicked value as get parameter in the href link like below, <a href=”/Myservlet?input=javadomain”> MyServlet is the name of the servlet. Servlet code: request.getParameter(“input”); So javadomain will be passed from jsp to servlet. In…

Read More Read More

1,924 total views, no views today

Arabic language in jsp example

Arabic language in jsp example

Arabic in jsp: Encoding should be changed: We need to change the pageEncoding and charset to utf-8 inorder to get the arabic output. If we leave pageEncoding and charset to “ISO-8859-1” then it will not allow to save the arabic content in the jsp page. If we save by force then it will changed to “??????????” like this. So we must change the encoding and charset to “utf-8” to get the arabic output. Should use dir attribute (rtl – right…

Read More Read More

465 total views, no views today

javascript onclick jsp value passing to servlet

javascript onclick jsp value passing to servlet

Program: MyJsp.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Javadomain.in</title> </head> <script type="text/javascript"> function document123() { var append_input = document.getElementById("txt").value; document.location.href="/My_Workouts/MyServlet?nav=’"+append_input+"’"; // My_Workouts is the project name. } </script> <body> <label>Enter the text to pass Servlet </label> <input type="text" id="txt" ></input> <button type="button" onclick="document123()">Go to Servlet!</button></div> </body> </html> MyServlet.java import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(&quot;/MyServlet&quot;) public class MyServlet extends HttpServlet…

Read More Read More

1,159 total views, 1 views today

Javascript onclick Jsp call

Javascript onclick Jsp call

Program: Input.jsp   <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Javadomain.in</title> </head> <body> <button type="button" onClick="JavaScript:window.location=’MyJsp.jsp’">Click to call MyJsp Page!</button> </body> </html>   MyJsp.jsp   <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Javadomain.in</title> </head> <body> success…………!!! </body> </html>   Output: Thanks for reading this post………….!!! 601 total views, no views today

601 total views, no views today

hyperlink value passing from one jsp to another jsp

hyperlink value passing from one jsp to another jsp

Program: Input.jsp   <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Javadomain.in</title> </head> <body> <a href="http://localhost:17433/My_Workouts/output.jsp?q=Javadomain+Welcomes+you">Click</a> </body> </html>   Output.jsp:   <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Javadomain.in</title> </head> <body> <%String input = request.getParameter("q"); out.println(input);%> </body> </html>   Output: 579 total views, no views today

579 total views, no views today