Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 24th, 2003, 12:47 PM
yedaanna yedaanna is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 7 yedaanna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
using servlet output

Hi..
I have an html page with two pages. The top page is static and has a few icons. The bottom page displays output from a servlet. It has two hidden elements in it. When I click the icon in the top page I want to refer the hidden elements in the bottom page,

I am using javascript to refer the variables as follows.

top.framename.elementname.value

This is not working, however if i write the servlet output to a temporaray file and open this file in bottom frame then the same code is working perfectly. How can i use the elements in the servlet output without creating the temporary file.

Thanks,

Reply With Quote
  #2  
Old March 24th, 2003, 07:09 PM
Nemi Nemi is offline
Clueless llama
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Feb 2001
Location: Lincoln, NE. USA
Posts: 2,353 Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Days 12 h 35 m 19 sec
Reputation Power: 111
Post the servlet code and all the html pages here please.

Reply With Quote
  #3  
Old March 24th, 2003, 08:03 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Are all the pages coming from the same server? If you try to load the servlet frame from a different server you won't be able to access it with javascript (security reasons).
__________________
-james

Reply With Quote
  #4  
Old March 25th, 2003, 07:47 AM
yedaanna yedaanna is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 7 yedaanna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
sample code

Hi..
I am testing the following on a localmachine using the server provided by servlet developement kit. I have an html page which has two frames the code for this page is as follows

***************************************************
Main Page

<html>
<frameset rows="35,*">
<frame src="static1.html" name="static">
<frame src="http://localhost:8080/servlet/TestServletOutput" name="dynamic">
</html>

*************************************************

page static1.html is as follows

*************************************************
static1.html

<html>
<script language="javascript">
function get_drill()
{
alert(top.dynamic.form_new.first.value);
}
</script>
<input type=button value=click onclick=get_drill();>
<input type=hidden name=first value="-1">
</html>

**************************************************

the bottom frame contains the servlet..the servlet is as follows.

*************************************************
import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class TestServletOutput extends HttpServlet {

public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{

doPost(request,response);
}

public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{

response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<br><head></head><br><body><br><form name=form_new><br><input type=text name=\"first\" value=\"xyz\"><br>");
out.println("</form><br></body><br></html>");
out.close();
}
}

***************************************************

I have posted the entire code so that you guys can just copy it and test it. I get the error

Runtime error, permission denied.

Both of the files are coming from my local machine so why does it give permission denied.

Thanks for all your replies,

- yedaanna

Reply With Quote
  #5  
Old March 25th, 2003, 08:52 AM
Nemi Nemi is offline
Clueless llama
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Feb 2001
Location: Lincoln, NE. USA
Posts: 2,353 Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Days 12 h 35 m 19 sec
Reputation Power: 111
When you are opening the main page, are you requesting it through the web server, or are you jusst double clicking on it in windows explorer? If you are double clicking on it, it will probably fail. Try opening up Internet Explorer and typing in the url with localhost and the port and see what it does.

Reply With Quote
  #6  
Old March 25th, 2003, 03:58 PM
yedaanna yedaanna is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 7 yedaanna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
worked on webserver

Hi..
the code i posted works perfectly on my companys web server, dont know what the problem is with the local machine.

thanks

yeda

Reply With Quote
  #7  
Old March 26th, 2003, 11:08 AM
zcrar70's Avatar
zcrar70 zcrar70 is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 49 zcrar70 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Javascript only allows you to act on pages that are part of the same domain. So, if your frameset is on www.xyz.com, you will not be able to control a frame located on www.abc.com.

So, if you launch your frameset from http://localhost, eg http://localhost/index.htm, and poth frames within you frameset are located on the same server, eg. http://localhost/top.htm and http://localhost/bottom.htm, then you can have javascript acting from one frame to the other. If the pages are on different servers, eg. the bottom frame is on www.xyz.com, then you won't be able to use Javascipt on it.

In short, if you don't launch your index /frameset page from http://localhost:8080, then it won't work

regards,
Elie

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > using servlet output


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway