получить идентификатор из таблицы

0

Мне нужно получить идентификатор из URL-адреса и отобразить его на входе. Когда я пытаюсь получить его на входе, они говорят мне, что они дают мне эту ошибку: "Требуемый параметр Integer" idpatient "отсутствует".

this is my html page and table from where i get the id:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tous les patients</title>
<meta charset="utf-8" content="text/html" X-Content-Type-Options="nosniff" http-equiv="Content-Type" />
<link rel="stylesheet" type="text/css" href="../static/css/bootstrap.min.css" 
th:href="@{/css/bootstrap.min.css}"/>
<link rel="stylesheet" type="text/css" href="../static/css/myStyle.css" 
th:href="@{/css/myStyle.css}"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body ng-app="myApp" ng-controller="ListePatientController">
<div class="container">
<form>
        <label>Mot clé:</label>
        <input type="text" ng-model="motCle"/>
        <Button ng-click="charger()">Chercher un patient</Button>
</form>
</div>
 <div class="container">

<table class="table table-striped">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>Nom</th>
                    <th>Prenom</th>
                    <th>Sexe</th>
                    <th>Date de naissance</th>
                    <th>Nationalité</th>
                    <th>CIN</th>
                    <th>CNE</th>
                    <th>Type de couverture</th>
                    <th>Num° du type de couverture</th>
                    <th>Province</th>
                    <th>Résident</th>
                    <th>Adresse personnelle du patient</th>
                    <th>Adresse parents du patient</th>
                    <th>GSM</th>
                    <th>Adresse électronique</th>
                    <th>Pratiquer un sport</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="p in patients.content">
                    <td>{{p.idPatient}}</td>
                    <td>{{p.nomPatient}}</td>
                    <td>{{p.prenomPatient}}</td>
                    <td>{{p.sexe}}</td>
                    <td>{{p.dateNaiss|date:'dd/MM/yyyy'}}</td>
                    <td>{{p.nationalite}}</td>
                    <td>{{p.cin}}</td>
                    <td>{{p.cne}}</td>
                    <td>{{p.typeCouverture}}</td>
                    <td>{{p.numTypeCouverture}}</td>
                    <td>{{p.province}}</td>
                    <td>{{p.resident}}</td>
                    <td>{{p.adressPerso}}</td>
                    <td>{{p.adressPatient}}</td>
                    <td>{{p.gsmPatient}}</td>
                    <td>{{p.mailPatient}}</td>
                    <td>{{p.pratiquePatient}}</td>
                    <td>
                <a href="inscrireConsultation.html?idpatient={{p.idPatient}}">ajout consult</a>
                </td>
                </tr>
            </tbody>
        </table>
 </div>
 <div class="container">
    <ul class="nav nav-pills">
        <li ng-class="{active:$index==pageCourante}" class="clickable" ng-repeat="p in pages track by $index">
            <a ng-click="gotoPage($index)">{{$index}}</a>
        </li>
    </ul>
 </div>

<script type="text/javascript" src="js/angular.min.js"></script>
<script type="text/javascript" src="js/myApp.js"></script>
</body>
</html>

Это html-страница, когда я должен отображать ее на входе:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Inscription d'une consultation</title>
<meta charset="utf-8" content="text/html" X-Content-Type-Options="nosniff" http-equiv="Content-Type" />
<link rel="stylesheet" type="text/css" href="../static/css/bootstrap.min.css" 
th:href="@{/css/bootstrap.min.css}"/>
<link rel="stylesheet" type="text/css" href="../static/css/myStyle.css" 
th:href="@{/css/myStyle.css}"/>
</head>
<body ng-app="myApp" ng-controller="inscriptionConsultationController">

