Dave Tolls

Master Rancher
+ Follow
since Sep 04, 2013
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dave Tolls

Steve Dyke wrote:
So I am convinced that I need to store as Name: SEAT ASSY  TYPE: \"A\" \"SF\" to at least get the jQgrid display to work.

OK, I'm not actually sure about this bit.

I think the actual root problem is how you are turning data in your database into a JSON String.

I think I asked this before, but can't see an answer in the thread, but how are you creating the JSON from the data in your database?

Forget about conversion code (like the stuff above that is trying to deal with the escape characters).  I would like to know what the code that takes the various data in the DB and outputs a JSON String looks like.
Are you just concatenating stuff together, or are you creating an instance of a class and then using something like Gson to turn it into a JSON String?
2 days ago
So, if you don't do that conversion you see the string OK in jQGrid?
But it's when you display it in a JLabel (or something) that it goes wrong?

Again, this is without the conversion code you showed...what goes wrong when you do not do that?
What do you see that you should not see?
2 days ago

Philippe Ponceblanc wrote:eclipse == /src/webcart/WebCartServlet.class

That's not Tomcat.
That's your IDE.

How are you deploying your web application to Tomcat?
Also, what Tomcat is it?  Is it embedded as part of Eclipse or standalone?
3 days ago
When you deploy this to Tomcat, what folder is the .class file in?
3 days ago
OK, now I'm confused.
Why exactly are you trying to turn the escaped quotes in this String into two lots of double quotes?

That will not fix the broken Json.

Indeed, it is the cause of the broken Json.
3 days ago
Can I suggest logging the fieldValue before you make any edits to it, and then after.
Not what appears in the tag.
Just what values htis bit of code is dealing with, so straight from your logs.

The result you have just posted is clearly incorrect as you have two " marks at the end there.

Assuming the database has the literal String (this is not escaped in any way):
Then I don't see why you need to change anything at all.
4 days ago
contains a couple of escaped double quotes.
So the actual String is:

Looks like the translation process is failing to handle those escapes.
5 days ago

Steve Dyke wrote:
A process within the app. It runs an SQL connection an creates the JSON.

Here is the compiled string when the database filed is like \"A\"

But on the printed placard I have like this "A""(an extra ")

But what is that process taking in and what is it producing?

Because it looks like it is not producing correct JSON.
5 days ago
OK, so it's the source (the input stream) that's the issue.
What's the proces you are reading (I assume that proc is an external Process)?
5 days ago
So what is creating the JSON?
What is populating that fieldValue field?
5 days ago
So, can you show the values being printed out on the console, and in the file?
Do they match?
5 days ago
What service is this coming from?
As Ron says, it's the provider that needs fixing if (and it is an if) this is how it is being sent out.

How are you getting the String?
5 days ago

Campbell Ritchie wrote:. . . and how many more .toUpperCase().toLowerCase() calls you could fit into the space you have saved

5 days ago
It defines the mapping between the Java attribute and the database column.
So, in the example, the attribute customerName is mapped to the database column CUSTOMER_NAME.
Part of the contract of hashcode is that two objects that are equal (ie the equals method return true) have the same hash code.
I your example, if you had two objects with the same idNumber, but different ages, then equals would return true, but they would have different hash codes.