How to transfer the information in the database into input:Radio

below is the form I use to update the broker data. There is a value of radio that I need to enter in the form. I take the value of the database and fill it into the input item. But only radio, the property of type, is not checked. So I wrote a paragraph in script, that when the update table pops up, the performance of this radio is check. But it didn"t work. Ask what should be done to reflect the type attribute passed in.

addBrokerForm.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<%
      String path = request.getContextPath();
      String basePath = request.getScheme() + "://"
                  + request.getServerName() + ":" + request.getServerPort()
                  + path + "/";
%>
<html>
<head>
<meta charset="UTF-8">
<title>add Broker</title>
</head>
<script>
if(broker.type == "E"){
    document.getElementById("E").checked=true;
}else{
    document.getElementById("J").checked=true;
}
</script>
<body>

    <h1>add broker</h1>

<form name="addBroker"  action="/people/saveBroker" method="post">
    
    <spring:bind path="broker.personId" >
           <input type="hidden" name="${status.expression}" value="${status.value}"><br/>
    </spring:bind>
    
    <spring:bind path="address.personId" >
           <input type="hidden" name="${status.expression}" value="${status.value}"><br/>
    </spring:bind>
    
    <spring:bind path="address.addressId" >
           <input type="hidden" name="${status.expression}" value="${status.value}"><br/>
    </spring:bind>
    
    
    <spring:bind path="broker.code">
        <label>Person Code:</label>
           <input type="text" onblur="validatePersonCode(this.value)" name="${status.expression}" value="${status.value}"><br />
    </spring:bind>
    
    <spring:bind path="broker.firstName">
        <label>First Name:</label>
           <input type="text" onblur="validateFirstName(this.value)" name="${status.expression}" value="${status.value}"><br />
    </spring:bind>
    
    <spring:bind path="broker.lastName">
        <label>Last Name:</label>
           <input type="text" onblur="validateLastName(this.value)" name="${status.expression}" value="${status.value}"><br />
    </spring:bind>
    
    <spring:bind path="broker.type">
        <label>Broker Type:</label>
          <input type="radio" name= "type" id="E" value="E" /> Expert <br />
            <input type="radio" name= "type" id="J" value="J" /> Junior <br />
    </spring:bind>
    
    <spring:bind path="broker.secIdentifier">
        <label>Broker Second Identifier:</label>
           <input type="text" onblur="validateSecIdentifier(this.value)" name="${status.expression}" value="${status.value}"><br />
    </spring:bind>
    
    <spring:bind path="address.street">
        <label>Street:</label>
           <input type="text" onblur="validateStreet(this.value)" name="${status.expression}" value="${status.value}"><br />
    </spring:bind>
    
    <spring:bind path="address.country">
        <label>Country:</label>
           <input type="text" onblur="validateCountry(this.value)" name="${status.expression}" value="${status.value}"><br />
    </spring:bind>
    
    <spring:bind path="address.state">
        <label>State:</label>
           <input type="text" onblur="validateState(this.value)" name="${status.expression}" value="${status.value}"><br />
    </spring:bind>
    
    <input type="submit" value="Save"/>
</form>
         <a href="${pageContext.request.contextPath}/people/broker">Back to List</a>


</body>



<script type="text/javascript" src= "<%=basePath %>js/BrokerValidation.js"></script>
</html>

PersonController

package controller;

import java.util.List;


@Controller
@RequestMapping("/people")
public class PersonController {
    
    
    @Autowired
    private PortfolioService service;

    @PostMapping("/saveBroker")
    public String saveBroker(@ModelAttribute("broker") Broker tempbroker, 
            @ModelAttribute("address") Address tempAddress) {

        service.addBroker(tempbroker, tempAddress);
        
        return "redirect:/people/broker";
    }
    
    @GetMapping("/updateBroker")
    public String updateBroker(Model theModel, @RequestParam("personId") Integer personId) { 
        
        Broker broker = service.getBrokerById(personId);
        Address address = service.getAddressByPid(personId);
        
        theModel.addAttribute("broker", broker);
        theModel.addAttribute("address", address);
        
        return "addBrokerForm";
    }


}

<input type="radio" name= "type" value="E" <c:if test = "${broker.type=='E'}">checked="checked"</c:if> /> Expert <br />
<input type="radio" name= "type" value="J" <c:if test = "${broker.type=='J'}">checked="checked"</c:if> /> Junior <br />
Menu