我的应用程序中有两个控制器; 一个是userController,我添加,删除和更新方法; 另一个是studentController,我也有添加,删除和更新方法.
在我的方法中,所有映射都使用@RequestMapping两个控制器中的注释相同.我有一个困惑:如果我们从JSP传递相同的操作,那么Dispatcher将如何找到相应的控制器?如果有人能用这个例子来描述这个,我们将不胜感激.
在eclipse中编译我的DocumentManager应用程序时遇到问题.它没有得到Hibernate.createBlob(file.getInputStream())方法并且给出了"Hibernate类型的方法createBlob(InputStream)未定义".我正在使用Spring 3和Hibernate 4与Maven.请给我一些解决方案.代码如下......谢谢
package com.ecom.data.access.controller;
import java.io.IOException;
import java.io.OutputStream;
import java.sql.Blob;
import java.sql.SQLException;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.ecom.data.access.dao.DocumentDAO;
import com.ecom.data.access.model.Document;
import org.apache.commons.io.IOUtils;
import org.hibernate.Hibernate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
@Controller
public class DocumentController {
@Autowired
private DocumentDAO documentDao;
@RequestMapping("/index")
public String index(Map<String, Object> map) {
try {
map.put("document", new Document());
map.put("documentList", documentDao.list());
}catch(Exception e) {
e.printStackTrace();
}
return "documents";
}
@RequestMapping(value = "/save", method = RequestMethod.POST)
public String …Run Code Online (Sandbox Code Playgroud)