I have开发者_开发知识库 two java files named Admin.java and Search.java in the same folder. I need to call the Search doGet Method. How do I do it?
I need to invoke
protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
present in the Search.java file.
Depends on the Search-ctor, and whether you have request/response objects already.
Search search = new Search (/*...*/);
search.doGet (request, response);
Technically spoken,
- create an instance of Search
- call the doGet()method on that instance
But we usually don't call doGet directly, so I'm strongy in doubt, if that's what you really want...
// in some method in Admin.java
Search search = new Search();
try {
   search.doGet(someRequest, someResponse);
} catch (ServletException e) {
   // TODO handle exception
} catch (IOException e) {
   // TODO handle exception
}
Since your Search.java looks like a Servlet, you'd have to invoke it by hitting a URL mapped to this Servlet. See more here
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论