Win a copy of Spring Boot in Practice this week in the Spring forum!

Prakash Velusamy

Greenhorn
+ Follow
since Oct 03, 2014
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Prakash Velusamy

I am creating an application which accesses Asset's Folder's HTML Page.The HTML File as below,



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="css/index.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h3> A White Header </h3>
<p> This paragraph has a blue font.
The background color of this page is gray because
we changed it with CSS!
</p>
</body>
</html>

and the index.css file is,

body{ background-color: gray;}
p { color: blue; }
h3{ color: white; }

I am reading the HTML file from Android and writing to socket outputstream like,

try {
InputStream localInputStream = this.context.getAssets().open("sendSMS.html");
PrintStream localPrintStream = new PrintStream(this.socket.getOutputStream(), true);
byte[] arrayOfByte = new byte[8192];
localPrintStream.println("HTTP/1.0 200 OK");
localPrintStream.println("Content-Type:text/html;charset=" + "UTF-8");
localPrintStream.println();
if (localInputStream.read(arrayOfByte) != -1)
{
String str = new String(arrayOfByte).trim();
localPrintStream.write(str.getBytes());
localPrintStream.flush();
}
localInputStream.close();
localPrintStream.close();

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
the expected Page output is,


but the received output is,



It seems like Once the response is written the HTML Page couldnt locate the local css file i specified.

So is there anyway i can read the css file specified in HTML Page and write it back to the outpustream?

I think i can do this with reading Page header but i dont know how to implement. Would be very grateful if someone could help me with this.Thanks
7 years ago
Hi All,
I am noob to android development.I need to develop android application which is exactly similar to this https://play.google.com/store/apps/details?id=com.smarterdroid.wififiletransfer&hl=en.I know i have to use Socket Connection as a base to communicate with android to PC.But i am stuck with how to use this Socket Connection to Create Dynamic HTML Page from Android with List of Folders,Files and Send the page to the Browser.Kindly anyone help me with this.Thanks.
7 years ago
i am working on simple desktop based java swing billing application which has to work multiple computers.mysql db should has to be shared with every computers over LAN.

in this case should i use an application server?or is it enough to specify ip address of server system in jdbc connection like

connection = DriverManager .getConnection("jdbc:mysql://ipaddress of server
system(192.168.1.1):3306/dbname","root", "password");

Kindly help me to understand the better method. Thanks in advance.
Greetings to all,
I am learner of Java.I would like to know the possible ways to put up JInternalFrame over JPanel to achieve the following output.
and

Is it even Possible because i learned JInternalFrame can only be added to JDesktopPane.?
7 years ago