ssm

package com.springmvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.net.URL;
\\url传值
@Controller
public class IndexController {
    @RequestMapping(value = "/test1",method = RequestMethod.GET)
    public String testController(@RequestParam int a,Model model) {
        int pa = a;
        model.addAttribute("a",pa);
        return "test1";
    }
}

//测试表单传值
    @RequestMapping(value = "/test2",method = RequestMethod.POST)
    public String test2Controller(@RequestParam String username,@RequestParam String studentnumber,Model model) {
        String name = username;
        String number = studentnumber;
        model.addAttribute("name",name);
        model.addAttribute("number",number);
        return "test1";
    }

费好大力气终于运行成功了
几个配置文件:

//jdbc.properties
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/ssm?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
jdbc.username=root
jdbc.password=密码
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容