• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

not able to communicate to servlet

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello there..

i m new in java so please dont ignore this post its very urgent,i didn't find and relevant post before even though after looked around the recent ones.

i want to communicate an applet embedded into a jsp(say myjsp) to a servlet(say myservlet) those are in diffrent directories.
myservlet itself running with uri http://localhost:8084/UASProject/myservlet.java and this file located in /UASProject/src/java/ directory.

myjsp itself running with uri http://localhost:8084/UASProject/myjsp.jsp and this file located in /UASProject/web/ directory.

and i am using the follwing code inside




after running this code i found following error in IE7.0 window

HTTP Status 404 - /UASProject/RegistrationData.java


--------------------------------------------------------------------------------

type Status report

message /UASProject/RegistrationData.java

description The requested resource (/UASProject/RegistrationData.java) is not available.



--------------------------------------------------------------------------------

Apache Tomcat/5.5.17
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure what this line is supposed to accomplish:



Should the JSP be replaced by exactly the same URL that the applet had earlier accessed?

You could try using hardcoded URLs instead, like new URL("http://localhost:8084/UASProject/myservlet") to see if that makes a difference, or print the value of the URLs the applet is trying to access using System.out.

Also, please read this: EaseUp
[ November 09, 2007: Message edited by: Ulf Dittmer ]
 
Nidhi Nagre
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Mr Ulf

sorry to describe the wrong uri jsp's accessed with.

the correct one is http://localhost:8084/UASProject/faces/myjsp.jsp
the remaining datas are same.


as you said, i tried on that way also

i used hardcoded url like new URL("http://localhost:8084/UASProject/myservlet") but coudn't got success. right now i am getting the same error.

one more thing, when i tried to run an another jsp(say another) instead of servlet in the same way then it was working fine. why it creating problem with servlet?
 
Nidhi Nagre
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
actually i was making mistake at the time when i was using Protperties(which dosen't implements Serializable interface ) object.but now i m using Hashtable class to structure all data and writing object of this class to ObjectOutput stram.

but one more thing i cant understand,

there is not any effect of this line of code


getAppletContext().showDocument(servletURL,"_self");



however when i tried to run an another jsp page using its uri then it was running in the browser, then why servlet doesn't??
why am i prompt to download the servlet file instead??
 
Ranch Hand
Posts: 354
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Are you trying to access a Java Source file here?
 
Nidhi Nagre
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


abhinav wrote:

http://localhost:8084/UASProject/myservlet.java
Are you trying to access a Java Source file here?



actually java servlet source file is located at /UASProject/src/java/

and i am deploying it with with uri above.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At this point, I suggest that you step back a bit from this project and grab a good book or find a web tutorial on servlet (and, better, Java) development.

Java is not a scripting language.
Before a Java program can run, it needs to be compiled into a bytecode byte code file with a '.class' extension.

Trying to step past the beginner stuff will usually result in a lot of headaches and make it take a lot longer for you to become a proficient servlet developer.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic