Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

Java Applet

  Asked By: Joao    Date: Oct 10    Category: Asp.net    Views: 2325

I have a web project in vb.net, once my page is loaded I want it to have a display area, displaying some text, which is being read from a database, I want to update this text area only without reloading the page? Do I need some java applet or what?



22 Answers Found

Answer #1    Answered By: Monique Perry     Answered On: Oct 10

You can do that with web  services.
Search for the webservice behavior. This is a microsoft client side behavior (.htc file) which works on IE4+ only. You can call your webmethods from this component. It's very easy

some relevant links

And here is exactly what you want to implement

Answer #2    Answered By: Roosevelt Jenkins     Answered On: Oct 10

is that the one that the client side web  service calculator is based on ????

have you though of using an IFrame ? It still involves a refresh but only the "hole" in the page  (the IFrame) will refresh. It's easy.

Something like

<IFrame name=if id=if width=200 height=200 src="http://www.me.com"></Iframe>

Then you have href like

New Page

Answer #3    Answered By: Rosie Hughes     Answered On: Oct 10

I don't know any web  service calculator... but if it is callled like that and it doesn't refresh the page  I bet that it's the ws behavior.

Answer #4    Answered By: Freya Brown     Answered On: Oct 10

Thanks to both of you for continuing discussing my problems and exchanging my view, let me tell u a little more about what I want with an example, there is a website one opens that is displaying  the score for a running match. The page  does not reloads but the score board is updated through some java  applet reading values from some databse I suppose, something similar I want to do too.

Answer #5    Answered By: Dep Tran     Answered On: Oct 10

it's perfectable doable with the ws behavior... you don't need a java  applet (unless you need it to work cross-browser). The problem is that it'll take much more work than the approach I'm telling you

Did you have the chance to look at the links I sent you?

Answer #6    Answered By: Cesara Fernandez     Answered On: Oct 10

Yes I did, but before I open that I am thinking to read  the webservice chapter again from the book as I do know about it but didn't implemet it any where so better refresh it a bit.

Answer #7    Answered By: Daimon Jones     Answered On: Oct 10

If you are determined to use an applet  then why use java  ????

recently Microsft have lost to Sun and now HAVE to supply Suns VM on Windows forever ! (a wrong decision by the courts I must add [my opinion])

But - with programs being written all the time in VB.NET then it won't be long before the .NET CLR is installed on every windows machine - I am suprised that it was not included in XP - which I thought it would be. future Windows will all have it built in.

Just make what you want using a .NET Embedded Control.

Basically, any Windows Form you create (nothing to do with asp.NET - WINDOWS FORM) can be changed into a control and embedded in a web  page.
(Example at FrameworkSDK\Samples\QuickStart\winforms\samples\iesourcing)

Notes to worry about :: if you do write a simple windows form to get data from your server then you will have to supply the connection string within that form - and .NET code can be disassembled (as can java). So - to make things safe you would need to do make a web service. This runs on your server and acts as go between between your database  and your embedded control. More work but thats life. Strings are easy to spot inside IL code so you could try and disguise your connection string by generating it from ascii chars and obfuscating it - but it will still be in there for the determined. I would like to try to find a string disguised like that - but some may.

There may be a way round that I haven't fully looked into yet.
C++ gives you the ability to make an unmanaged function call within a managed assembly. And that function cannot be disassembled - so you could potentially save your self the effort of a web service. But - all you'de need to do would be to call that function to retrieve the password (unless you could put stipulations on who the function outputs too) - so it may be a waste of time. Personally - I'd do a web service.

At this point is it relevant whether the form is updated from the server side or the client side ?? both will take time and both ARE making posts to the server because ultimately - it has to connect to the server to get the data.

Use the IFrame unless your a .net guru with lots of free time and money to burn.

Answer #8    Answered By: Aabirah Khan     Answered On: Oct 10

a new but very interesting thing, I will work in this direction, thanks allot.

Answer #9    Answered By: Utsav Shah     Answered On: Oct 10

it seems like Stephen and I are trying to sell you its own solution ;)
I like the Embedded Control solution very much... indeed I was working with that and it's very very powerful
It's far more difficult to implement than the webservice behavior... If you have VS.Net you cerate an WebService app with one webmethod

public void UpdateData(string data)
// connection to db
// update

in the client side you just have to copy paste someone's code to get the base line. Then you change the url to point the ws (.asmx) and voila!

anyway, if you need to do it fast go for the webservice behavior

Answer #10    Answered By: Ziza Mizrachi     Answered On: Oct 10

As webservice method I already started working on, I am going to try to develop my project  in it, but this Embedded control idea is something which I once when the .Net was not in picture and today Stephen's reply just sparked all that again, and if I may learn and be able to implement it, I think I will be able to use it in many projects.

Both of you, thanks allot but this is not all for this mail thread, I am sure I wil be in touch untill I have written you where did I finish on both sides,

Answer #11    Answered By: Fairuzah Alam     Answered On: Oct 10

I'm gonna adda bit

http://www.developa.com/popgrowthtimed.htm was in the BetaResource kit - I simply changed it to a control.

Note also that you'll have to change them to context menu's for a control

also note that exactly the same code is used in the below link (though here they are seperate assemblies) .... indeed you can embedd an .exe in the web  page ( I didn't realise that at the time)
Turn off download managers to try the following

As you can see -if you get the hang of the gdi you can do some good stuff - perhaps the popgrowthtimed could be altered to display  a time dependant running set of points pulled from your database  ?

The latter one here actually paints a bitmap to the gdi .... it could be created using data from a database - creating a chart.

You could also not actually display the results immediately, just make a button saying "view results" and when clicked a windows form opens up displaying  them all.

I don't know if you ever seen a java  applet that, on the click of a button, releases itself from its container page  - I'm gonna have a go at doing that one day soon.

But remember - if your going to access a SQLServer then really you cannot get away from the connection string problem. I would write a web service into it to retrieve the data before displaying, and up date on the click of a button.
The above are different because they generate their own points from inside the code.

Ummm ... what else ??? Ummm.... Oh, you can do stuff like access client side word to display a document ... but anything that is accesses client side breaks security and you have to get permissions ( beit from a downloaded msi file or simply manually set in using mscorcfg.msc ) but that's no good for the public really.

Also note that if you plan what you are doing you can reuse all of the components and make a client side app to boot.

Hope it helps.

I luv them, too. Am trying to learn more gdi so I can do more with them (I used to love all those spinning/twisting flashy applets)

With these things though, if you request another page with the same control on it it still has to download that control again ( I believe) - with java applets, because they are in the browser cache, they are picked up from there. Appets were cool cos you could use them as a data/image store - download a full one to the cache and retrieve everything from there ( that was my plan - I never did get round to actually doing that one). With these things you can't ( I don't think).

Tell me if you find out.

I still have some old Maths stuff I want to do using this stuff - i.e. the old 3d point viewer with textures when I can get round to it (soon)

Hope it's enlightening and sustains you through some hard work you now have to do.

Email me if you want any of the code above, I'm sure its here somewhere (40GB is hard to keep track of)

Answer #12    Answered By: Gerardo Morgan     Answered On: Oct 10

You'd probably use DIME, but client machines need .NET Framwork instaklled. Using JavaScript U can call Web Service to do the job... Or make a ActiveX object for clients that'll do the job.

But considering Netscape I don't know how DIME works in Netscape. ActiveX is a NO-GO.

Answer #13    Answered By: Kawakib Mansour     Answered On: Oct 10

WHen I clicked links below, I see the box where the control is to be displayed, but the control is not displayed, something wrong at my end?

2ndly I opened VS and started a new projecr as windows web  control project, and placed a label and a command button that on click displays hello world in it, compiled project  got the dll and .pdb file, please can u tell me how to insert it in a vb.net web project, I included the dll in in referrence but donno how to have it in aspx page, any help or any tutorial on it?

Answer #14    Answered By: Julia Hughes     Answered On: Oct 10

sorry a correction that the project  I opened was windows control library not as windows web  control, rest remains same, any idea hoe can I insert the control?

Answer #15    Answered By: Scarlett Hughes     Answered On: Oct 10

> I would write a web  service into it to retrieve the data ..
Why not simply add a new user to your database  with very strict access, and use that in your connection string?

Answer #16    Answered By: Marina Smith     Answered On: Oct 10

t does work ... it just takes a while to download.

Hang on Usman ... a windows web  control project  ??? whats that Us ??

Right .... open VS and make a new Windows Form. Then change the Form to a UserControl ( best to use a USerControl because you can use Designer). Get rid of AutoscaleBaseSize and anything else that stops it compiling. Menus will need to be changed to ocontext menus.
Get rid of main ( not necessary as you can run these things from an .exe)

Then make a Virtual Directory somewhere with a bin directory. MAKE SURE virt dir is set to SciptsOnly !

Then the tag is something like
<object id="simpleControl1"
classid=TimedPopGrowth.DLL#Steve.PopGrowthTimed height="370" width="650" >

Answer #17    Answered By: Verner Fischer     Answered On: Oct 10

Web Service Problem:

I refreshed myself about basic od web  services by reading a chapter from book and here is what I did to atleast take a start.
I created a file with name "webservicetest2.asmx"
then in it I had a function like
<WebMethod()> Public Function Add(ByVal a As Decimal, ByVal b As Decimal) As Decimal

Label1.Text = a + b

Return (a + b)

End Function

then I added a "web referrence" for this service.

Later in one aspx page  to test it I inserted a lable and a command button and on the command button click I had

Dim ws As New localhost.webservicetest2()

Label1.Text = ws.Add(10, 5)

I got the result right, now please correct me about my understanding of webservice:
I will add another web method in which will not recieve any parameters, in it open a connection, read  the values and return them all?(how)

