我试图使用以下表单数据发布数据,但我无法发布并且在数据库中创建了id

时间:2018-01-25 11:57:07

标签: angular post

我正在尝试使用以下表单数据发布数据,但我无法发布并且在数据库中创建了id。无论表单数据,mongoose模式和后端服务是否正确? 我是Angular2的新手,请帮忙。

我已经了解了一些信息。但是我得到了它 * String请求不将POST数据发送到用户数据库 * Restangular POST不传递数据参数 * CRUD POST a JSON

标记

Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - cannot find symbol symbol: class preparedStatment location: class newframe.DataSave 
at newframe.DataSave.<init>(DataSave.java:25) 
at newframe.DataSave$3.run(DataSave.java:253) 
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java‌​:251) 
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:701) 
at java.awt.EventQueue.access$000(EventQueue.java:102) 
at java.awt.EventQueue$3.run(EventQueue.java:662) 
at java.awt.EventQueue$3.run(EventQueue.java:660)
at java.security.AccessController.doPrivileged(Native Method) 
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) 
at java.awt.EventQueue.dispatchEvent(EventQueue.java:671) 
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDis‌​patchThread.java:244‌​)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispat‌​chThread.java:163) 
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDis‌​patchThread.java:151‌​) 
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.‌​java:147) 
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.‌​java:139) 
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97‌​)

mongoose Schema

 <div class="container">
          <h1 class="well">Candidate Registration</h1>
          <div class="col-lg-12 well">
            <div class="row">
              <form #form="ngForm" (ngSubmit)="registerCandidateRegForm(form.value)">

                <div class="col-sm-12">
                  <div class="form-group">
                    <label>NAME</label>
                    <input type="text" placeholder="Enter Name Here.." class="form-control" name="companyName"  ngModel>
                  </div>
                </div>
                <div class="col-sm-12">
                  <div class="form-group">
                    <label>EMAIL</label>
                    <input type="text" placeholder="Enter Email Address Here.." class="form-control" name="officialEmail" 
                      ngModel>
                  </div>
                </div>
                <div class="col-sm-12">
                  <div class="row">
                    <div class="col-sm-6 form-group">
                      <label>PASSWORD</label>
                      <input type="text" placeholder="Enter Password Here.." class="form-control" name="password" ngModel>
                    </div>
                    <div class="col-sm-6 form-group">
                      <label>CONFIRM PASSWORD</label>
                      <input type="text" placeholder="Confirm Password Here.." class="form-control" name="confirmPassword" 
                        ngModel>
                    </div>
                  </div>
                </div>
                <div class="col-sm-12">
                  <div class="form-group">
                    <label>ADDRESS</label>
                    <input type="text" placeholder="Enter Address Here.." class="form-control" name="address" ngModel>
                  </div>
                </div>
                <div class="col-sm-12">
                  <div class="form-group">
                    <label>PHONE NUMBER</label>
                    <input type="text" placeholder="Enter Phone number Here.." class="form-control" name="phonenumber" ngModel>
                  </div>
                </div>
                <div class="col-sm-12">
                  <div class="form-group">
                    <label>EXPERTISE</label>
                    <input type="text" placeholder="Enter Expertise Here.." class="form-control" name="expertise" ngModel>
                  </div>
                </div>
                <div class="col-sm-12">
                  <div class="form-group">
                    <label>CURRENT LOCATION</label>
                    <input type="text" placeholder="Enter Current Location Here.." class="form-control" name="curlocation" ngModel>
                  </div>
                </div>
                <div class="col-sm-12">
                  <div class="form-group">
                    <label>CURRENT CTC</label>
                    <input type="text" placeholder="Enter Current CTC Here.." class="form-control" name="curctc" ngModel>
                  </div>
                </div>
                <div class="col-sm-12">
                  <div class="form-group">
                    <label>NOTICE PERIOD IN DAYS</label>
                    <input type="text" placeholder="Enter Notice period in days Here.." class="form-control" name="curctc" ngModel>
                  </div>
                </div>
                <div class="col-sm-12">
                  <div class="form-group">

                    <div class="row">
                      <label>WORK EXPERIENCE</label>
                      <table class="table table-bordered table-hover table-curved" id="tableAddRow">
                        <thead>
                          <tr>
                            <th>Designation</th>
                            <th>Employer Name</th>
                            <th>Date of Joining</th>
                            <th>Date of Leaving</th>
                            <th>Key Skills</th>
                            <th style="width:10px"><span class="glyphicon glyphicon-plus addBtn" (click)="addRow()" class="btn btn-info" id="addBtn_0">+</span></th>
                          </tr>
                        </thead>
                        <tbody>
                          <tr *ngFor='let row of rowData; let i = index'>
                            <td><input type="text" placeholder="Enter designation" class="form-control" name="desig" ngModel /></td>
                            <td><input type="text" placeholder="Enter employer name"  class="form-control" name="emplrname" ngModel /></td>
                            <td><input type="text" placeholder="Enter date of joining"  class="form-control" name="datofjoin" ngModel /></td>
                            <td><input type="text" placeholder="Enter date of leaving"  class="form-control" name="datofleav" ngModel /></td>
                            <td><input type="text" placeholder="Enter key skills"  class="form-control" name="keyskil" ngModel /></td>
                            <td><span class="glyphicon glyphicon-minus addBtnRemove" (click)="deleteRow(i)" class="btn btn-danger" id="addBtnRemove_0">-</span></td>
                          </tr>
                        </tbody>
                      </table>
                    </div>

                  </div>
                </div>

                <div class="col-sm-12">
                  <div class="form-group">

                    <div class="row">
                      <label>EDUCATION</label>
                      <h4 class="title">UG Qualification</h4>
                      <table class="table table-bordered table-hover table-curved" id="tableAddRow">
                        <thead>
                          <tr>
                            <th>Type</th>
                            <th>Specialization</th>
                            <th>Year of Passing</th>
                            <th>University</th>
                          </tr>
                        </thead>
                        <tbody>
                          <tr>
                            <td><input type="text" placeholder="Enter Type"  class="form-control" name="ugtype" ngModel/></td>
                            <td><input type="text" placeholder="Enter Specialization"  class="form-control" name="ugspl" ngModel/></td>
                            <td><input type="text" placeholder="Enter Year of Passing"  class="form-control" name="yearofpass" ngModel/></td>
                            <td><input type="text" placeholder="Enter University"  class="form-control" name="uguniversity" ngModel/></td>
                          </tr>
                        </tbody>
                      </table>
                    </div>

                  </div>
                </div>

                <div class="col-sm-12">
                  <div class="form-group">

                    <div class="row">

                      <h4 class="title">PG Qualification</h4>
                      <table class="table table-bordered table-hover table-curved" id="tableAddRow">
                        <thead>
                          <tr>
                            <th>Type</th>
                            <th>Specialization</th>
                            <th>Year of Passing</th>
                            <th>University</th>
                          </tr>
                        </thead>
                        <tbody>
                          <tr>
                            <td><input type="text" placeholder="Enter Type" class="form-control" name="pgtype" ngModel /></td>
                            <td><input type="text" placeholder="Enter Specialization"  class="form-control" name="pgspl" ngModel /></td>
                            <td><input type="text" placeholder="Enter Year of Passing" class="form-control" name="yearofpass" ngModel /></td>
                            <td><input type="text" placeholder="Enter University" class="form-control" name="pguniversity" ngModel /></td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </div>
                </div>
                <div class="col-sm-12">
                  <div class="form-group">

                    <div class="row">

                      <h4 class="title">Doctorate</h4>
                      <table class="table table-bordered table-hover table-curved" id="tableAddRow">
                        <thead>
                          <tr>
                            <th>Specialization</th>
                            <th>Year of Passing</th>
                            <th>University</th>
                          </tr>
                        </thead>
                        <tbody>
                          <tr>
                            <td><input type="text" placeholder="Enter Specialization" class="form-control" name="doctspl" ngModel/></td>
                            <td><input type="text" placeholder="Enter Year of Passing" class="form-control" name="doctyrpass" ngModel/></td>
                            <td><input type="text" placeholder="Enter University" class="form-control" name="doctuniversity" ngModel /></td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </div>
                </div>

                <div class="col-sm-12">
                  <input type="checkbox" name="Terms" value="Term">I agree to<br><br>
                </div>
                <div class="col-sm-12">
                  <button type="submit" class="btn btn-lg btn-info">Register</button>
                  <button type="button" class="btn btn-lg btn-info" (click)="clearCandidateRegForm(form)">Clear</button>
                </div>


              </form>
            </div>
          </div>
        </div>

