idea中dubbo的使用
package com.lxy.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import com.lxy.entity.Clazz;
import com.lxy.entity.Teacher;
import com.lxy.service.ClazzService;
import com.lxy.utils.FilesUtils;
import com.lxy.utils.MD5;
@Controller
@RequestMapping("/clazz/")
public class ClazzController {
@Autowired
private ClazzService clazzService;
@RequestMapping("toGetClazzList")
public String toGetClazzList(){
return "/welcome";
}
@RequestMapping("home")
public String home(){
return "home";
}
/**
* 显示列表
*/
@RequestMapping("getClazzList")
public ModelAndView getClazzList(){
List<Clazz> clazzList = clazzService.getClazzList();
ModelAndView mv = new ModelAndView();
mv.setViewName("clazz/clazz_list");
mv.addObject("clazzList", clazzList);
return mv;
}
/**
* 删除
*/
@RequestMapping("deleteClazz")
@ResponseBody
public ModelMap deleteClazz(Integer classId){
int result = clazzService.deleteClazz(classId);
ModelMap mm = new ModelMap();
if(result==1){
mm.addAttribute("result", result);
}
return mm;
}
/**
* 批量删除
* @param ids
* @return
*/
@RequestMapping("deleClazzAll")
@ResponseBody
public boolean deleClazzAll(String ids){
clazzService.deleClazzAll(ids);
return true;
}
/**
* 跳转至讲师页面
*/
@RequestMapping("toTeacher")
public String toTeacher(Integer classId, HttpServletRequest request){
List<Teacher> teacherList = clazzService.getTeacherList();
request.setAttribute("teacherList", teacherList);
request.setAttribute("classId", classId);
return "clazz/teacher_list";
}
/**
* 选择讲师
*/
@RequestMapping("updateTeacher")
@ResponseBody
public int updateTeacher(Integer classId,Integer teachId,HttpServletRequest request){
int i = 0;
//
int classCount = clazzService.getClassCount(classId);
if(classCount==1){
i = 1;
}else if(classCount==2){
i = 2;
}else{
clazzService.updateTeacher(classId,teachId);
i = 3;
}
return i;
}
@RequestMapping("updateTeacher2")
@ResponseBody
public int updateTeacher2(Integer classId,Integer teachId,HttpServletRequest request){
int i = 0;
try {
clazzService.updateTeacher(classId,teachId);
i = 1;
} catch (Exception e) {
e.printStackTrace();
}
return i;
}
/**
* 跳转至班级列表
* @param request
* @return
*/
@RequestMapping("toClassList")
public String toClassList( HttpServletRequest request){
String redirectUrl = "admin/user/getClazzList";
request.setAttribute("redirectUrl", redirectUrl);
return "closeLayer";
}
/**
* 跳转至修改页面
*/
/*@RequestMapping("toUpdateClazz")
public String toUpdateClazz(Integer clazzId,HttpServletRequest request){
return "/user/user_update";
}*/
}

初学,搞不懂
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import com.lxy.entity.Clazz;
import com.lxy.entity.Teacher;
import com.lxy.service.ClazzService;
import com.lxy.utils.FilesUtils;
import com.lxy.utils.MD5;
@Controller
@RequestMapping("/clazz/")
public class ClazzController {
@Autowired
private ClazzService clazzService;
@RequestMapping("toGetClazzList")
public String toGetClazzList(){
return "/welcome";
}
@RequestMapping("home")
public String home(){
return "home";
}
/**
* 显示列表
*/
@RequestMapping("getClazzList")
public ModelAndView getClazzList(){
List<Clazz> clazzList = clazzService.getClazzList();
ModelAndView mv = new ModelAndView();
mv.setViewName("clazz/clazz_list");
mv.addObject("clazzList", clazzList);
return mv;
}
/**
* 删除
*/
@RequestMapping("deleteClazz")
@ResponseBody
public ModelMap deleteClazz(Integer classId){
int result = clazzService.deleteClazz(classId);
ModelMap mm = new ModelMap();
if(result==1){
mm.addAttribute("result", result);
}
return mm;
}
/**
* 批量删除
* @param ids
* @return
*/
@RequestMapping("deleClazzAll")
@ResponseBody
public boolean deleClazzAll(String ids){
clazzService.deleClazzAll(ids);
return true;
}
/**
* 跳转至讲师页面
*/
@RequestMapping("toTeacher")
public String toTeacher(Integer classId, HttpServletRequest request){
List<Teacher> teacherList = clazzService.getTeacherList();
request.setAttribute("teacherList", teacherList);
request.setAttribute("classId", classId);
return "clazz/teacher_list";
}
/**
* 选择讲师
*/
@RequestMapping("updateTeacher")
@ResponseBody
public int updateTeacher(Integer classId,Integer teachId,HttpServletRequest request){
int i = 0;
//
int classCount = clazzService.getClassCount(classId);
if(classCount==1){
i = 1;
}else if(classCount==2){
i = 2;
}else{
clazzService.updateTeacher(classId,teachId);
i = 3;
}
return i;
}
@RequestMapping("updateTeacher2")
@ResponseBody
public int updateTeacher2(Integer classId,Integer teachId,HttpServletRequest request){
int i = 0;
try {
clazzService.updateTeacher(classId,teachId);
i = 1;
} catch (Exception e) {
e.printStackTrace();
}
return i;
}
/**
* 跳转至班级列表
* @param request
* @return
*/
@RequestMapping("toClassList")
public String toClassList( HttpServletRequest request){
String redirectUrl = "admin/user/getClazzList";
request.setAttribute("redirectUrl", redirectUrl);
return "closeLayer";
}
/**
* 跳转至修改页面
*/
/*@RequestMapping("toUpdateClazz")
public String toUpdateClazz(Integer clazzId,HttpServletRequest request){
return "/user/user_update";
}*/
}

初学,搞不懂
...全文
相关推荐
idea创建springboot,集成使用dubbo、zookeeper
idea创建使用springboot项目,zookeeper做注册,使用dubbo分布部署实现接口的远程调用
IntelliJ IDEA下的Dubbo服务开发实战演示
Apache Dubbo是一款高性能的Java RPC框架,旨在提供一种优雅、高效的远程服务调用方案。为了深入理解Dubbo的工作原理,必须先了解其基本架构。Dubbo采用基于接口的远程调用模式,允许开发者像调用本地方法一样调用远程服务。服务提供者(Provider)和消费者(Consumer): 在Dubbo框架中,服务提供者是暴露远程服务的服务器端应用,而消费者是调用远程服务的客户端应用。这两个角色通过网络进行通信。注册中心(Registry)
idea+springboot+dubbo的两个demo
通过idea新建了两个项目的demo,使用的技术有dubbo,和zookeeper和dubbo
maven项目框架+dubbo idea开发
maven项目框架+dubbo idea开发。。
idea maven聚合项目 spring-boot 整合 dubbo
最新dubbo入门demo,


IBM云计算
