Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

frame - servlet communication  RSS feed

 
karan, chopra
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i am trying to make a frame communicate with a servlet,i am successful with sending data from the servlet to the frame but i have tried and tried but unsuccessfully to do the vice versa,ie,i am unable to send data from the frame to the servlet.basically i cant get the doPost method of the servlet to execute,everytime i run the frame and try to execute the servlet i get the following exception in the command prompt:
java.io.FileNotFoundException: http://trans23:8000/examples/servlet/testservlet
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at testframe.readServletResponse(testframe.java:139)
at testframe.actionPerformed(testframe.java:193)
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.run(Unknown Source)
and the following error in the tomcat window:
Service called
Return from service
2001-07-25 10:49:53 - Ctx( /examples ): 405 R( /examples + /servlet/testservlet + null) HTTP method POST is not supported by this URL
i am just not able to understand that if the doGet method is executed so smoothly then why is the doPost not being executed,i have checked the URL of the servlet provided in the frame for calling the doPost method and its correct..please advice me wat to do..i am stuck up..
any sort of help would be appreciated..
regards
karan
 
Phil Hanna
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your servlet have a doPost() method? The default doPost() method in GenericServlet gives you the "Method not supported" message. You need to override it if you want to be able to handle POST requests.
If POST requests should be handled exactly the same as GET requests, you can simply call doGet from doPost:

------------------
Phil Hanna
Sun Certified Programmer for the Java 2 Platform
Author of :
JSP: The Complete Reference
Instant Java Servlets
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!