客户端模型

        const candidateloginSchema = new Schema({

            name:String
            ,candidate_email:String
            ,candidate_password:String
            ,candidate_confirm_password:String
            ,candidate_address:String
            ,candidate_phone_number:String
            ,candidate_expertise:String
            ,candidate_current_location:String
            ,candidate_current_ctc:String
            ,candidate_notice_period:String
            ,workExperience:[new Schema ({                      
                                candidate_designation:String
                                ,candidate_employer_name:String
                                ,candidate_date_of_joining:String
                                ,candidate_date_of_leaving:String
                                ,candidate_key_skills:String
                            })
                            ]
            ,ug_type:String
            ,ug_specialization:String
            ,ug_year_of_passing:String
            ,ug_university:String
            ,pg_type:String
            ,pg_specialization:String
            ,pg_year_of_passing:String
            ,pg_university:String
            ,doct_specialization:String
            ,doct_year_of_passing:String
            ,doct_university:String

        });

Service.ts

        export class CandidateRegForm{
            _id:string;
            name:string;
            candidate_email:string;
            candidate_password:string;
            candidate_confirm_password:string;
            candidate_address:string;
            candidate_phone_number:string;
            candidate_expertise:string;
            candidate_current_location:string;
            candidate_current_ctc:string;
            candidate_notice_period:string;
            workExperience:[{}];
            ug_type:string;
            ug_specialization:string;
            ug_year_of_passing:string;
            ug_university:string;
            pg_type:string;
            pg_specialization:string;
            pg_year_of_passing:string;
            pg_university:string;
            doct_specialization:string;
            doct_year_of_passing:string;
            doct_university:string;
        }

0 个答案:

没有答案