This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

HTML GUI for java  RSS feed

 
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to display the output in an HTML form instead of displaying in terminal.The following code Compiles and run well.
.
If i run this program,I am getting the output in a terminal.Instead of that I need to display the output in an html form.Is it possible?if yes, please help me to do.The output displayed in the terminal is:


Jan 28, 2008 11:12:58 AM org.asteriskjava.manager.internal.ManagerConnectionImpl connect
INFO: Connecting to localhost:5038
Jan 28, 2008 11:12:58 AM org.asteriskjava.manager.internal.ManagerConnectionImpl setProtocolIdentifier
INFO: Connected via Asterisk Call Manager/1.0
Jan 28, 2008 11:12:58 AM org.asteriskjava.manager.internal.ManagerConnectionImpl doLogin
INFO: Successfully logged in
Jan 28, 2008 11:12:59 AM org.asteriskjava.manager.internal.ManagerConnectionImpl doLogin
INFO: Determined Asterisk version: Asterisk 1.2
Jan 28, 2008 11:12:59 AM org.asteriskjava.live.internal.ChannelManager handleStatusEvent
INFO: Adding new channel SIP/outbound-08dbb658
Jan 28, 2008 11:12:59 AM org.asteriskjava.live.internal.ChannelManager handleStatusEvent
INFO: Adding new channel SIP/5101-08db8628
Jan 28, 2008 11:12:59 AM org.asteriskjava.live.internal.AsteriskServerImpl initializeIfNeeded
INFO: Initializing done
AsteriskChannel[id='1201498975.8',name='SIP/5101-08db8628',callerId='"5101" <5101>',state='RING',account='null',dateOfCreation=Mon Jan 28 11:12:55 IST 2008,dialedChannel=null,dialingChannel=null,linkedChannel=null]
AsteriskChannel[id='1201498975.9',name='SIP/outbound-08dbb658',callerId='<12127773456>',state='DOWN',account='null',dateOfCreation=Mon Jan 28 11:12:59 IST 2008,dialedChannel=null,dialingChannel=null,linkedChannel=null]
Jan 28, 2008 11:13:05 AM org.asteriskjava.live.internal.ChannelManager handleLinkEvent
INFO: Linking channels SIP/5101-08db8628 and SIP/outbound-08dbb658
Jan 28, 2008 11:13:11 AM org.asteriskjava.live.internal.ChannelManager handleUnlinkEvent
INFO: Unlinking channels SIP/5101-08db8628 and SIP/outbound-08dbb658
Jan 28, 2008 11:13:11 AM org.asteriskjava.live.internal.ChannelManager handleHangupEvent
INFO: Removing channel SIP/outbound-08dbb658 due to hangup (NORMAL)
Jan 28, 2008 11:13:11 AM org.asteriskjava.live.internal.ChannelManager handleHangupEvent
INFO: Removing channel SIP/5101-08db8628 due to hangup (NORMAL)

.
Thanks.
 
Rancher
Posts: 43009
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. Aside from various other reasons, this output gets appended to line by line - HTML doesn't work that way (it's page-oriented, not line-oriented).

You could capture the output in a text file (read up on how to configure the log4j package for that), and then create a JSP page that includes the file in a CODE or PRE block.
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply.please guide me how to capture the output in a text file.What i understood from your words is I have to write a separate java program to read the output from the terminal and write it to a text file.Is it so?
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you were looking to have an interactive GUI, you could deploy it within a Servlet, since I am familiar with Apache Tomcat, the following might be a good starting point:

http://blogs.reucon.com/asterisk-java/2007/12/06/integrating_agi_and_apache_tomcat.html

[ January 28, 2008: Message edited by: Darren Hamilton ]
[ January 28, 2008: Message edited by: Darren Hamilton ]
 
Ulf Dittmer
Rancher
Posts: 43009
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

What i understood from your words is I have to write a separate java program to read the output from the terminal and write it to a text file.Is it so?


No. You'll have to understand how the log4 logging package is configured, and create a configuration file for it. An introduction can be found here.

That server software you're using most likely already has a config file; look through its jar files and installation directories to see if that is so. Its documentation might also talk about it. If there is an existing one, it becomes much easier to adapt it for your purposes.

I'll move this to the Other Open Source Projects forum where log4j is discussed.
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Darren,
I have tried what you have told.But i need to display the output in the html file immediately after running the program.i should not do it manually by clicking the output.html file.

ulf,
I have tried another method like this:
without using jsp or servlet or tomcat,i have done like this.
i have called the class file of the java file in html page like this


<html>
<head>
<title>HelloLive</title>
<script LANGUAGE="JavaScript">
document.write("<APPLET CODE='JHelloLive.class' HEIGHT=575 WIDTH=650>");
</Script>
</head>
</html>


and put this html file and the java class file in a folder named Hello and put it into the directory /var/lib/www/html/.After that i access the page in browser like this


http://localhost/Hello/form.html


But it is displaying blank page with blank applet with the mentioned height and width.Is this way correct?
 
Ulf Dittmer
Rancher
Posts: 43009
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not following. What is JHelloLive, and what does it have to do with the above problem?

Plus, why do you think it's better to try these convoluted approaches instead of simply configuring log4j to write to a file (which can then be used any way you want)?
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Sorry for the delayed reply.
ulf,
If i use log4j,whether I can design a gui like this?


UserName CallerId Status Outbound
5101 1212777 up SIP/outbound-092826
5102 78456 Ring SIP/5101-092546b8


Here the username is hardcoded one.if extension 5101 made any calls ,i have to get the details above and have to display those like this.Then without using any server like tomcat,cant i do this?

Thanks.
[ January 30, 2008: Message edited by: preethi Ayyappan ]
 
Ulf Dittmer
Rancher
Posts: 43009
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what you mean by "GUI" - log4j creates text only, generally captured in files. It can output any text you like, but that would be a code change in the application, not a configuration change applied externally. You really should read the log4j Manual to learn what it can do, and how it does it.
 
preethi Ayyappan
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok.Thank you.I will read it clearly
 
Listen. That's my theme music. That's how I know I'm a super hero. That, and this tiny ad told me:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!