This week's book giveaway is in the XML and Related Technologies forum.
We're giving away four copies of Java XML & JSON and have Jeff Friesen on-line!
See this thread for details.
Win a copy of Java XML & JSON this week in the XML and Related Technologies forum!

Frank Serkland

Ranch Hand
+ Follow
since Jun 21, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Frank Serkland

I added the @ResponseBody annotation to both the welcome and getEmployees methods.  Both methods return what they're supposed to when I run them in the Postman extension of Google Chrome, but I am now just getting "welcome" in the browser screen again, not the actual content.
1 week ago

Frank Serkland wrote:I just tried that and got this exception trace.



I also got this in the browser screen.

1 week ago

Rob Spoor wrote:Frank, did you happen to annotate the class with @RestController? Because @RestController implies not just @Controller, but also @ResponseBody. This means that the "welcome" will not be treated as the name of the JSP file to render, but as the response body.



I just tried that and got this exception trace.
1 week ago

Bear Bibeault wrote:A quick web search reveals that you might just be missing a "/" in



I just tried this, but it didn't work.
1 week ago

Bear Bibeault wrote:I know diddly about Spring or Spring Boot, but it's pretty clear that you've mapped the URI /welcome to a method that returns the string "welcome". There's nothing there that would cause the request to hook up with your JSP that I can see.



In other Spring web applications I've worked on, I've returned a String and the container took me to the JSP with that name.  In this case, my JSP is actually called welcome.jsp, but all I'm getting is the string welcome, not the JSP with the actual content.
1 week ago
I hope I'm putting this in the right folder.  I have a JSP that is not rendering correctly in Spring Boot.  All I get is the word when I call the page, not the actual content.  For what it's worth, I'm retrieving data in a MongoDB database and trying to display it in the JSP.  I have verified that the data is present in the database.  I've tried multiple Google searches to try and find an answer to this.

Here is my controller code.


Here is my JSP code.


Here is my pom.xml.


Here is my application.properties.  Please note that the JSP is located directly under /WEB-INF/.
1 week ago
JSP
Adding this as the first line in the for loop cured the problem.

4 years ago
I hope I'm putting this question in the right folder. I have an array of objects, and I have defined a setter for a variable in the object. When I call the setter, I get a NullPointerException. Here is the relevant code for the object.



Here is the portion of the main class where I define an array and then call the setter.
4 years ago
I was given the following code the other day during an interview.



The interviewer asked me what the output would be. I said that in both cases it would be 10. She said no, in the first case it would be 5. She told me something about dynamic binding. I just ran this code and I got 5 in both cases, not just the first. I am confused. If A is an instance of B and i is defined in B to be 10, why do I get 5 in both cases?
4 years ago
I've got a different problem now, so don't bother with this thread.
I am getting the following error:



The problem is that the approved column is a boolean in my database, or so I believe. Here is how I have it defined.



This is the line in my code where I'm defining the call to the database.



Here is how I have it defined in my model class.



I've tried printing out the list in my controller class, and I get the following error.

I have resolved the problem. I was missing the right curly brace. The corrected code now looks like this.

4 years ago
JSP
I just tried it with one backslash (\n), and I still got the same error message.
4 years ago
JSP
I am trying to split a string on the new line character (\n) in a JSP, but I am getting an error message. Here is my code.



Here is my error message.

4 years ago
JSP
Problem solved by reading the values via a DAO object from the page controller and sending them to the JSP through the request object.
5 years ago
JSP