Java Project
Java Project
This is the currency converter or it is also called as currency exchange. This project is
basically a web-based interface which helps person to change their money from one state to
another state or we can say that it helps in exchanged the money from their original state.
Abstract -We all know that every country uses different currency system, so when person is
travel from one place to another or when person transfer the money from one country to another
country then everyone needs to convert their currency, by keeping this thought in the mind, I
develop the currency convertor or currency exchange system in java programming language.
It is simple calculator like application. This application is so convenient that’s why anybody
can use it. Most probably this application is used in share market, Business strategy and many
more. The currency convertor has a simple interface in which user can enter the amount and
choose the changes by dropdown list.
Purpose:
Currently we are needed to recognize the amount of the currency and to convert it manually.
This is stressful especially to people who aren’t so smart in calculations. So, this project is
developed to replace human power to recognize the amount of the currency.
Scope:
Many business people use this tool in the import/export business to determine the selling and
buying profits of various products. With an online converter, a trader can identify the
difference in making or losing money. All kinds and types of businesses can use online
currency converters for quick and effective results. As a trader, you can use a converter to get
a good estimate of what your foreign trip would cost while traveling abroad.
Introduction to Java
• Java is Object oriented, Multi-threading language developed by Sun Microsystems in
1991.
• It is designed to be small, simple and portable across different platforms as well as OS.
Features of Java:
Syntax based on C++
• Object-oriented
Java Programs:
• Applets:
• Downloaded with the Web page and launched by the Internet browser
• Servlets :
• Applications:
• Programs that run standalone on a client
Java Servlets:
• Servlets are server side applets that are loaded and executed by a web server in the same
manner that applets are loaded and executed by a web browser.
• Java Servlets are useful to create Dynamic pages. Depending upon my input server will
give an output
Features of Servlets:
• Database Connectivity
o Insert/Update/delete/drop
o Select
• Servlets Chaining
• Inter-servlet Communication
• Page Compilation
• Session Tracking
JSP:
Introduction:
• As a Java-based technology, it enjoys all of the advantages that the java language
provides with respect to development and deployment.
• The web server receives the request and sends it to the Servlets/JSP engine. If the
Servlets/JSP is not loaded, the web server will load it into the JVM and execute it.
JSP Directives: They generate side effects that are change the way the JSP container
processes the page.
Implicit Objects:
• Request
• Response
• Session
• Application
• Page Context
• Exception
JSP Actions: The JSP actions allow the transfer of control between pages.
• Forward
• Include
• Plug-in
Code :
https://github.com/Arya-
Wadhwani07/CurrencyConverter/tree/master/Currency%20Con
verter/nbproject
convert.java
package com.exchange;
import java.io.*;
import java.net.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.InputStream;
import java.net.*;
import com.google.gson.*;
/**
*
* @author pakallis
*/
class Recv
{
private String lhs;
private String rhs;
private String error;
private String icc;
public Recv()
{
}
public String getLhs()
{
return lhs;
}
public String getRhs()
{
return rhs;
}
}
public class Convert extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and
<code>POST</code> methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest req,
HttpServletResponse resp)
throws ServletException, IOException {
String query = "";
String amount = "";
String curTo = "";
String curFrom = "";
String submit = "";
String res = "";
HttpSession session;
resp.setContentType("text/html;charset=UTF-8");
PrintWriter out = resp.getWriter();
} catch (NumberFormatException e) {
out.println("The given amount is not a valid number");
}
/**
* Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
package com.exchange;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
}
}
doc = objDocumentBuilder.parse(stream);
}
catch(Exception ex)
{
throw ex;
}
return doc;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/web-project/3">
<name>CurrencyExchangeV3</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<web-module-libraries>
<library dirs="200">
<file>${file.reference.gson-2.0_1.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
</web-module-libraries>
<web-module-additional-libraries/>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>
SNAPSHOTS: