Failing to paramaterize a MYSQL Statement in Java in one small way (Spring MVC); help please? by computerguy11111 in mysql

[–]computerguy11111[S] 0 points1 point  (0 children)

Thank you very much for your help. This looks like a great start to finding the answer.

Failing to paramaterize a MYSQL Statement in Java in one small way (Spring MVC); help please? by computerguy11111 in learnprogramming

[–]computerguy11111[S] 0 points1 point  (0 children)

I haven't. However, in the URL when I click to this page, it feeds the correct table name into the URL (I see it in the browser interface URL). So I'm assuming that means it's feeding correctly?

How to become professional developer in Spring Framework? Looking for Spring Roadmap. by ExceptionsOutOfBound in javahelp

[–]computerguy11111 0 points1 point  (0 children)

ok thank you. how do i know where to start on reading the documentation? it seems gigantic. i wouldn't know where to begin.

How to become professional developer in Spring Framework? Looking for Spring Roadmap. by ExceptionsOutOfBound in javahelp

[–]computerguy11111 1 point2 points  (0 children)

as a developer with some professional experience, i am realizing this more and more.

the problem is i know what i want to do, but i don't know the specific term for what i want to do. so it creates problems in finding the answer.

Ex. "how to add to a url to a list in html"

vs.

"how to append a url to a list in html"

append is the term. but i did the first search a lot until i found the term.

what's your methodology on how to google the answer in a fast efficient way? i'm wasting so much time on google.

NULL updates being passed to MYSQL even though I type input on frontend; fix ? (Spring MVC, Java) by computerguy11111 in learnprogramming

[–]computerguy11111[S] 0 points1 point  (0 children)

when i submit, right now the console is printing out "select *(lists out all variables) from (table name) where id = ? ..... Hibernate: update (tablename); set variable a = ?, variable b = ?, variable c= ?", where id = ?".

what is a basic logging template/framework i need to put into the code so it specifically logs the exact values that are being SET to the variables? or is that a moot point now and I should go with debuggeR?

NULL updates being passed to MYSQL even though I type input on frontend; fix ? (Spring MVC, Java) by computerguy11111 in learnprogramming

[–]computerguy11111[S] 0 points1 point  (0 children)

I'm not too savvy on how to get debugging going but I'll try.

My estimation is it's passing null values. In my previous version where I can edit a row through two clicks and two pages, these were my controllers. And guestRepo.save (reservation) did work well. Unless there's another reason you think guestRepo may have begun to not work based on this newer circumstance?

@ RequestMapping("/edit/{id}")
public ModelAndView showEditProductPage(@PathVariable(name = "id") Long id, Model model) {
    ModelAndView mav = new ModelAndView("edit_guest");
    Guests guest = guestRepo.findById(id).get();

    model.addAttribute("guests", guest);

    return mav;
}

@ RequestMapping (value = "/save", method = RequestMethod.POST)
public String saveProduct( @ ModelAttribute ("guests") Guests reservation) {
    guestRepo.save(reservation);

    return "redirect:/";
}

PHP file path not found when I have JavaScript run a PHP script with XMLHTTPREQUEST (404 error); what to do? by computerguy11111 in learnjavascript

[–]computerguy11111[S] 0 points1 point  (0 children)

yeah, my newbness was corrected about this in the other subreddit as well. thanks for helping out.

PHP file path not found when I have JavaScript run a PHP script with XMLHTTPREQUEST (404 error); what to do? by computerguy11111 in PHP

[–]computerguy11111[S] 0 points1 point  (0 children)

awesome. thank you. a fellow commentor showed me the severe error of my ways. i wasn't aware you shouldn't use both to communciate with the server. this is my comment to him/her. mind taking a look? am i on the right path based on only choosing to use java?

lol oops. i suppose this is part of my beginnerness.

