Ezra Simon

Greenhorn
+ Follow
since Sep 18, 2004
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ezra Simon

Hi,

I solved this actually. It is an issue of the connector configuration in tomcat. Details are here...

http://jakarta.apache.org/tomcat/faq/printer/connectors.html#utf8

Jon
17 years ago
Hi,

I have two systems - I am porting the app from one to the other....

SYSTEM 1 - works perfectly
Mac OSX (unix)
Tomcat 4.x (standalone)
Java 1.3.x

SYSTEM 2 - servlets not correctly reading UTF8 form input
RHEL 9.x
Tomcat 5.x (though apache mod_jk)
Java 1.4.x


Reading parameter off the url as follows:

http://www.someurl.com?test=%E3%81%97

And in the servlet:

request.setCharacterEncoding("UTF-8");
String test = (String)request.getParameter("test");

(tshould read the japanese hirigana character for shi)

The above works on system 1 but not on system 2. System 2 is able to read UTF-8 from a file, and write UTF to a page, but it cannot read in from a URL. It is very strange. My best guess is that there is some system property I need to set, or there is something I need to do with java 1.4 that I am not doing.

Any help is greatly appreciated.

Jon
[ April 21, 2005: Message edited by: Ezra Simon ]
17 years ago
Actually - after some further testing this seems to be a mySQL problem - not XML. I will post the specifics, but if anyone has any info it would be helpful.

thanks.
Hi,

I have a big UTF-8 xml file that contains english, french, german, and japanese text:

<?xml version="1.0" encoding="UTF-8"?>

I parse through it with a sax parser in a standard way:

SAXParser parser = new SAXParser();
parser.parse(xmlFile);

and it get inserted into an mySQL database via a prepared statement:

pstmt = con.prepareStatement("INSERT INTO...

at some point the japanese text loses it encoding and end up in the database as a bunch of question marks "???". Stangly though, the non-english, french and german characters are fine.

I am pretty sure it loses the encoding between XML and Java (not Java and mySQL) becuase when I try printing to an HTML page before going to the DB, the smae problem occurs.

Any ideas? Do I maybe need to explicity set the encoding of the inputSource?

thanks for any help,

E.
[ January 23, 2005: Message edited by: Ezra Simon ]
Hi,

I am forwarding emails with JavaMail. The content of the message to be forwarded is taken using message.getContent(), and then output to the forwarded email using message.setContent(object,type).

My question is how to add a simple text footer to all of these emails. Remember, I don't know for certain the content type of the email being forwarded. It might be HTML, have attachments etc.

any tips / help is appreciated,

Ezra
17 years ago
Hi,

First of all - you should understand how that time breaks down to different tasks. You have

1)getting the data from the database
2)compiling the data onto a jsp page
3)sending the data from the server to the client
4)rendering the html in the browser

As a former interface developer, I will comment on 3 and 4, and let others comment on the first two.

I hope this is for yourself and not for your users, because you may end up crashing some machines with that much data - and users do not like that. It is always a best practice to break information into digestable bits.

But assuming it must be this way we have to keep code at a minimum, and keep html structures simple.

NO TABLES! They are deprecated anyway, and it takes a browser extra time to output tables.

If you can just go with this...

ITEM - DATA,DATA,DATA<br>
ITEM - DATA,DATA,DATA<br>
ITEM - DATA,DATA,DATA<br>
ITEM - DATA,DATA,DATA<br>

Avoid images and anything nested (span within divs, or whatever. If you want to make it looks nice you will have to break it up into bits.

That's it really. I could comment on the jsp bit, but there are probably others more qualified.

Jon
----------------
Get Jobs on GoodNoodles
http://www.goodnoodles.com
[ October 04, 2004: Message edited by: Ezra Simon ]
17 years ago
JSP
Hi all,

New site called GoodNoodles which has jobs, projects and people all around the world. Some Java opportunities right now. It's a good time to get started.

http://www.goodnoodles.com/

Definately worth a look.

Jon
17 years ago
Hi,

The context path should have no slash at the end, like this...

path="/iBAS"

I'm not sure if that is your only problem, but it could cause the errors you are describing.

good luck,

Jon
----------------------
Projects on GoodNoodles
http://www.goodnoodles.com/
[ September 30, 2004: Message edited by: Ezra Simon ]
17 years ago
Hi,

It depend on your data I suppose, but you could change the ResultSet into a nested ArrayList and use it like this...

<table>
<%
ArrayList wholeDataSet = con.getListFromDB("whatever");
iter = wholeDataSet.iterator();
while (iter.hasNext()) {
ArrayList dataRow = (ArrayList) iter.next();
out.print("<tr>");
out.print("<td>"+(String)row.get(1)+"</td>");
out.print("<td>"+(String)row.get(2)+"</td>");
out.print("<td>"+(String)row.get(3)+"</td>");
//if variable amount of data use a loop here
out.print("</tr>");
%>
</table>

I would like to see some other alternatives as well.

Jon

------------------
Projects on GoodNoodles
http://www.goodnoodles.com/
17 years ago
JSP