0

chunk of code...

public void init(ServletConfig config)
    throws ServletException
	{
		Map map = new HashMap();
	}
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
   [U]map.put("one1","two2");[/U]

compiler says 'map' cannot be resoled......why so?
wht shd i do?

thanks,
BeanBoy

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by beanboy
1

I would suggest that you stop working on this servlet thing and start learning some basic java because this error is very basic and usually done by beginners.

You declare the Map in one method locally and you try to access it from another method.
Declare it globally or declare another Map in "doGet" depending on what you want.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.