• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doGet or doPost or doPut

 
Salil Dhawan
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an applet object tag defined in JSP containing class id.No method is declared in JSP (so i guess default is doGet).Which method will be called in calling servlet in this case.

doGet
doPost
doPut
None

Something like
<OBJECT
ID="DCCI"
CLASSID="clsid:019BB827-4327-4D66-9B8D-F2ECBAB915CD"
WIDTH=2
HEIGHT=2>
</OBJECT>




Is there any specific method called for Applet?
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Salil,

the HTTP method doesn't have anything to do with the applet tag in your servlet. This HTML code snippet gets delivered to the browser as any other data. The applet itself will usually run on the client side (the browser) in contrast to a servlet which runs on the server side in your servlet container.

Which HTTP method is used simply depends on the implementation you choose for the servlet.

Marco
 
Salil Dhawan
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly thanks for your message
So that means if i dont specify any method in JSP by default it will be doGet?There wont be any difference as compared to normal handling of servlet in case of Applet?
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HTTP method (GET, POST, etc.) depends on the kind of request you get from the browser. If it's a GET request then the service() method of your servlet will dispatch this request to the doGet() method for example. Of course you then have to override this method in your code to do what you want which is hopefully something useful It's of course also possible to use put all behavior in one method like doGet() and just call this method from doPost() so you only have one place for the functionality if you don't have care about which HTTP method is used.

And for your question regarding the applet: The servlet doesn't care about the applet. For the servlet your HTML applet code just looks like any other HTML code from any other web page. It simply gets delivered to the browser which made a request to your servlet. After this the BROWSER starts to load the applet and execute it. The servlet won't know anything about this.

Marco
 
Salil Dhawan
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for the information.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic