I am extracting single employee to create employee dashboard page using @RequestParam annotation. I am able to get object data and able to log it and able to pass it to html page, but when view is called it is unable to render any styling. All content displays as plain html text.
Below is my model
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
public class Employee {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String firstname;
private String middlename;
private String lastname;
private String familyname;
private String nationalityid;
private String gender;
private String fatherfirstname;
private String fatherlastname;
@ManyToOne
@JoinColumn(name="jobtitleid", insertable=false, updatable=false)
private JobTitle jobtitle;
private Integer jobtitleid;
@ManyToOne
@JoinColumn(name="departmentid", insertable=false, updatable=false)
private Department department;
private Integer departmentid;
private String familyStatus;
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date hireDate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date dateofbirth;
private String address;
}
This is method which is passing single employee data to view employee**
@RequestMapping(value="/employees/getEmployeeById", method= {RequestMethod.GET})
public String getEmpById(@RequestParam Integer id, Model model) {
Employee employee = employeeService.findById(id).get();
model.addAttribute(employee);
System.out.println(employee);
return "employee";
}
Data is getting displayed in view page ("employee")
Also it is being displayed in log but when the link http://localhost:8080/employees/getEmployeeById/?id=1 navigates to view no styling works. Bootstrap also does not work. I am display data as plain html but styling doesn't work.