on
Italy
- Get link
- X
- Other Apps
def getRequest: HttpRequest = HttpRequest {
method:"GET";
location: "http://localhost:8080/JavaFXHttpDemo/employeeDetails.jsp"; }
onInput: function (ip: InputStream) {
def parser = PullParser {
documentType: PullParser.JSON;
input: ip;
onEvent: function (event: Event) {
if (event.type == PullParser.START_VALUE) {
print("{event.name}\t");
} else if (event.type == PullParser.TEXT) {
println("{event.text}\t");
} else if (event.type == PullParser.INTEGER) {
println("{event.integerValue}\t");
} else if (event.type == PullParser.TRUE) {
println("{event.booleanValue}\t");
} else if (event.type == PullParser.NUMBER) {
println("{event.numberValue}\t");
} else if (event.type == PullParser.END_ARRAY_ELEMENT)
{
println("-------------------------------------");
}
}
};
parser.parse();
parser.input.close();
}
scene: Scene { width: 250 height: 80 content: [ Text { font: Font { size: 16 } x: 10 y: 30 content: "HTTP request demo" } Button { text: "Make a request" translateX:20; translateY:50; action: function () { getRequest.start(); } } ] }
<%@page import="java.sql.DriverManager,java.sql.Connection,java.sql.Statement,java.sql.ResultSet"%>
<%@page import="com.entities.Employee,java.util.List,java.util.ArrayList"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://www.atg.com/taglibs/json" prefix="json"%>
<%
Class.forName("org.apache.derby.jdbc.ClientDriver");
Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/MyDb", "veena", "veena");
Statement s = con.createStatement();
String query = "SELECT EMPNAME, BASELOCATION, EMPROLE FROM VEENA.EMPLOYEES";
ResultSet rs = s.executeQuery(query);
List employees = new ArrayList();
while (rs.next()) {
Employee emp = new Employee(rs.getString("EMPNAME"), rs.getString("EMPROLE"), rs.getString("BASELOCATION"));
employees.add(emp);
//System.out.println("emp "+emp);
}
pageContext.setAttribute("employees", employees);
%>
Now run the JavaFX application and you will see the output as shown below:
Comments
Post a Comment