aspose file tools*
The moose likes Servlets and the fly likes Method call with Parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Method call with Parameter" Watch "Method call with Parameter" New topic
Author

Method call with Parameter

Mike Jenkins
Ranch Hand

Joined: Jul 23, 2006
Posts: 57
I have several RequestDispatcher references in a Servlet and would like to condense them using a method:

Current in my Servlet:


My attempt to use a method with 1 parameter gives me errors about invalid variables:


Please advise.
[ July 02, 2007: Message edited by: Mike Jenkins ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61756
    
  67

gives me errors about invalid variables:


Details please.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
arulk pillai
Author
Ranch Hand

Joined: May 31, 2007
Posts: 3274
I think your req, resp variables are local and your method needs to take it as an argument. Your doPost() or doGet() method has the reference to req, resp. If that is not the case please provide more details like compile time or run time error and error details.


500+ Java Interview Questions and Answers | Java job hunting know how & Java resumes
Sudhakar Kalk
Greenhorn

Joined: Jul 02, 2007
Posts: 3
Please provide the error statements generated.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"Sudhakar",
Welcome to JavaRanch!

We're pleased to have you here with us here on the ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious. You can change it here


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410


How is this method getting a reference to the request and response objects?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Method call with Parameter