@RequestMapping(value="/selectNode")
public ModelAndView selectNode(HttpServletRequest request,HttpServletResponse reponse) throws Exception
{
String t=request.getParameter("id");
int id=Integer.parseInt(t);
AbstractApplicationContext context=new ClassPathXmlApplicationContext("MyBatis-Spring.xml");
NodeserviceDao nodeservice =(NodeserviceDao)context.getBean("nodeserviceimpl");
Node nodes= nodeservice.selectNode(id);
String x=String.valueOf(nodes.getPort1()) ;
String y=String.valueOf(nodes.getPort2()) ;
Map<String,Object> result=new HashMap<String, Object>();
result.put("Port1", x);
result.put("Port2", y);
return new ModelAndView(StringUtils.EMPTY,StringUtils.EMPTY,result);
}
服务端的代码是这样的 我想在客户端读到“Port1,Port2”这2个值
该怎么读SpringMVC
public ModelAndView selectNode(HttpServletRequest request,HttpServletResponse reponse) throws Exception
{
String t=request.getParameter("id");
int id=Integer.parseInt(t);
AbstractApplicationContext context=new ClassPathXmlApplicationContext("MyBatis-Spring.xml");
NodeserviceDao nodeservice =(NodeserviceDao)context.getBean("nodeserviceimpl");
Node nodes= nodeservice.selectNode(id);
String x=String.valueOf(nodes.getPort1()) ;
String y=String.valueOf(nodes.getPort2()) ;
Map<String,Object> result=new HashMap<String, Object>();
result.put("Port1", x);
result.put("Port2", y);
return new ModelAndView(StringUtils.EMPTY,StringUtils.EMPTY,result);
}
服务端的代码是这样的 我想在客户端读到“Port1,Port2”这2个值
该怎么读SpringMVC
解决方案 »
- jsp中table数据插入SQL的问题!!!急急急!!
- 部门老大让我用研究一下jsp,说下一步要用,来请教一下如何着手准备呀!~~
- Servlet显示客户的区域信息(包括语言和国家)
- 生成静态页面
- 结果集中可以嵌套么?
- 这种效果怎么做
- 请问大侠编译错误: Error #: 300 : method handlePageException(java.lang.Throwable) not found in class javax.servlet.jsp.PageContex
- 一个最简单的JSP usebean的例子,调试有错误,大家帮忙看看啊!
- 我做了一个Applet但运行结果不对,请指教
- Hibernate设计----one2one
- 求思路。
- jquery新手,求指教
就是说我在java项目中通过http请求给服务器 服务器返回数据我要怎么拿出来
@ResponseBody
public String selectNode(HttpServletRequest request,HttpServletResponse reponse) throws Exception
{
String t=request.getParameter("id");
int id=Integer.parseInt(t);
AbstractApplicationContext context=new ClassPathXmlApplicationContext("MyBatis-Spring.xml");
NodeserviceDao nodeservice =(NodeserviceDao)context.getBean("nodeserviceimpl");
Node nodes= nodeservice.selectNode(id);
String x=String.valueOf(nodes.getPort1()) ;
String y=String.valueOf(nodes.getPort2()) ;
Map<String,Object> result=new HashMap<String, Object>();
result.put("Port1", x);
result.put("Port2", y);
return result.toString();
}
要取springmvc里面的结果,弄个webservice啊 返回字符串
java 直接 肯定得不到这个ModelAndView对象的