text
stringclasses
6 values
<s>[INST] Convert the following Struts action to Spring Boot controller. <action path="/login" type="com.example.LoginAction" scope="request" validate="false"> <forward name="success" path="/welcome.jsp" /> <forward name="failure" path="/login.jsp" /> </action> [/INST] @RestController @RequestMapping("/login") public class LoginController { @PostMapping public String login() { // login logic return "welcome"; } @GetMapping public String loginForm() { return "login"; } } </s>
<s>[INST] Convert the following Struts form bean to Spring Boot entity. <form-bean name="userForm" type="com.example.UserForm" /> [/INST] @Entity public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String username; private String password; // getters and setters } </s>
<s>[INST] Convert the following Struts action to Spring Boot controller. <action path="/register" type="com.example.RegisterAction" scope="request" validate="true"> <forward name="success" path="/welcome.jsp" /> <forward name="failure" path="/register.jsp" /> </action> [/INST] @RestController @RequestMapping("/register") public class RegisterController { @PostMapping public String register() { // registration logic return "welcome"; } @GetMapping public String registerForm() { return "register"; } } </s>
<s>[INST] Convert the following Struts validation to Spring Boot validation. <form-bean name="loginForm" type="com.example.LoginForm" /> <validator name="required" classname="org.apache.struts.validator.FieldChecks" method="validateRequired" /> <field property="username" depends="required" /> [/INST] @Entity public class LoginForm { @NotEmpty private String username; private String password; // getters and setters } </s>
<s>[INST] Convert the following Struts action to Spring Boot controller. <action path="/updateProfile" type="com.example.UpdateProfileAction" scope="session" validate="true"> <forward name="success" path="/profile.jsp" /> <forward name="failure" path="/editProfile.jsp" /> </action> [/INST] @RestController @RequestMapping("/updateProfile") public class UpdateProfileController { @PostMapping public String updateProfile() { // update profile logic return "profile"; } @GetMapping public String editProfileForm() { return "editProfile"; } } </s>
<s>[INST] Convert the following Struts form bean to Spring Boot DTO. <form-bean name="productForm" type="com.example.ProductForm" /> [/INST] public class ProductDTO { private String name; private BigDecimal price; private String description; // getters and setters } </s>