File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes How to connect JSP and MS-dos Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to connect JSP and MS-dos" Watch "How to connect JSP and MS-dos" New topic

How to connect JSP and MS-dos

Upendra Bhole

Joined: Dec 05, 2004
Posts: 22
Dear Sir,
I am doing one project in which i have to show the ping characteristics on dos prompt.The request will bring the ip from database which i insert for perticular station and that requested IP address will be automatically executed on the ms-dos prompt.
How can i connect to ms-dos to show that ping command on dos.
I am using jsp and sql.
Please help me.

Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

So you dont want any ladies on this forum to help you with that one!!
Upendra Bhole

Joined: Dec 05, 2004
Posts: 22
Dear Sir/Madam,

Please help me.

Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
MS DOS does not have IP networking support.

Upendra Bhole

Joined: Dec 05, 2004
Posts: 22
Thanks for your reply

Dear Sir/Madam
I am doing one project in which I have to show ping characteristics of ip address on os command through JSP as a front end.

I have inserted some ip address like in table of sql table.
My JSP page will select the perticular ip from database and it should be automatically display on MS-Dos prompt.
If you give ping on you dos prompt it will disply some characteristics that i want to disply through jsp.
Shall I use bean for this.
Suggest me your valuable output.
Also give me source code for this problem.
I will be very happy for your output.

Thanks ,Regards
S. Sundar Raman

Joined: Aug 12, 2004
Posts: 3
Hope this code sample should be useful:

Upendra Bhole

Joined: Dec 05, 2004
Posts: 22
Hi S.Sundar Raman
I am very thankful to you by giving such a valuable output.
The code you have given in that the ip to be ping is hard coded.But actually I want to make it as variable,
See the folloeing code and suggect me in the second jsp what i have to change.

First I made the table name pingip

select * from pingip
atmid name atmip routerip
--------------- ----------------- -------------------- -----------
S1AC0635 abc
S1AN0631 abc1

<H1>Enter The Station ID<H1>
<form action="http://localhost:8100/pingip.jsp">
<table border =1 cellpadding=0>
<TD><H4>ATM ID :</H4><input type="text" name ="a"></TD>

<INPUT TYPE="submit" value="Ping ATMIP" STYLE="COLOR:BLUE" align = centre>


<%@page import="*"%>
<%@page import="java.sql.*"%>
<%@page import="java.lang.*"%>
String aip = request.getParameter("a");

Connection con = DriverManager.getConnection("jdbc dbc:ash","sa","");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select atmip from pingip where atmid='"+aip+"'");
Runtime r = Runtime.getRuntime();
Process p = r.exec("ping ");
InputStream ins =p.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(ins));
String s = br.readLine();
while(s != null)
s = br.readLine();

}//end of try

catch(SQLException eb)
}//end of catch
catch(Exception ea)
}//end of catch



From First jsp I will put in the textbox atm id S1AC0635.Now if i want to ping ip what could be the change in my sencond jsp especially in

Process p = r.exec("ping ");
So that I can ping any ip from database table "pingip"
Please suggest me .

I agree. Here's the link:
subject: How to connect JSP and MS-dos
It's not a secret anymore!