Skip to content

Commit af4fc6d

Browse files
Update README.md
1 parent efbb17c commit af4fc6d

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

java/README.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,30 @@ package com.example.demo;
3535

3636
import org.springframework.stereotype.Controller;
3737
import org.springframework.ui.Model;
38+
import org.springframework.web.bind.annotation.GetMapping;
3839
import org.springframework.web.bind.annotation.PostMapping;
3940
import org.springframework.web.bind.annotation.RequestParam;
41+
import org.springframework.web.bind.annotation.ResponseBody;
42+
43+
import WebFormsCore.WebForms;
44+
import WebFormsCore.InputPlace;
4045

4146
@Controller
4247
public class MyController {
4348

49+
@GetMapping("/")
50+
public String PageLoad(Model model) {
51+
return "default"; // This will map to default.html
52+
}
53+
4454
@PostMapping("/")
45-
public String handleFormSubmission(
46-
@RequestParam(name = "txt_Name", required = false) String name,
47-
@RequestParam(name = "txt_BackgroundColor", required = false) String backgroundColor,
48-
@RequestParam(name = "txt_FontSize", required = false, defaultValue = "16") int fontSize,
49-
@RequestParam(name = "btn_SetBodyValue", required = false) String button) {
50-
51-
if (button != null) {
55+
@ResponseBody
56+
public String handleSubmit(@RequestParam("txt_Name") String name,
57+
@RequestParam("txt_BackgroundColor") String backgroundColor,
58+
@RequestParam("txt_FontSize") int fontSize,
59+
@RequestParam("btn_SetBodyValue") String button) {
60+
61+
if (button != null){
5262
WebForms form = new WebForms();
5363

5464
form.setFontSize(InputPlace.tag("form"), fontSize);
@@ -58,8 +68,10 @@ public class MyController {
5868
form.addTag(InputPlace.tag("form"), "h3", null);
5969
form.setText(InputPlace.tag("h3"), "Welcome " + name + "!");
6070

61-
return form.response();
71+
return form.response();
6272
}
73+
74+
return "";
6375
}
6476
}
6577
```
@@ -71,4 +83,4 @@ As you can see, the WebFormsJS script has been added in the header section of th
7183

7284
The latest version of the WebFormsJS script is available through the link below.
7385

74-
https://github.com/elanatframework/Web_forms/blob/elanat_framework/web-forms.js
86+
https://github.com/elanatframework/Web_forms/blob/elanat_framework/web-forms.js

0 commit comments

Comments
 (0)