关于转发的问题
设想如下:
1)设立一个简单的web页面,得到用户的输入
2)将用户的输入发送到其他搜索引擎,如http://www.google.cn/search
3)得到其他搜索引擎(如google)传来的数据,并再次排列
关于第二步的代码如下(有错):
class DemoAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { DemoForm demoForm = (DemoForm) form;// TODO Auto-generated method stub System.out.println("out:"+demoForm.getParam()); //** RequestDispatcher requestDispatcher=request.getRequestDispatcher("http://www.google.cn/search"); try { [color=#FF0000]//试图转发到http://www.google.cn/search,但出错[/color] requestDispatcher.forward(request, response); } catch (ServletException e) { e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }