Hello,
I have a Java Swing application that I would like to be able to forward to or to run it - sorry, I am not sure if I am using the right term - from a JSP page. And I would like for my Java application to run in the same browser that my JSP page ran.
My JSP code is like this :
With this code, I can forward to "LoginSuccess.j sp". But
when I tried :
My Java Swing application ran. But it would display outside the original (JSP page) browser. I wonder if there is a way to make my Java application to run inside my original browser, like when I was forwarding to "LoginSuccess.j sp"?
Thank you and Best Regards,
Akino
I have a Java Swing application that I would like to be able to forward to or to run it - sorry, I am not sure if I am using the right term - from a JSP page. And I would like for my Java application to run in the same browser that my JSP page ran.
My JSP code is like this :
Code:
<%@ page language ="java" import="java.sql.*" %>
<html>
<body bgcolor="pink">
<form name="f1" method="post">
<table>
<tr>
<td>User Name</td><td><input type="text" name="t1" ></td>
</tr>
<td>Password</td>
<td><input type=""password"" name="t2"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="b1" value="LogIn"></td>
</tr>
</table>
<%
String user=request.getParameter("t1");
String pass=request.getParameter("t2");
Connection con = null;
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
} catch (ClassNotFoundException cnfe) {
System.out.println("cannot load Driver");
}
try{
con=DriverManager.getConnection("jdbc:jtds:sqlserver://nnn.nn.nn.nnn:50305", "akino", "abc123");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select LName from login where LName = '" + user + "'");
while (rs.next())
{
%>
<hi>login ok</h1>
<jsp:forward page="LoginSuccess.jsp"/>
<%
}
}catch(Exception e1) {}
%>
</form>
</body>
</html>
when I tried :
Code:
<%@ page language ="java" import="java.sql.*" %>
<html>
<body bgcolor="pink">
<form name="f1" method="post">
<table>
<tr>
<td>User Name</td><td><input type="text" name="t1" ></td>
</tr>
<td>Password</td>
<td><input type=""password"" name="t2"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="b1" value="LogIn"></td>
</tr>
</table>
<%
String user=request.getParameter("t1");
String pass=request.getParameter("t2");
Connection con = null;
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
} catch (ClassNotFoundException cnfe) {
System.out.println("cannot load Driver");
}
try{
con=DriverManager.getConnection("jdbc:jtds:sqlserver://nnn.nn.nn.nn:50305", "akino", "abc123");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select LName from login where LName = '" + user + "'");
while (rs.next())
{
Runtime.getRuntime().exec("java -jar /NetBeansProjects/NumberAddition/dist/NumberAddition.jar")
%>
<hi>login ok</h1>
<%
}
}catch(Exception e1) {}
%>
</form>
</body>
</html>
Thank you and Best Regards,
Akino
Comment