BEA Logo BEA WebLogic Server Release 6.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

   BEA WebLogic Server Frequently Asked Questions:   Previous topic   |   Next topic   |   Contents   

 

FAQs: Server-Side Java (Servlets)

 


How do I call a servlet with parameters in the URL?

The usual format of a servlet parameter is a name=value pair that comes after a question-mark (?) at the end of the URL. To access these parameters, call the getParameter() method on the HttpServletRequest object, then write code to test the strings. For example, if your URL parameters are "func=topic," where your URL appears as:

  http://www.myserver.com/myservlet?func=topic

then you could parse the parameter as follows, where "req" is the HttpServletRequest object:

  String func = req.getParameter("func");
if (func.equalsIgnoreCase("topic")) {
. . . do some work
}