Closed Prasad108 closed 6 years ago
tag @rahulnagure
check the issue and do it ASPA
for any help please free to contact
hi @rahulnagure check changeTUsername method in teacher controller for reference
Hi @rahulnagure any update on change username or sms module ?
U can send the data from angular $http to the MVC controller
NOTE: request data shuld be in JSON : eg. {"customerInfo":{"firstname":"xyz","lastname":"XYZ"}}
@RequestMapping(value = "/send", headers = "Accept=application/json", method = RequestMethod.POST)
public void sendEmails(@RequestBody HashMap<String, HashMap<String, String>> requestData) {
HashMap<String, String> customerInfo = requestData.get("customerInfo");
String firstname = customerInfo.get("firstname");
String lastname = customerInfo.get("lastname");
//TODO now do whatever you want to do.
}
@AbhishekPatwaCSE @rahulnagure
angular js function will be something like this
$scope.changeUsername=function(){
var sendData ={}
sendData.currentUsername=$scope.CurrentUserName;
sendData.NewUsername=$scope.NewUserName;
$http(
{
url : "YOUR_URL",
contentType : 'application/json; charset=utf-8',
dataType : 'json',
method : "POST",
data : sendData,
}).then(function successCallback(response) {
//success callback
}, function errorCallback(response) {
// failure callback
});
}
and JAVA controller method will be like this
@RequestMapping(value = "/YOUR_URL", headers = "Accept=application/json", method = RequestMethod.POST)
public void sendEmails(@RequestBody HashMap< HashMap<String, String> requestData) {
HashMap<String, String> customerInfo = requestData.get("customerInfo");
String currentUsername = requestData.get("currentUsername");
String lastname = requestData.get("NewUsername");
//TODO now do whatever you want to do.
}
check it out @AbhishekPatwaCSE
hi @AbhishekPatwaCSE
u can get the response of the request in the request object
u can get the status in response.data is the object u sent from controller
u can get its status like response.data.status
if there status is failed then u should show the error message to the user
for success use like this
<div class="alert alert-info fade in" ng-show="ExamCreateSuccess">
<button data-dismiss="alert" class="close close-sm" type="button">
<i class="icon-remove"></i>
</button>
<strong>Exam Added Successfully</strong>
</div>
for error
<div class="alert alert-block alert-danger fade in " for="inputSuccess" ng-show="ExamCreateError">
<button data-dismiss="alert" class="close close-sm" type="button">
<i class="icon-remove"></i>
</button>
<strong>Error in saving Exam</strong>
</div>
check for ng-show
variables u have to change there binary value in order to show or hide
Hi @Prasad108
Teachers are able to Update the username successfully. Error message is also Display when username is not available in databases or current name and username is same.
Hi @AbhishekPatwaCSE
Good Work You have correctly implemented the RestService in Controller.
however please pay attention to following point
overall great work, u r learning quickly
Minimum eight characters, at least one uppercase letter, one lowercase letter, one number and one special character:
"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])[A-Za-z\d$@$!%*?&]{8,}"
tag : @AbhishekPatwaCSE
check the current username in db
else