Viewing html page of an applet
I am trying to write an applet.
When I viewed the html page for the first time,
it worked fine.
But now it doesnt work properly.
All the contents are not shown.
I recompiled my code but the mistake remains.
Please help
Probably need to refresh the web browser cache; usually the browser "Refresh" function will do that; or close ALL browser windows and then try it again.
Similar Messages
-
Replace HTML page with an applet
Hello to everybody!
I created a servlet who can manage file upload from an HTML page.
Now I want to replace that HTML page with an applet.
I know that I need to use multipart/form-data , but I have no experience with applet.
HTML page code is:
<html>
<head><title>Upload</title></head>
<body>
<FORM ACTION="http://localhost:8080/examples/servlets/servlet/UploadTest" ENCTYPE="multipart/form-data" METHOD=POST>
What is your name? <INPUT TYPE=TEXT NAME=submitter> <BR>
Which file do you want to upload? <INPUT TYPE=FILE NAME=file> <BR>
<INPUT TYPE=SUBMIT>
</FORM>
</body>
</html>
Any help for "translating" this html page into an applet?
Applet will send, like html page, a string and a file.
Thanks in advance, LiukIf you use something like Apache Http Client you dont have to do any low level implementations.
Also if you are the one who is writing both servlet and applet you dot have to stick to standerd formats. you can develop your own format and write both servlet and applet to handle it. that kind of thing can be done easily even with URLConnection. But if you plan to send large files then URLConnection may not be the right option becouse I have seen many complaining that URLConnection gives OutOfMemoryErrors when uploading large amounts of data. -
Printing HTML PAGE in a Applet
I am tryng to print a HTML Page in a Applet .
When Using Eclipse Environment everythig goes fine.
Now I am trying to use the appletviewer to run the same
source, but it appears the following:
http://10.15.1.26/
Conecting to http://10.15.1.26/
Exception in thread "AWT-EventQueue-2" java.lang.RuntimeException: java.security.AccessControlException: access denied (java.net.SocketPermission 10.15.1.26:80 connect,resolve)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at javax.swing.JEditorPane.getStream(Unknown Source)
at javax.swing.JEditorPane.setPage(Unknown Source)
at javax.swing.JEditorPane.setPage(Unknown Source)
at javax.swing.JEditorPane.<init>(Unknown Source)
at AppletPrintHTML$EditorPaneHTMLViewer.loadStartingPage(AppletPrintHTML.java:90)
at AppletPrintHTML$EditorPaneHTMLViewer.<init>(AppletPrintHTML.java:103)
at AppletPrintHTML$5.actionPerformed(AppletPrintHTML.java:364)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.net.SocketPermission 10.15.1.26:80 connect,resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
Why I am not allowed to connect to the site without Eclipse? Any Idea?
Angel PortalThis code
* Load a HTML Page
private void loadStartingPage() {
try {
System.out.println("Conectando a "+ path);
mainPane = new JEditorPane(path);
} catch (IOException e) {
System.err.println("N�o Pode Conectar");
System.exit(1);
Open a html page ( path ) on JEditorPane!
In Eclipse worked just fine!
But if I try to do that on a Browser or appletviewer the error a told you shows up.
I am reading about the The Permission Classes.Someone have heard of it? -
Open a html page from an applet
Hi,
I would like to open, from an applet, an HTML page in a new window with a specific width an eight.
Who can help me ?Here is an example of applet to javascript with liveconnect:
http://www.narhari.com/java/applet2javascript/
You can use the send(String) method from the sample applet to send something like:
window.open('xyz.html','myPopup','width=200,height=200');in order to open a window with specific dimensions
of course you can also build HTML in your applet and use send() + some javascript to render it. -
How to call and run HTML pages from an Applet?
I want to run another HTML page when pressed a button in an Applet,how can i do it?
Are you looking for this?
applet.getAppletContext().showDocument("http://cullenwines.com.au", "_top"); -
How to display an image on the HTML page by using applet
Dear friends,
I am now writing an java applet, I want to display an image on the HTML page, and tried the following commands:
{color:#ff00ff}{color:#000000}Image map; //put in the class definition
map=getImage(getCodeBase(),"hhh.gif"); //put in the function of init()
g.drawImage(map,0,300,this); //put in the function of paint(){color}
{color}
However, when I run it, the image wasn't displayed at all.
I hope who guys ever come across this problem could help me to solve it. Thank you in advance!
HawaiiHi,
I am no expert on Images
but
from personal exp.
are you sure that map actually contains the image?
try using
ImageIcon ii = ImageIcon(String name);
map = ii.getImage();I saw a tutorial on images i think on sun
where they use ImageIcon to load the image -
Viewing HTML page saved on the server from the browser
Hi all
In my application i am having some HTML pages saved on the server. I had given an option to the user to view the HTML page from my application. behind the scene what i am doing is that the view request will get handled by a servlet and from that servlet iam locating the HTML page on the server directory and sending the HTML page to browser by using the Servlet OutputStream. The HTML page is shown on the browser but the attached images are not shown. The images are also there in the server directory and are refered in the HTML file correctly. When i directly open the HTML file then the images are shown correctly.
Can anyone suggest wat's wrong there.
The code i m using is
ServletOutputStream out=response.getOutputStream();
if(format.equalsIgnoreCase("pdf"))
logger.info("Seleted format is pdf..\n");
response.setContentType("application/pdf");
else
logger.info("Seleted format is html..\n");
response.setContentType("text/html");
String file = ReportingConstants.URL_GENERATEDREPORTS+reportPath+itemName;
// file : HTML file absolute path as string.
URL url=new URL(file);
BufferedInputStream bis=new BufferedInputStream(url.openStream());
BufferedOutputStream bos=new BufferedOutputStream(out);
byte[] buff = new byte[2048];
int bytesRead;
while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
bos.flush();
}You have to undertsand how the browser handles images and other resources in a HTML page. In the HTML there is an image tag that has a url to an image which can be a reletive url or an absolute url (starts with a "/").
If the url is a relative url the browser interprets the url as being relative to the url currently displayed in the address field discarding the last element of the url . So if the url in the address bar is http://www.myserver.com/myapp/mypage.html and the relative url is images/myimage.jpg, the browser will submit a request to the server for http://www.myserver.com/myapp/images/myimage.jpg
Now let's say that you are call mypage.html from a servlet that has the url http://www.myserver.com/myapp/servlets/myservlet. Then when the browser tries to retrieve myimage.jpg it will use the url http://www.myserver.com/myapp/servlets/myservlet/images/myimage.jpg and since this is incorrect it will not be able to display the images.
One solution to this is to change all of the image urls to absolute urls. That is the start with a slash where the slash represents the start of the url after the application domain name. For example you used an absolute url for myimage.jpg it would look like /images.myimage.jpg and when accessing the page through the servlet url (http://www.myserver.com/myapp/servlets/myservlet) the browser will discard everything after http://www.myserver.com/myapp and look for the image at http://www.myserver.com/myapp/images/myimage.jpg which is the correct url.
A second solution is to use the HTML BASE tag which tells the browser not to interpret the image tag urls (and other resourses) using the current url in the address bar but to use the url supplied in the HTML BASE tag. The browser will still perform the same process for relative urls but now relative to the BASE tag url. Since the BASE tag url will be the same every time the page is accesssed the images should be correctly accessed no matter how the page is accessed (eg directly, using RequestDistpatcher or via your servlet) -
How to call html page from an applet
I want to call a html page after the user presses a OK button in the applet. please help me in this.
In you actionPerformed put:
AppletContext appContext=getAppletContext();
URL myURL= new URL("http://www.javasoft.com");
String target="_self";
appContext.showDocument(myURL,target);P.S. If you want to pen the URL in a new Browser window
use
target="_blank"; -
View html page in forms 6i on the web
Hi to all
I want to view a html page in my form on the web, i try to use web.show_ocument, but it opens a page in another window. I'm working with oracle 9ias, and i can't use OLE and OCX. How can i open an html page in a frame (and not in onother window)?
Plz HELP!!
Thanks in advanceHi,
if starting Forms in a HTML frame you can launch a HTML page to show in the same view. If e.g teh frame name for the HTML contect to show is "details" then you can do
web.show_document("<URL>",'details');
There also exists the IceBrowser class that knows how to render HTML pages. You ca add this in a PJC or as a Java Bean to Forms.
http://www.icesoft.com/products/icebrowser.html
Frank -
I used JEditorPane and JTextPane to show HTML Pages, but it did not work with the hyperlink texts. How do I solve this problem.
You have to add a hyperlinklistener to handle user interactions.
Code sample comes from http://www.exampledepot.com/
try {
String url = "http://java.sun.com";
JEditorPane editorPane = new JEditorPane(url);
editorPane.setEditable(false);
editorPane.addHyperlinkListener(new MyHyperlinkListener());
} catch (IOException e) {
class MyHyperlinkListener implements HyperlinkListener {
public void hyperlinkUpdate(HyperlinkEvent evt) {
if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
JEditorPane pane = (JEditorPane)evt.getSource();
try {
// Show the new page in the editor pane.
pane.setPage(evt.getURL());
} catch (IOException e) {
} -
Call a html page from a applet
did somebody can tell me how call any html page to display in the current window of the browser when the user push a Button in one applet
http://forum.java.sun.com/thread.jsp?forum=31&thread=566530&start=1&range=1
or
http://forum.java.sun.com/thread.jsp?forum=31&thread=566059&tstart=0&trange=100 -
How to view HTML page source in CR2011 CrystalViewer
We are migrating from CR2008 SP3--> CR2011 (Unmanaged RAS SP5, OEM Edition 14.0.5.882)
We have JSP page which wraps the CrystalViewer output between a ReportMenu page
viewer.setOwnPage> FALSE Ensure that it is not generated with tags
response.setBufferSize(4096);
response.setContentType("text/html; charset=UTF-8");
Writer out = response.getWriter();
request.getRequestDispatcher("/webrpts/header.jsp").include(request,response);
viewer.processHttpRequest(request, response, servletContext,response.getWriter());
When we upgrade to CR2011, the viewer is showing the report in a BOX
if we right click view Source, the report content are not shown.
Is there any parameter to view the report source?
I tried to print the output using viewer.getHtmlContent(request, response, servletContext);
It does not output the Report Content....
I am attaching a document to show how it is output in CR2008 and CR2011
What is the difference between CR2008 and CR2011 Viewer?
Please help.We are using JAVA SDK and already we are hiding the ToolBar by setting
viewer.setDisplayToolbar(false);
viewer.setToolPanelViewType(crToolPanelViewTypeEnum.none);
The documentation says if
viewer.setOwnPage(false); then the <HTML></HTML> will not be generated by the
viewer.processHttpRequest(....)
But if I output the data generated by this method it does not have the report output....
We are expecting that and process further using javascript
What is the difference in behaviour of 2008 and 2011 Crystal Viewer?
Previous flow explained below
Ex
<html>
<head>.......
<javascript...............>
</head>
<body onload=callCustom()>
viewer.processHttpRequest(......)
</body>
</html> -
Why won't my HTML page display my applet?
I can't figure this out. It works fine through Sun's appletviewer. Here is my HTML code:
<applet code="backGroundSwing.class" height=200 width=500></applet>
Here is my applet code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
//<applet code="backGroundSwing.class" height=500 width=500></applet>
public class backGroundSwing extends JApplet{
sprite pane;
JButton red = new JButton("Red");
JButton green = new JButton("Green");
JButton blue = new JButton("Blue");
JButton cyan = new JButton("Cyan");
JButton yellow = new JButton("Yellow");
JButton orange = new JButton("Orange");
public void init(){
Container contentPane = getContentPane();
pane = new sprite();
contentPane.add(pane);
pane.add(red);
pane.add(green);
pane.add(blue);
pane.add(cyan);
pane.add(yellow);
pane.add(orange);
red.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
pane.setBackground(Color.red);
green.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
pane.setBackground(Color.green);
blue.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
pane.setBackground(Color.blue);
cyan.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
pane.setBackground(Color.cyan);
yellow.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
pane.setBackground(Color.yellow);
orange.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
pane.setBackground(Color.orange);
class sprite extends JPanel{
sprite(){No, all the other applets use AWT. I think I have the plug in. At least, on my control panel, I have an icon that says:
java 1.3.1 plug in.
Is there a way that people with out any java software installed on there computer except a java enable browser view my swing applets?
Here is my source code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
//<applet code="backGroundSwing.class" height=500 width=500></applet>
public class backGroundSwing extends JApplet{
sprite pane;
JButton red = new JButton("Red");
JButton green = new JButton("Green");
JButton blue = new JButton("Blue");
JButton cyan = new JButton("Cyan");
JButton yellow = new JButton("Yellow");
JButton orange = new JButton("Orange");
public void init(){
Container contentPane = getContentPane();
pane = new sprite();
contentPane.add(pane);
pane.add(red);
pane.add(green);
pane.add(blue);
pane.add(cyan);
pane.add(yellow);
pane.add(orange);
red.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
pane.setBackground(Color.red);
green.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
pane.setBackground(Color.green);
blue.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
pane.setBackground(Color.blue);
cyan.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
pane.setBackground(Color.cyan);
yellow.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
pane.setBackground(Color.yellow);
orange.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
pane.setBackground(Color.orange);
class sprite extends JPanel{
sprite(){
-
Which is better - 1 HTML page with multiple applet panels or 1 applet with
Hi friends,
This is a critical doubt which decides the future of my project.
I have implemented a graph in which an html shows 3 panels on the screen via calling that applet 3 times.
Would it be good if we call that applet only once and modify the applet to show 3 panels?
Thanks in advancehai paskal,
well having 3 panels in a single applet will not make a big difference when compared to having 3 diff applets with 1 panel each ...
what matters most is how u want to have ur web page ...
if you have 3 different applets then you can place them in a position according to ur wish ...
if it is one then all of them will be together ...
Peter -
How do You set -noverify in an HTML page that calls an applet
I have an applet which runs fine from inside JBuilder when I specify a
-noverify switch in the debugger. (java -noverify myapplet.class)
Without this switch, I get a verification exception.
So I need to specify the -noverify switch from inside a webpage so that when the client runs it, he does not get the same exception.
The question is how do you pass -noverify to JVM from an HTML page that uses <applet> tag and javascript?
ThanksOdd, because I work on an applet that gets built with 1.4. We have 30,000+ clients who use it every day, and I'm sure we don't tell them about setting -noverify switches in their plug-in control panel, and we don't (cuz we can't) set it in the applet (object/embed, actually) tag.
Of course, I suppose it could be a backwards compatibility issue going from compiling in newer version than it's run in.
Maybe you are looking for
-
My 5th generation nano will no longer Sync my address book from my Mac. It gives me a message that I have no "Contacts", and asks if I want to create some. My address book is full of contacts, but for some reason it thinks it is empty. All the oth
-
Clamshell mode won't work? (MacBook + LG Monitor)
Howdy! I've triple-checked the official doc on how to use Clamshell Mode, but I can't seem to get it to work. My MacBook is plugged in and fully charged, the display (LG W2052TG) is connected, as are my USB keyboard and mouse. Yet when I close the di
-
My iphone can use only one network
Hi, my iphone can use only Orange network. I live in mauritius and i just bought my iphone from Mauritius telecome Orange. Now when i insert another network on it, it says please insert simcard. I cant use other network on this. Is it possible to unl
-
Control a symbol timeline from another symbol timeline on specific condition
Hi! I have 8 animated symbol that plays on clicking over them on the main stage and i want, for example, that if symbol 1 animation is complete and i click on symbol 3, symbol 3 plays forward and symbol 1 plays on reverse and vice versa just like thi
-
Hi all, I used Imageicons(like error, Up, down arrows, etc...) to my swing pplication 2 years back using some image "Jar" file from Sun. but now I didn't find it and fotgot the jar file name. does anyone know the name of the jar file that contains al