-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMyController.java
More file actions
40 lines (31 loc) · 999 Bytes
/
MyController.java
File metadata and controls
40 lines (31 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package mypackage;
/**
*
* @author swati
*/
import secondpackage.MyClass;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
@Controller
@RequestMapping("myclass")
public class MyController {
@RequestMapping(value="/login", method = RequestMethod.GET)
public String login(ModelMap mm)
{
mm.put("myclass", new MyClass());
return "login";
}
@RequestMapping(value="/login", method = RequestMethod.POST)
public String login(@ModelAttribute(value="myclass") MyClass myclass, ModelMap mm)
{
if(myclass.getUsername().equals("swati") && myclass.getPassword().equals("swati")){
mm.put("username", myclass.getUsername());
return "success";
}
else{
mm.put("message", "Username or Password is invalid! Please fill correct one!");
return "login";
}
}
}