• 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

i can't understand this sentence ~~please help me,thanks

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class toServlet1 extends HttpServlet{
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws IOException,ServletException{
try{
<font color="red">this.getServletConfig().getServletContext().
getRequestDispatcher("/x1.jsp").forward(req,res);</font>
}catch(Exception e){
e.printStackTrace();
}
}
}
//i can' understand this sentence:
this.getServletConfig().getServletContext().
getRequestDispatcher("/x1.jsp").forward(req,res);
//please explain i ,thanks
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your servlet inherits the getServletConfig() method from GenericServlet. This statement gets the ServletConfig object for this instance and calls getServletContext() to get the ServletContext object - that is the context that all servlets in your application operate under.
Finally the getRequestDispatcher method of ServletContext is called to get the associated RequestDispatcher. RequestDispatcher has a forward method which is called.
Bill
 
Tu Ran
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
William Brogden
Thanks for your answer
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic