Hi, what is default method in servlets?

hi,
i am not mentioned any method in my servlet program,
so what is the default method either get or post?
jp

Hi
If you what to provide the same stuff for both
POST/GET HTTP request you can use the service method:
public void service(ServletRequest req,
ServletResponse res)
throws ServletException,java.io.IOException /Tobiaswhen reading 'More Servlets And Java Server Pages' you are discouraged to use service(), unless you want to do some of the preprocessing yourself. (sorry, I don't exactly, what is done before doGet()/doPost() are called...)

Similar Messages

  • Default method in Struts

    does any one know whats the default method in Struts... GET or POST

    I suppose you're talking about the form tag. Then that's POST,
    unlike the HTML form.

  • ABAP OO Workflow - Default Method

    Dear all,
    Does anyone know how to set default method for Abap OO Object?
    In BOR, we can set it in the header attribute. But I can't see any place where we can set the default method in Abap OO object.
    Thanks.

    Hello,
    Thanks for taking the time to close off your question. However if you close a thread without an answer then it would be nice to post the answer for folks who search the forum with the same query later on.
    For what it's worth, BI_OBJECT~EXECUTE_DEFAULT_METHOD is always the default method. In here you can add code to call any other method.
    Cheers,
    Mike

  • ERROR TRIGGERING DEFAULT METHOD FOR OBJECT (INCOMING INVOICE).

    When trying to open invoices in my ERP inbox to authorise I get the following message.
    ERROR TRIGGERING DEFAULT METHOD FOR OBJECT (INCOMING INVOICE).
    . There might be an authorisation issue. but i am not confirm.
    I have checked the authorisation in SU53 also.
    is it possible that there is some other reason for it.
    If so then what are they?
    please help.

    Hi Naval,
            Is it a custom business object....make sure that the status of all object components are set to Implemented or released..and  regenerate the Object...
    Thanks
    Srinivas

  • Why Do We Have To Call super.init(config); in init() method of servlet?

    Hi, everyone..
    I wonder why we call super.init(config) in init method of servlet... If i dont call it ; when i try to get servletcontext in service method it throws java.lang.NullPointerException...when we call super.init() , what is happening behind the scene? If anybody has a technical explanation for my question , i will be very pleased...
    THX FOR YOUR FUTURE REPLIES IN ADVANCE....

    I am sorry about the uppercases and i dont want to seem smart on java forums... Anyway, m8 this is the thing that i know... i meant; for instance when we override doGet or doPost method ; we dont need to override init method; but the server loads the servlet and we can get the context of the servlet in these methods easily by calling getServletContext() method; however when we want to call service method implicitly by jndi, servlet needs to be loaded and init method must call its parent...(i also write down in web.xml <load-on-startup>.... for that servlet).
    thx for your replies in advance....

  • Workflows : Unable to call a report from a Default Method of Business Objec

    Hi,
    Good afternoon.
    Well, we had a requirement where a Business Object's Default method should call a report which in turn calls a User Defined Screen(Call Screen 100 say...) which had a Text Control with one OK button.
    In this requirement, I had created a method with all the above functionality and then tested the BUSINESS OBJECT accordingly. Well, when Testing the BO directly, I am able to get my REQUIREMENT satisfied like the METHOD is working PERFECT as per the requirement.
    Now I made it as an DEFAULT METHOD and used the same BO for a workflow. And that Workflow gets triggered with an Event within that BO. So the instance of this BO is coming to the Workflow.
    Now, I created a new Decision step and copied the standard step's task into a new Standard task. And I included this task for my new DECISION STEP. In this standard task , I had created a CONTAINER Varaible for my BO.And in my WORKFLOW, I had passed the instance of my BO in the BINDING PART of this Decision Step.
    Now, my objects and Attachments part had an HYPERLINK, but it is not executing the needed method. Why is it so?
    Do we had any limitation for this?
    Shouldn't we call any report which calls a user defined screen from a method ?
    Is there any way for solving the above problem?
    Like I want to display a TEXT CONTROL which takes COMMENTS from the Approver during the WORK ITEM PREVIEW before APPROVAL / REJECTION and this INPUT must also be shown in WORK ITEM PREVIEW in the next level.
    Someone please help me.
    Regards,
    Raja Sekhar

    Hi Raja,
    Well it is not yet afternoon for me. In fact the work day just about started
    Have you tried debugging it? Put a break point in your default method and click on the object link from the inbox and see if your method is getting executed and if it is you may find what the problem is.
    Also, have you tried with a different default method like a display method and checked if it works?
    Thanks,
    Ramki Maley.

  • How to expose custom methods of servlet as web services

    Can i know how to expose the custom methods of the servlet as web services. if it is not posssible then what alternate ways are possible other than ejbs?
    regards

    Hi
    I want to know that whether the custom methods of servlet can be exposed as webservices or not?
    Secondly is there init method like we have in servlets so that we can do all the one time loading in the init() method.
    regards

  • What's wrong with my servlet code ?

    <p>
    Hi,
    </p>
    <p>
    I need to redirect user from jsf application to PHP app with some request attributes using POST method. To check how to do at first I prepared simple servlet:
    </p>
    <p>
    public class TestServlet extends HttpServlet {
        public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException,
    </p>
    <p>
                                                                                   IOException {
            req.setAttribute(&quot;p1&quot;,&quot;Value One&quot;);
            req.setAttribute(&quot;p2&quot;,&quot;Value Two&quot;);
            res.sendRedirect(&quot;http://www.mycompany.pl/test.php&quot;);  
        public void doGet(HttpServletRequest request, HttpServletResponse response)throws IOException,
    </p>
    <p>
                                                                                                                                ServletException{
                  doPost(request,response);
    </p>
    <p>
    I also prepared simple PHP page to display these attributes (Im sure this page works correct):
    </p>
    <p>
    &lt;html&gt;
     &lt;body&gt;
      Attribute p1:  &lt;? echo $_POST[&quot;p1&quot;]; ?&gt; &lt;br /&gt;
      Attribute p2:  &lt;? echo $_POST[&quot;p2&quot;]; ?&gt; &lt;br /&gt;
     &lt;/body&gt;
    &lt;/html&gt;
    </p>
    <p>
    Te problem is that attributes from servet don&#39;t displayed  on PHP page - why. What is wrong wit this servlet ?
    </p>
    <p>
    Kuba
    </p>

    Well if this line of code works for you:
    res.sendRedirect("http://www.mycompany.pl/test.php");
    you could append parameters by building the url string dynamically.
    res.sendRedirect("http://www.mycompany.pl/test.php?p1=ValueOne&p2=ValueTwo");
    Isn't PHP a server technology, if yes why don't you do all the work in php (you'll avoid cookie problems)?
    Regards
    Fred
    PS I don't think this forum is the right place for php questions.

  • Default methods

    I read the Java tutorial on default methods and I think I understand how interfaces may evolve without loss of backward compatibility. My question refers rather to how should we design our interfaces from scratch. If and when should we define default methods? As an extreme example, why not design MyNewInterface with all default methods? If some operation makes sense, fine, stick the appropriate code in there, and if not, just do nothing, return null, return 0, return false. This would give the implementers of my interface quite some freedom what to care about, depending on their application needs and would make their apps less verbose (kind of like what the awt Adapter classes achieve). I don't look for an approval of this approach, but at some guidelines. Hope this makes sense.
    Edit: And one more question from someone involved a lot with libraries for external clients. Does it make sense to rewrite old interfaces in a new release of the library and turn some methods into default methods containing code that makes sense? This option was not available so far and users had to write sometimes trivial implementations.

    So:
    cool stuff for backward compatibility
    probably not as compatible as you think
    but...
    how should we design new interfaces?
    For *new* interfaces, including default methods is not going to break anything (at least, not immediately, see later). I think, use this sparingly: if you genuinely have an example of "every object of this type should have this functionality", *and* there's an obvious default implementation, then that's probably a good case for using default methods.
    So , consider a DAO interface. You'll commonly want to get an object via it's id. The database stores the id as an int, and the corresponding class has an id field of type Integer. So it's fairly intuitive to define
    public interface DAO {
        public Entity getEntity(int id) ;
    But... all (or the vast majority) of my use cases are in a web application, and of course the only data type http knows about is String. So at some point, I get a request parameter representing the id as a String, and have to convert it to an int in order to get the entity from the DAO. In other words, I end up doing this:
    DAO dao ;
    String idFromRequest = request.getParameter("id");
    Entity entity = dao.getEntity(Integer.parseInt(idFromRequest));
    I end up really needing DAO to support a
    public Entity getEntity(String id);
    method, but do I really want to force all implementations to implement it to call Integer.parseInt(...) to invoke the other method?
    I could, of course, define an AbstractDAO class that adds the method in, but then I lose the whole "programming to interfaces" paradigm.
    So that would (at least, on the surface) appear to be a nice use case for default methods.
    You should still worry a bit. Even if I put a default method into a new interface, any classes that implement that interface and some other interface are vulnerable to breaking if the other interface later introduces a default method with the same signature as my default method. So you might want to think about making those default method names quite specific.
    Default methods should be used sparingly. If you add dozens of them to your libraries, you increase the risk of problems caused later by classes not being able to resolve calls unambiguously.

  • HT5625 if i have multiple apple IDS and i would like to delete all of them except the one I wish to continue using what is the method

    In case I have multiple Apple Ids and I want to delete all of them except one , what is the method to be followed.??
    Or is it that there is no scope for deletion and the Ids are just disabled

    Sorry, Apple ID's cannot be deleted or merged. All you can do is stop using an Apple ID.

  • Calling a method of servlet

    How to call a method of servlets like we do in struts like "get.do?method=getData". I know servlets are called defacult method either dopost or doget are called but can i call any other in the servlet and if yes how can i do that?

    May be your servlet is not able to lookup the EJB. You can use some print statements and see whether lookup ok or not.
    Just a guess.
    Plese get back, if any queries.
    Thanks,
    Rakesh.

  • Getting error while calling ejb business methods from servlet

    Hi
    Iam getting error when i try to call a ejb method from servlet.Error is
    "com.netscape.server.eb.UncheckedException: unchecked exception nested exception is:java.lang.NullPointerException".
    I build the application and deployed it successfully.Iam using IAS 6.O with windows NT 4.0.
    This is just a method which takes values from database and return as an array of bean to servlet.
    Any help on this.Thanks Shank

    Hi
    I was using the session bean.Your suggestion helped me a lot.Perfect.
    I debug my program and found that from ejbCreate()exception is getting.
    I was getting the datasource object thro ejb create() initialisation.
    Somehow the look up jndi which i mentioned was not interpretting from ejb-jar.xml ias-ejb-jar.xml and datasource ref .Due to this iam getting jndi Namenotfound exception which in turns to null pointer as datasource is getting null.
    when i hardcoded in the ejb the the jndi name for datasource it is working fine.Bit worried all the existing ejbs working with the xml referenced datasource and jndi,but when i added a new ejb with same properties it is failing to get the jndi name.
    Piece of code from ias-ejb-jar.xml
    <resource-ref>
              <res-ref-name>myDataSource</res-ref-name>
              <jndi-name>jdbc/nb/myData</jndi-name>
    </resource-ref>
    Piece of code from ejb-jar.xml
    <resource-ref>
              <res-ref-name>myDataSource</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
    </resource-ref>
    Thanks a lot meka

  • What are the methods called while navigating from one applet to another one

    Hi All,
    Could any one brief me about "When you navigate from one applet to another what are the methods called ?".
    Thanks in advance.
    Best Regards,
    N.Madhusudhanan.

    http://forum.java.sun.com/thread.jsp?forum=421&thread=426771&tstart=0&trange=100

  • What are the methods available to modify standard reports?

    What are the methods available to modify standard reports?

    <b>Hi,
    I think you can copy those reports into Zreports</b>

  • What is the method of getUserName() for JDBC DataSource in JDeveloper 11g.

    Hi All,
    I am facing a issue about getUserName() Method.
    The below method
      getDBTransaction().getConnectionMetadata().getUserName()
    working fine for JDBC URL While the  same method not working for JDBC DataSource.
    So What is optional method for getUserName() for JDBC DataSource,  I need  JDBC DataSource because in Our Standalone weblogic server we using data source.
    Maroof

    Hi Vohar,
    JNDI is there then how we can get user name you have any idea?
    Our Connection.xml look like below
                                        user                              oraJDBC                              1500                              192.168.0.0                              user1                                       thin                 

Maybe you are looking for

  • Questions on cache and general RSRT settings for plancube

    Hi, we would like to: 1) set request status 1 in RSRT for our planqueries, in order to automatically refresh the query after executing a planfunction (problem we have now is that the results of a planfunction are not automatically updated in the quer

  • Using a Samsung Digital Photo Frame SPF-83H as USB monitor

    I have a Samsung Digital Photo Frame SPF-83H that I can use as a USB monitor in a PC but does'nt work in my Mac Mini. Any driver or adaptator? Thanks a lot! Jaume

  • Is anyone aware of an iPad App that uses the screen as a flash for photography?

    While pictures taken outdoors with good lighting are acceptable, less can be said for those taken indoors under artificial light. Does anyone know of an app I can use to augment the room light with that from my screen?

  • DVD ROMS Ejecting after start up.

    System Configuration: CPU:  2.5 Ghz P4 Motherboard: Motherboard- MSI 865PE Neo2-V  (V Class) Chipset 865PE + ICH5 Chipset base RAM: 500 Mb Video Card: ATI Radeon 9200 SE Operating System: Windows XP home edition Nb. Two DVD drives connected master &

  • Where do we find the apache plugin?

    We have a complete 9.2 platform installation and an alsb2.5 installation as well. Docs(http://e-docs.bea.com/wls/docs92/plugins/apache.html) say that the plugins can be found in: WL_HOME/weblogic90/server/plugin However in our installations there is