ok another thing that when I tested the service upon button clik page was refreshed, how to invoke this service without having the page refreshed?

Pls help

Windows Cotron Embedding Problem

Opened a new project  as windows control library name "WindowsControlLibrary5" and gave the user control as name "usercontrol5" had a command button and text  box and comiled, got the dll with name WindowsControlLibrary5.dll
Just to test that is it ok I opened a new windows project, and added in the WindowsControlLibrary5.dll and I could clearly see the form I created earlier as control
So I opened a web project and tried including the file as:

<object id="usercontrol5"
classid=TimedPopGrowth.DLL#"how to write something here"height="370" width="650" >

but I could not see the control on the form , donno what the hell is wrong.
Steve you mentioned aboyt converting a form to web control, how do I do that?

Answer #18    Answered By: Luz Hayes     Answered On: Oct 10

If you need to return data in some nice well formed xml and withouth all
the stuff added by the DataSet you should go with a struct. Now if the
target of your web  service will be the embedded control, go with the
dataset. You would be able to get the dataset from the ws and bind it to
whatever you want.
If you want to return only one data return a "string". If you want to
return one row of data with different columns go with a struct.

I will write it in c#, but you could easily convert it
public MyData GetData()
// open conn
// get a dataset
return ds;
// alternatively you can fill the struct and return the struct
// the struct will be serialized as XML in this way
// <myRow>
// <name>filled name</name>
// <address>the address</address>
// <age>35</age>
// </myRow>

public struct myRow
public string name;
public string address;
public int age;

Second one...
Regards the embedded control question, I've warn you about the problems
you'll have with this.
Check this pdf from Chris Sells (the guru on Smart Client). It is

Also if you have time read  this msdn article

Both of articles have examples about getting a webserice running from a
smart client.

Did you go to Microsoft .NET Framework Configuration tool in Control
Panel\Administrative Tools
Go to Runtime Security Policy\Code Groups\Machine\All_Code
Right-Click and select New, you can create a code group using the URL
membership condition, using your http://... url and then use the
existing FullTrust permission set.

Answer #19    Answered By: Vidos Fischer     Answered On: Oct 10

added your site to trusted sites and I could see the site, which did help alot to have the faith thatforms can be embedded in IE web  pages.

I have tried creting several Windows library Control and truied to embed them in an aspx page  but no, however if I open a new windows project  and try to include dll in that , it is fine.
<OBJECT id=UserControl1 height=280 width=280


Answer #20    Answered By: Hoor Khan     Answered On: Oct 10

I am sending u attached a zip file containg the dll I build to test, can anyone of u please test so atleast then the problem is lleft with that I don't know how to embed
Class name is :
Public Class UserControl1

Answer #21    Answered By: Hugo Williams     Answered On: Oct 10

If it's doing it from within VS but not from outside then you have configured the virtual directory incorrectly.

These things need to run in the root of a virt dir, and they need to be set to SCRIPTS ONLY.

You seem to have gone through the same stuff I did. Incidentally, my site shouldn't need any permissions - it doesn't access client side.

I know - IE security is a pain - and when you mix it with msccorcfg.msc it can come up with some dodgy decisions to say the least.

Ages ago (in the beginning) I was talking to a chap on Sourceforge who was writing a .NET layer to interact with OpenGL - so wicked graphics in the control ... only after he'd done loads of it didi he realise that he'd need persmissions to access the hdd.

Sos I've been a bit slow - I have been getting a bit of brain fizz and blurry eyes, and been desperate to get hold of info on ITemplate (hardly any anywhere).

I seem to have a bad habit of picking undocumented problems ( the last one was IIS Base Admin objects - recursing the metabase - nothing, anywhere, nowhere on the subject, minimal wishy washy interface brush over in SDK docs - nothing else anywhere. It'd be easier to write a new layer yourslef.)

Answer #22    Answered By: Amelia Schmidt     Answered On: Oct 10

The tags need to case sensitive - the tag you sent worked.

<object id="simpleControl1"
height="300" width="600" >

I remember these things - they don't like spaces and all sorts of stuff. Any little inconsistency and it fails, spaces in the dll name was one of them.

I remeber when I didi an office version (interop with word) you had to make sure you didn't actually execute any code until the flaming thing appears in the web  page - at least then you know it works. Then do things on clicks of buttons.

I'd also like to say that I've set up all my old ones on my hard drive again and yours is the ONLY one that does work. God knows why. I think half of them are in beta2 code, the vrt dir now has a different name so there goes me path .... and from what I can remember IIS was very temperemental about whether or not it was going to display  them or not. I thought it had a bug but then it all sorted itself out. Now none of them work (again).

But you CAN make any form into one of these and they WILL download supporting dll's and you DON'T need to remove "main" and you CAN use an .exe in place of the dll.

Didn't find what you were looking for? Find more on Java Applet Or get search suggestion and latest updates.