Browsed by
Category: J2EE

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

635 total views, no 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,421 total views, no 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

541 total views, no views today

Installing Maven in eclipse

Installing Maven in eclipse

Installing Maven in eclipse: Maven can be installed in eclipse by two ways, 1. Through eclipse marketplace [Help -> Eclipse Marketplace] Search M2E or Maven Integration for Eclipse    M2E – Maven Integration for Eclipse then install this package. 2. Install New Software [Help ->  Install New software] Enter the below URL and select all then click next and finish to install the maven in eclipse. http://download.eclipse.org/technology/m2e/releases   If you are using eclipse juno/helios/indigo you should install the maven in…

Read More Read More

678 total views, no views today

JSON in Servlet with Ajax call

JSON in Servlet with Ajax call

JSON in Servlet with Ajax call: JSON is a amazing alternate for XML to pass/transfer the informations. It is required to know how to handle JSON in servlet. In servlet it can be handled like this, request.setCharacterEncoding("utf8"); response.setContentType("application/json"); // json is the JSON object. response.getWriter().print(json); But if you want to call your servlet through ajax, then we should handle the JSON response in JS also to display JSON in jsp page, else only object object will be printed in JSP…

Read More Read More

844 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

520 total views, no views today

spring mvc hello world example step by step

spring mvc hello world example step by step

Spring hello world…!!! Step 1:  Create a dynamic web project named “JavadomainSpringMVC”. Step 2: Download and add the below mentioned spring jar files to lib folder which is in WebContent/WEB-INF/lib. Required Spring jar files: 1. commons-logging-1.0.4 2. jstl-1.2 3. org.springframework.asm-3.1.0.RELEASE 4. org.springframework.beans-3.1.0.RELEASE 5. org.springframework.context-3.1.0.RELEASE 6. org.springframework.core-3.1.0.RELEASE 7. org.springframework.expression-3.1.0.RELEASE 8. org.springframework.web.servlet-3.1.0.RELEASE 9. org.springframework.web-3.1.0.RELEASE 10. spring-web-3.2.1.RELEASE Download all jar files Step 2: Create a package named “in.javadomain.spring.controller” under src. Step 3: Create a java class (here controller) named “BlogAuthorController” and paste the below…

Read More Read More

749 total views, no views today

Jelastic to host your java web application for free

Jelastic to host your java web application for free

Is it ? Yes Now you can host your java website with database connection for free. Who all are providing java web application host for free ? Many sites providing us to host the free java web application, But rightnow I checked only http://jelastic.com/ Jelastic free java web application steps: 1. You have to create the free account in jelastic.com 2. Login with the created account and credentials. 3. After login you will be able to see the option called “Create…

Read More Read More

864 total views, 1 views today

Session Validation in Ajax

Session Validation in Ajax

Session validation in servlet: Usually if it is a servlet we can simply check if(session != null ){ // Business code }else{ // Redirection code }   Session validation in ajax: If you call the servlet from ajax then the above steps won’t work, since ajax gets everything as response, so the code which you have written in the else block (Redirection code) will also be sent as response, so expected redirection will not happen. So what can we do…

Read More Read More

522 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,882 total views, no views today