Udit Singh

Greenhorn
+ Follow
since Sep 18, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Udit Singh

Hi,

I am developing a Web Application which displays Japanese data.. Although I specified META http-equiv="Content-Type" content="text/html; charset=SHIFT-JIS" on the HTML page.. But when the page renders, many times, browser ignores the Charset= shift-jis..instead it would show data with a different charset (encoding selected as Western European, UTF-8 or euc-jp)..

This totally messes us the japanese data which was originally encoded in shift-jis..

I cannot make changes in the HTTP server settings.. I tried writing a JavaScript function which at BODY onLoad, explicitely selects document.charset= shift-jis .. But this does not help as this happens too late ...

Would appreciate any ideas/inputs on this problem..

Thanks.

Cheers, Udit
I was not too sure whether this particular query belonged to JSP or Servlet forum .. I apologise for 'cross-posting' ...
I truly regret the inconvinience caused !
19 years ago
Hi All,

The Following worked :

String in = request.getParameter("TextBoxName");
in = new String(in.getBytes("ISO8859_1"),"utf-8");

Thanks and Regards,
Udit
19 years ago
JSP
Hi All,

The Following worked :

String in = request.getParameter("TextBoxName");
in = new String(in.getBytes("ISO8859_1"),"utf-8");

Thanks and Regards,
Udit
19 years ago
Hi,

I have a page where the User can enter Japanese (or multi-lingual) data in a Textbox and submit the form. On Form submission, I am calling a Servlet which retrieves the Data from the request. Here,I am getting mangled/corrupt data.
I gather that most of the web containers interpret the non-ascii/ japanese characters using the default encoding (ISO_8859_1), which produces the junk data at the retrieval time.

Approaches tried:
-- Set the Meta tag with : Content-type: application/x-www-form-urlencoded; charset=UTF-8

-- Tried using various Japanese related charset encodings (SHIFT_JIS, EUC-JP etc) instead of UTF-8

-- In the Servlet, I retrieve the Data as:
String jap = request.getParameter("textBoxName");
String convertedJap = new String(jap.getBytes(), "SJIS"); // convert 8859_1 to sjis

Surprisingly, none of the mentioned approaches seem to work. Could anyone please tell me, how the non-english entered in the Form can be retrieved without corruption ?
Would appreciate any input provided. Thanks in advance !
Cheers, Udit
19 years ago
JSP
Hi,

I have a page where the User can enter Japanese (or multi-lingual) data in a Textbox and submit the form. On Form submission, I am calling a Servlet which retrieves the Data from the request. Here,I am getting mangled/corrupt data.
I gather that most of the web containers interpret the non-ascii/ japanese characters using the default encoding (ISO_8859_1), which produces the junk data at the retrieval time.

Approaches tried:
-- Set the Meta tag with : Content-type: application/x-www-form-urlencoded; charset=UTF-8

-- Tried using various Japanese related charset encodings (SHIFT_JIS, EUC-JP etc) instead of UTF-8

-- In the Servlet, I retrieve the Data as:
String jap = request.getParameter("textBoxName");
String convertedJap = new String(jap.getBytes(), "SJIS"); // convert 8859_1 to sjis

Surprisingly, none of the mentioned approaches seem to work. Could anyone please tell me, how the non-english entered in the Form can be retrieved without corruption ?
Would appreciate any input provided. Thanks in advance !
Cheers, Udit
19 years ago
Hi Amer and Mikalai,

Thanks to both of you for providing the inputs. I shall contact the
prometric center to confirm the same.
Thanks once again..

Cheers, Udit
Hi all,

I had cleared my SCJP exam on 3rd October 2002. Now I want to go for the SCWCD. But, Sun's Official Certification FAQ states that the certifications taken on or before August 1, 2003, have a validity period of 2 years !
Does this mean that I cannot appear for the SCWCD unless I take and clear the ReCertification Exam for SCJP.
Any information provided would be highly appreciated.
Thanks in advance.
- Udit Singh
[ December 08, 2004: Message edited by: Udit Singh ]
Hi Nathaniel Stoddard,