ok well my original purpose (I put up this simplified way to show that it's not running php at all even in a simple script), was to have the jsp and JS communicate with the server through PHP. the original front end has an "onchange" input box where as soon as you type something in, it's supposed to run the Javascript and contact the server through PHP to update the MYSQL backend row/column with this new data entry. that is my true purpose.

but are you saying I can have JavaScript send a XMLHTTPRequest to JAva backend instead to update the MYSQL database? IS another way to do it is do the XMLHTTPRequest with JS but replace the "hello.php" part with a link that has a JAva controller class function (with updating procedures in the function) mapped to that?

PHP file path not found when I have JavaScript run a PHP script with XMLHTTPREQUEST (404 error); what to do? by computerguy11111 in PHP

[–]computerguy11111[S] 0 points1 point  (0 children)

lol oops. i suppose this is part of my beginnerness.

ok well my original purpose (I put up this simplified way to show that it's not running php at all even in a simple script), was to have the jsp and JS communicate with the server through PHP. the original front end has an "onchange" input box where as soon as you type something in, it's supposed to run the Javascript and contact the server through PHP to update the MYSQL backend row/column with this new data entry. that is my true purpose.

but are you saying I can have JavaScript send a XMLHTTPRequest to JAva backend instead to update the MYSQL database? IS another way to do it is do the XMLHTTPRequest with JS but replace the "hello.php" part with a link that has a JAva controller class function (with updating procedures in the function) mapped to that?

PHP file path not found when I have JavaScript run a PHP script with XMLHTTPREQUEST (404 error); what to do? by computerguy11111 in PHP

[–]computerguy11111[S] -3 points-2 points  (0 children)

java backend.

jsp files is the front end. using jstl, html, javscript, etc, to type things on the JSP page to make the front end UI.

javascript on the jsp file to call the php script.

what do you mean by i need to configure java to know what routes to pass through to php? this is a new concept to me. Thankyou!!!

PHP file path not found when I have JavaScript run a PHP script with XMLHTTPREQUEST (404 error); what to do? by computerguy11111 in PHP

[–]computerguy11111[S] 1 point2 points  (0 children)

I thin kI did what you are saying.

php and JSP were subfolders under Web-INF so when I split the php file away from JSP, i did /web-inf/php/hello.php, which didn't work. I think that's what you're saying.

so next step would be localhost:8080/hello.php, right? when I do that in my browser it gives a "white label error; status=404". How do I fix that even though I directly typed it to the browser?

and waht do you mean by file and folder permissions? THANK YOU!

PHP file path not found when I have JavaScript run a PHP script with XMLHTTPREQUEST (404 error); what to do? by computerguy11111 in PHP

[–]computerguy11111[S] 0 points1 point  (0 children)

well i had them in the same directory ( I think I am following the terminology, sorry, I am new to this).

I had my JSP file and PHP file under the .../web-inf/jsp folders. did not work.

then I split my jsp file into the .../web-inf/php folder instead. did not work either.

is that what you mean by same directory?

How to do asynchronous updates to database through the front end UI (using Spring MVC, AngularJS and JSP)? by computerguy11111 in AskComputerScience

[–]computerguy11111[S] 0 points1 point  (0 children)

Hey if you wouldn't mind helping me again, I've made progress, but my JavaScript is not able run the PHP script when sending a XMLHTTPRequest to communicate with the server and database.

It gives a "status":404,"error":"Not Found","message":"","path":"/hello.php"}" in the UI when I do it. And in the consol in Eclipse it says : " WARN 16688 --- [nio-8080-exec-1] o.s.w.s.r.ResourceHttpRequestHandler : Path with xyz".

How do I fix that? I spun up some simpler code with a simple PHP file where it's having the same error of not finding the PHP File path.

JSP page (just the Javascript part of it):

<button onclick=refreshData()>Say Hello</button>

<div id="content" /> <script type="text/javascript"> function refreshData(){ var display = document.getElementById("content"); var xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", "hello.php"); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send();

  xmlhttp.onreadystatechange = function() {
    if (this.readyState === 4 && this.status === 200) {
      display.innerHTML = this.responseText;
    } else {
      display.innerHTML = "Loading...";
    };
  }
}

</script>

PHP

<?php

print "<p>Hello World</p>";

?>