aspose file tools*
The moose likes Applets and the fly likes Applets form in webpage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applets form in webpage" Watch "Applets form in webpage" New topic
Author

Applets form in webpage

Adam Teg
Ranch Hand

Joined: Feb 09, 2006
Posts: 36
I need to create a form and I have decided to use an applet,jsp or servlets (In a web page) to capture the info and store it. I know a little of each. The deciding factor on how to implement this is that I don't want the users to be able to go back once the form is started. No hitting the BACK button.

I need some suggestions please. Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42291
    
  64
Welcome to JavaRanch.

I'm not quite sure what you want to achieve - an applet which shows several forms in sucession in which to enter data, which at the end should be submitted to a JSP/servlet?
In an applet you could use the CardLayout layout, which allows you to have several "pages/cards", between which you can switch at will (in particular, you can disallow going back).
For submitting to the server, have a look at the java.net.URL and URLConnection classes.


Ping & DNS - my free Android networking tools app
Adam Teg
Ranch Hand

Joined: Feb 09, 2006
Posts: 36
Thanks
Adam Teg
Ranch Hand

Joined: Feb 09, 2006
Posts: 36
I have one more question..maybe a couple

1) So I use a the CardLayout and design a form, can I use cookies to determine if a person has been to the site? I just don't want to start someting and findout you can't.

2) Is it best to use a new appelet from one form to another or use the same appelet to repaint?

What I really need is best practices suggestions...

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42291
    
  64
#1) This page explains how to use cookies in an applet.

#2) How (and why) would you use a new applet? Each of the forms is represented as a card in the CardLayout. The user switches from card to card, but it's all within the same applet.
Adam Teg
Ranch Hand

Joined: Feb 09, 2006
Posts: 36
Thanks

I am trying to read a local file and write write to a local file using an applet. Can this be done and where can I get some help?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42291
    
  64
It can be done, and JavaRanch is the right place for all your Java help needs :-)

This wiki page explains signing applets, and altering your security policy, which are the two methods one can use to allow applets access to the local file system.
Adam Teg
Ranch Hand

Joined: Feb 09, 2006
Posts: 36
Thanks again..more questions..

How can I make a brand new applet appear when a person presses a button on a current applet. I have two applets. The first one is a sign-in applet, if they succeed in getting in then I want to display a new applet.

These two applets are both standalone now. Can I do some sort of repaint?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42291
    
  64
You could combine them in a single applet, but I'm guessing you don't want to serve the classes of the "functional" applet until a user is authenticated. The applet could also replace the web page it's on with another page that contains the second applet (or pop open a new browser window with the applet in it). You'd need to think about how to transfer the login information from one applet to the other, though.
Adam Teg
Ranch Hand

Joined: Feb 09, 2006
Posts: 36
A popup window sounds good. How (where is the help I can get) to popup the other applet. After this applet there is also another applet I want to display in the same popup I want to display but it can be grouped in the same applet.

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42291
    
  64
The new window would not be an applet window, but a browser window that displays a web page you specify. That page can contain as many applets as you like. You can open a new browser window like this:

applet.getAppletContext().showDocument(url, "_blank");
[ February 13, 2006: Message edited by: Ulf Dittmer ]
Adam Teg
Ranch Hand

Joined: Feb 09, 2006
Posts: 36
Why don't you just do my assignment for me???

This is working great so far..is there a way to make the new browser not show the "File Edit View all that stuff on top and just the window?

Thanks again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applets form in webpage