Thanks a lot for the input. Yes, I think I better read the documentations completely first. Thank you.

With Regards,
Udit Singh
Hi,

I am newbie as per JAXB is concerned. Using the data present in my XML (say abc.xml), I want to generate different XMLs with different tag names or schema (client1.xml or client2.xml)
For example, from the following XML
<aa>
<bb>1111</bb>
<cc>44</cc>
</aa>
......I want to generate the corresponding XML
<address>
<city>1111</city>
<lane>44</lane>
</address>
...........or some more XMLs like that, but with different
tags/schema. I wanted to know if this can be achieved using
JAXB with or without much pain. And, what should be the
approach for this ?
Any suggestion would be highly appreciated.
Thanks in advance.
Regards, Udit Singh
Hello Frank,

Thank you. This is indeed a much simpler way of knowing whether
the page was viewed by the user or not. I was working in the same direction
earlier (IMG tag's src pointing to the servlet). But the only major issue with this implementation was : what if the user presses 'esc' to cancel the image loading or what if the image loading is disabled on the browser. Some people do cancel the full page/image loading for the faster access. :roll:
As the reliability was a major issue in the project, we could not implement the <IMG> approach.
But I still feel this was a very good idea and should be tried.
Thanks once again.


Regards,
Udit
20 years ago
Thanks for the input William. Finally, I'm implementing the onLoad which will process in the background and flash will not be observed on the screen.
I truly appreciate the help.
Warm Regards,
Udit Singh
20 years ago
Meanwhile, I did find a working solution, which is yet to be tested properly
and approved. The Final JSP would have 2 frames:
1st frame - 100% visible + contains the details JSP.
2nd Frame - invisible (0%) + contains a dummy JSP which would submit the request
at the load time. In this scenario, after the updation, the servlet would return
the same invisible JSP. So basically, User will just see the 1st visible frame and
he/she will not be able to notice that the invisible frame had been reloaded after
submitting.

I was wondering what if we provide an image <IMG> tage at the bottom of the page,
it's src would be something like /../servlet/UpdateServlet?req_type=update_database
so once the page is loaded, the browser would search for the image and blindly fire
a request to the servlet to do the updation.
I'm not too sure how this would work if the user has disabled the image loading on the
browser !

I would really appreciate if anyone has any further suggestions on this.
Thank you very much for the replies so far. This is certainly an amazing community.

With Warm Regards,
Udit Singh
20 years ago
Hi,

Thank you very much for the prompt response.
William, as I mentioned, I did try out the JavaScript "onLoad" function.
As soon as the page is loaded, onLoad submits the FORM to the Request
Handler Servlet, which after updation, returns back the same JSP. But
in this case, user observes a refreshing effect on his/her browser. That is:
First time the page loads..then suddenly disappears..and then it is
presented to the user. I could not get this solution approved

Catalin, sadly we cannot rely upon the user to give the confirmation
and this falls outside the scope of the proj requirements.

Anthony, in our architecture, the front servlet calls the request handler
servlet (which just returns the name of the JSP based on some conditions),
and the request is dispatched to the particular JSP. So basically, whatever
changes we've to make, have to be initiated at the client end.

Thanks.
20 years ago
Hi!

I am displaying a page to the user, which contains his/her personal
information. I want to update a field in the database that indicates
that the user has been presented the page. The requirement is NOT to
update that field until the info is presented to the user on the browser.
It's a MVC architecture. I could have written the updation code in the
servlet (Handler) just before it forwards the request to the final JSP
(Info page). But in this case we cannot be 100% sure that the user will be presented the page.
So we have to update the field only at the page load time. I had written a BODY onLoad script which would submit the FORM to a servlet the first time. The servlet would take care of the updation and it dispatches the same JSP. But in this case, ReLoad/Refresh effect is observed as the page is loaded ,is submitted and then again finally loaded.
We cannot write the database updation logic in the JSP.

I would really appreciate any suggestions on this.
Thanks in advance.

Cheers,
Udit
20 years ago