<div class="col-md-6 col-sm-6 col-xs-12  container">

    <div class="panel panel-success container spacer ">
    <div class="panel-heading"><b><h1>Ajout d'une consultation</h1></b></div>
    <div class="panel-body">

    <div ng-if="mode.value=='form'" >
    <form>
        <div class="form-group">
            <label class="control-label">Date de la consultation:</label>
            <input class="form-control" type="date" ng-model="consultation.dateConsult"/>
            <span ng-if="errors" class="error">{{errors.dateConsultt}}</span>
        </div>
        <div class="form-group">
            <label class="control-label">Type de la consultation:</label>
            <input class="form-control" type="text" ng-model="consultation.typeConsult"/>
            <span ng-if="errors" class="error">{{errors.typeConsult}}</span>
        </div>
        <div class="form-group">
            <label class="control-label">Motif(s):</label>
            <input class="form-control" type="text" ng-model="consultation.motifConsult"/>
            <span ng-if="errors" class="error">{{errors.motifConsult}}</span>
        </div>
        <div class="form-group">
            <label class="control-label">Dignostics:</label>
            <input class="form-control" type="text" ng-model="consultation.diagnostic"/>
            <span ng-if="errors" class="error">{{errors.diagnostic}}</span>
        </div>
        <div class="form-group">
            <label class="control-label">Maladie chronique?</label>
                <div class="radio">
                    <label><input type="radio" name="optradio" ng-model="consultation.maladieChronique">Oui</label>
                </div>
                <div class="radio">
                    <label><input type="radio" name="optradio" ng-model="consultation.maladieChronique">Non</label>
                </div>
            <span ng-if="errors" class="error">{{errors.maladieChronique}}</span>
        </div>
        <div class="form-group">
            <label class="control-label">Décision:</label>
            <input class="form-control" type="text" ng-model="consultation.decision"/>
            <span ng-if="errors" class="error">{{errors.decision}}</span>
        </div>
        <div class="form-group">
            <input type = "number" ng-model="consultation.idPatient" value="idpatient"/>

        </div>  
        <div class="form-group">
            <button  class="btn btn-success" ng-click="saveConsultation()"> Enregistrer</button>
        </div>
    </form>
    </div>
    <div ng-if="mode.value=='confirm'">
      <div class="panel-heading container spacer"><h2>Confirmation: La consultation a été ajoutée avec succès!</h2></div>
        <div class="form-group">
            <label class="control-label">ID:</label>
            <label class="control-label">{{consultation.idConsult}}</label>
        </div>
        <div class="form-group">
            <label class="control-label">Date de la consultation:</label>
            <label class="control-label">{{consultation.dateConsult|date:'yyyy-MM-dd'}}</label>
        </div>
        <div class="form-group">
            <label class="control-label">Type de la consultation:</label>
            <label class="control-label">{{consultation.typeConsult}}</label>
        </div>
        <div class="form-group">
            <label class="control-label">Motif(s):</label>
            <label class="control-label">{{consultation.motifConsult}}</label>
        </div>
        <div class="form-group">
            <label class="control-label">Diagnostics:</label>
            <label class="control-label">{{consultation.diagnostic}}</label>
        </div>
        <div class="form-group">
            <label class="control-label">Maladie chronique?</label>
            <label class="control-label">{{consultation.maladieChronique}}</label>
        </div>
        <div class="form-group">
            <label class="control-label">consultation:</label>
            <label class="control-label">{{consultation.decision}}</label>
        </div>
        <div class="form-group">
            <label class="control-label">id patient:</label>
            <label class="control-label">{{consultation.idPatient}}</label>
        </div>
    </div>
    <div ng-if="exception">
        <span class="error">{{exception.message}}</span>
    </div>
    </div>

 </div>


<script type="text/javascript" src="js/angular.min.js"></script>
<script type="text/javascript" src="js/myApp.js"></script>
</body>
</html>
  • 0
    Как это связано с Java и Java EE?
  • 0
    Я использую веб-сервисы Jee Restful и Angular JS.
Показать ещё 2 комментария
Теги:
spring
spring-mvc

2 ответа

0

Вы не можете использовать его напрямую, вам нужно обмениваться данными для двух контроллеров на уровне обслуживания. См. - AngularJS. Передача данных между страницами для получения дополнительной информации.

0

Это служба Spring, которая получает идентификатор:

@RequestMapping(value="/consultations",method=RequestMethod.POST)
public Object saveConsultation(@RequestParam (value = "idpatient", required = true) String idpatient,
                               @RequestBody @Valid Consultation c,
                               BindingResult bindingResult){

    if(bindingResult.hasErrors()){
        Map<String, Object> errors=new HashMap<>();
        errors.put("errors", true);
        for(FieldError fe: bindingResult.getFieldErrors()){

            errors.put(fe.getField(), fe.getDefaultMessage());
        }
        return errors;
    }       

    return consultationMetier.saveConsultation(idpatient,c,bindingResult);
}

Ещё вопросы

Сообщество Overcoder
Наверх
Меню