Re: redirectig to WORD files

2005-01-26 Thread Guillaume Cottenceau
[EMAIL PROTECTED] gdilem 'at' libero.it writes:

 Hi all I try to redirect my response to a word doc file.But after
 setting contexttype and using response.sendRedirect(docWordURL) , I
 get white page; What I want is open this word document on a click of a
 link in a normal jsp.I call the action that has to redirecting me to
 that file. Any idea? Regards

Try

response.setContentType( whatever_suitable_for_msword );

response.setHeader( Content-Disposition, 
attachment; filename=foo.doc );

Then write to response.getWriter(). Worked for me.

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Displaying images with dynamic names

2005-01-19 Thread Guillaume Cottenceau
Dakota Jack dakota.jack 'at' gmail.com writes:

 Just write the response with dynamic code that puts the correct name
 in the HTML, assuming that you are talking to a browser with response
 objects that are HTML.
 
 For example, img src='whatever8829382.png' might come from img
 src='c:out value=${whateverVar}/'.  Whatever you do, it has to

Why not img src=${whateverVar} ?

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: url in address bar

2005-01-19 Thread Guillaume Cottenceau
Vijaya S svijiya 'at' solutionscraft.com writes:

 What is the tomcat version you are using. if it is 5.x then automatically
 all the applications under webapps context are created provided you followed
 the folder structure. If it is a earlier version, then you can manually add
 the context in server.xml located in catalina_home\conf\ folder.

What's the relationship with the question he's asking?
 
 Vijaya
 -Original Message-
 From: Charles A Jordan [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 19, 2005 8:26 PM
 To: user@struts.apache.org
 Subject: url in address bar
 
 
 Hello All,
 This may not be the proper area for this question, but I thought I'd
 try anyway.
 I have set something in my web server, tomcat, or struts configuration so
 only my domain name (my.company.com) displays in the address bar of my
 browser no matter what page I'm on. So now when I press reload, it always
 goes back to my index.jsp.
 Does anyone know what configuration setting controls this?
 I know this is not specific to my browser because this only occurs with my
 struts application.
 
 Any help would be appreciated.
 
 Thanks.
 
 Charles (Allen) Jordan   [EMAIL PROTECTED]
   System Administrator(407)771-8919
   Convergys
   285 International Parkway,
   Lake Mary, FL 32746-5007
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Wiwit Tjahjana/HQ/FHLMC is out of the office.

2005-01-18 Thread Guillaume Cottenceau
wiwit_tjahjana 'at' freddiemac.com writes:

 I will be out of the office starting  01/18/2005 and will not return until
 02/04/2005.
 
 I will be out on a paternity leave/vacation from Tue, Jan 18, 2005 to Wed,
 Feb 2, 2005.  On Thu, Feb 3, 2005, I will be working from home and could be
 contacted at this e-mail address.  I will be returning to the office on
 Friday, Feb 4, 2005.  During this time, please contact:
 (1) Lee Guan, for Product 5.0 questions, including Derived Requirements,
 NFR, and Application Architecture
 (2) Roland Cuellar, for Product 5.1 planning
 (3) Ravi Singh, for Product 4.2 Warranty
 (4) Lee Guan and Mark Coble, for CFD for Servicing design and development
 (Release 5.1)
 (5) Gregory Bohmer, for CSX 5.0 Support and Application Architecture
 (6) Gregory Bohmer and Santhosh Ananthakrishnan, for CSX Reuse
 opportunities for projects in Freddie Mac outside PE.
 
 Thank you.
 
 wiwit
 -a proud father of two, a 4-yr old and a newborn baby

Vry interesting!

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: html:link and char encoding

2005-01-13 Thread Guillaume Cottenceau
Nicolas De Loof nicolas.deloof 'at' capgemini.com writes:

 Hi,
 
 Can someone explain me what's wrong in HTTP / servlet API about char
 encoding :
 
 I'm using html:link to build a link with parameters, whose values
 use french chars ('é', 'à' ...)
 I need to set useLocaleEncoding to get values in my servlet (that is
 not a struts action) using getParameterMap.
 If I do not set this attribute, I get values with strange strings that
 looks like UTF-8 sequences.

By default, GET parameters are decoded in ISO-8859-1, whatever
encoding was used in the page with the link and whatever the
content-type of the GET request is set to. You can use connector
parameters to change this behaviour.

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html

Warning, if you still use tomcat4.1.x: this behaviour changed in
tomcat5.

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: html:link and char encoding

2005-01-13 Thread Guillaume Cottenceau
Laurent lg83news 'at' free.fr writes:

 Nicolas De Loof wrote:
  Can someone explain me what's wrong in HTTP / servlet API about char
  encoding :
  I'm using html:link to build a link with parameters, whose values
  use french chars ('é', 'à' ...)
  I need to set useLocaleEncoding to get values in my servlet (that is
  not a struts action) using getParameterMap.
  If I do not set this attribute, I get values with strange strings
  that looks like UTF-8 sequences.
  Is they're no strict standard for URI encoding ? Is tomcat servlet
  API wrong about this ?
 
 I don't know about the specific behaviour of tomcat, but the answer to
 the first question is No: the only standard is us-ascii. If a browser

Do you have any evidence, the HTTP RFC or something else?

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/http.html
makes me think that tomcat uses ISO-8859-1 by default, not
US-ASCII.

 needs to send characters that are outside us-ascii, it will always
 encode them in the same encoding as the page that contains the link /
 form.

Always seems a bit too definitive to me. When present, the
accept-charset attribute of the form element would make this
behaviour different.

 If you are doing this on the server side, just make sure you do
 the necessary encoding/decoding while sending and receiving so that it
 works!

What are you talking about, more precisely? As far as I know,
there is no explicit encoding/decoding when using tomcat. The
results of HttpServletRequest#getParameter is a String, not an
array of bytes, therefore it has already been decoded by tomcat
(HttpServletRequest#getCharacterEncoding can show which encoding
was used).

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts 1.1 UTF-8 problem

2005-01-10 Thread Guillaume Cottenceau
Koon Yue Lam kisstech 'at' gmail.com writes:

 Hi, here is the situation:
 Tomcat 5.25
 MySQL 4.1
 Struts 1.1
 
 when I use Struts form to get some form data submited by a webpage, it
 is encode in latin but not utf-8. I have already set the page encoding
 to UTF-8 in my JSP.
 
 I need to new a String specific the encoding to UTF-8 in order to save
 unicode data into MySQL
 
 Is there any way to tell Struts encode all data in UTF-8 ??

You might want to browse the archives.

http://marc.theaimsgroup.com/?l=struts-userm=110484806414499
http://marc.theaimsgroup.com/?l=struts-userm=110175805321521

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to avoid Missing message for key my.key exception...

2005-01-06 Thread Guillaume Cottenceau
Ilja Smoli ilja 'at' frontdesk.ee writes:

 Hi
 How to check is a message present for particular key in message resources
 before displaying it? To avoid exception?

Use null=false in message-resources of your struts-config to
display a ???string??? instead. If you really want to check you
might be lucky by creating an ActionMessage object.

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to avoid Missing message for key my.key exception...

2005-01-06 Thread Guillaume Cottenceau
Ilja Smoli ilja 'at' frontdesk.ee writes:

 Thx for reply:
 but problem is that I'd like to check it in jsp at runtime...

Create an ActionMessage object.

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Character encoding problems after 1.1 to 1.2.4 upgrade

2005-01-06 Thread Guillaume Cottenceau
J.Patterson Waltz III lists 'at' cerenit.com writes:

 On 6 janv. 05, at 15:52, J.Patterson Waltz III wrote:
 
 
  Now, I guess I'll just have to try using the character encoding
  filter Guillaume recommended.
 
 Ack! I'm about to pull my hair out over these encoding issues. I added
 the SetCharacterEncodingFilter from the Tomcat 5 distribution to my
 web application, with just enough mods to get some logging output from
 it so I'd know it was doing its thing.
 
 So now I have the following in place to ensure incoming and outgoing
 UTF-8 encoding:
 - A %@ page pageEncoding=UTF-8
 contentType=text/html;charset=UTF-8 language=java % directive
 - an acceptCharset=UTF-8 attribute on html:form tags
 - an  enctype=application/x-www-form-urlencoded;charset=UTF-8
 attribute on html:form tags
 - the SetCharacterEncodingFilter, configured to interpret UTF-8 no
 matter what
 
 and yet I'm *still* getting non-decoded UTF-8 displayed in my pages
 (i.e. été is été).
 
 Guillaume, did you actually get UTF-8 to work using the filter
 solution? If so, can you (or anyone) think of anything else I might
 have missed? Thanks in advance.

Yes, it works.

First, verify `tomcat-browser': please try to render your page
with wget -S to see precisely the headers (Content-Type must
specify UTF-8) and the contents (double-check the output is
UTF-8) (to verify your browser is not bugged).

Second, verify `browser-tomcat': use a proxy (or netcat in
listen mode) to precisely see what headers your browser is
sending (if you will use the filter to force UTF-8, that doesn't
matter much) and the encoding of the data. Typically, browsers
will encode in UTF-8 if the page containing the form was using
UTF-8 itself, but accept-charset can do no harm, but as you
noticed they don't set the charset in the Content-Type header
they use (according to mozilla's bugzilla, it's because it breaks
too many servers); but you have to double-check that (in my
experience, mozilla and MSIE do work).

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Character encoding problems after 1.1 to 1.2.4 upgrade

2005-01-06 Thread Guillaume Cottenceau
J.Patterson Waltz III lists 'at' cerenit.com writes:

 Notice in the third line of the form data:
 personTO.comments=%C3%A9t%C3%A9
 That's 'été' URLencoded as UTF-8.
 
 So I'm still stumped. :-(

But that's exactly what you want. The SetCharacterEncodingFilter
will set the character encoding of the HttpServletRequest before
data is retrieved from it, and when it's retrieved it should be
correctly decoded. Are you sure the filter is up and running?

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Character encoding problems after 1.1 to 1.2.4 upgrade

2005-01-06 Thread Guillaume Cottenceau
J.Patterson Waltz III lists 'at' cerenit.com writes:

 On 6 janv. 05, at 17:44, Guillaume Cottenceau wrote:
 
  J.Patterson Waltz III lists 'at' cerenit.com writes:
 
  Notice in the third line of the form data:
  personTO.comments=%C3%A9t%C3%A9
  That's 'été' URLencoded as UTF-8.
 
  So I'm still stumped. :-(
 
  But that's exactly what you want. The SetCharacterEncodingFilter
  will set the character encoding of the HttpServletRequest before
  data is retrieved from it, and when it's retrieved it should be
  correctly decoded. Are you sure the filter is up and running?
 
 
 I agree that that encoding is what I want. It's just that it's not
 getting decoded upon display. Or rather, it's getting URL-decoded, but
 not UTF-8 decoded.

Display is different from decoding. Double check the decoding
first with log4j or anything. But beware that the JVM default
charset and console charset may interfer so you might make use of
my char decoder:

byte[] b = querystring.getBytes( UTF-8 );
String bytes = ;
for ( int i = 0; i  b.length; i++ ) {
int val = b[i];
if ( val  0 ) {
val += 256;
}
bytes += Integer.toHexString( val ) +  ;
}

 I'm sure the filter is up and running because I added logging
 statements to the Apache example code. So in my log, I see:
 
 2005-01-06 17:30:34,706 DEBUG
 [com.cerenit.sage.util.web.SetCharacterEncodingFilter] ignore = true,
 encoding = utf-8, request encoding is null
 2005-01-06 17:30:34,706 DEBUG
 [com.cerenit.sage.util.web.SetCharacterEncodingFilter] setting
 encoding to utf-8

Yep.
 
 I have the filter set to match the url-patterns *.do and *.jsp.
 
 I'm wondering if the fact that the form fields are all defined in
 subtiles could make any difference: I'd guess not, since it's the
 outermost tile which defines the page encoding.

Your previous email seems to show that browser-tomcat is ok
since you're really receiving URL encoded UTF8 strings, which is
what you want. There is something with url decoding and/or
decoding of byte content.

 I also have another filter, the ResponseOverrideFilter used by
 displaytag, which appears before the SetCharacterEncodingFilter in my
 web.xml. I wonder if it could be interfering with the
 SetCharacterEncodingFilter?

Yes, if it reads the request parameters or request stream (by
servlets specs). The SetCharacterEncodingFilter should be put
first. I think this might be your problem.

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Character encoding problems after 1.1 to 1.2.4 upgrade

2005-01-05 Thread Guillaume Cottenceau
J. Patterson Waltz III pattersonw 'at' hotmail.com writes:

 P.S. - I know how to view the headers of replies sent from the server to the
 browser, but am not sure how to get at those sent from the browser to the
 server, to make sure that they are indeed UTF-8. Any suggestions?

I usually temporarily modify the URL where to post the form to
something like http://localhost:/ then a simple `nc -l -p ' 
in a console listens to the connection and dumps received data.

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to implement OR functionality in STRUTS

2005-01-05 Thread Guillaume Cottenceau
Neil Erdwien neil 'at' k-state.edu writes:

 How about:
 
 logic:equal ...
...
 /logic:equal
 logic:equal ...
...
 /logic:equal

Are you serious? When ... is longer than say 1 or 2 lines, this
leads to duplicated source-code, one of the thing I think
programmers should avoid with the most energy.

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Character encoding problems after 1.1 to 1.2.4 upgrade

2005-01-04 Thread Guillaume Cottenceau
J. Patterson Waltz III pattersonw 'at' hotmail.com writes:

 Hello,
 
 I recently upgraded a J2EE/Struts web application I'm working on to the
 1.2.4 version of Struts, and ever since I made this change, I've been
 encountering a problem with the encoding of non-ascii character data
 submitted in forms. All my pages are set to use UTF-8 encoding (via a %@
 page pageEncoding=UTF-8 contentType=text/html;charset=UTF-8
 language=java % directive in my master Tiles layout), and this worked
 fine with Struts 1.1, with respect to data submission and display.  However,
 since I upgraded to 1.2.4, data entered is now stored and redisplayed in its
 encoded form rather than its decoded form: i.e. été becomes été

Most probably the browser is sending data in UTF-8 but doesn't
say so with charset= in the Content-Type header. If you're
confident enough that the browsers will send UTF-8 (which should
be the case if they are encoded in UTF-8 and you use
accept-charset in the forms), you can use a filter which forces
the HTTP request to be seen as UTF-8 in input (for example
filters/SetCharacterEncodingFilter which is bundled with
tomcat)[1].

Note: if you also use GET parameters encoded in UTF-8, with tomcat-5 you
have to set `useBodyEncodingForURI=true' in the Connector or
else tomcat will always consider it ISO-8859-1 (or you can force
the URI to be always decoded as UTF-8, but I think this is more
elegant and versatile that way).


Ref:

[1] this is very surprising, I can't seem to be able to find
stuff in struts archives... for example, searching gmane archives
with google with struts SetCharacterEncodingFilter
site:gmane.org, I get only one answer; however, I verified that
archives can be accessed on gmane by clicks only (no form post),
so google should crawl them I guess. the search on gmane itself
is extremely slow but gives answers. then, searching
marc.theaimsgroup.com has similar errors with google: 0 answer
from google, however articles are also available by clicks, no
form post needed. and then it's even worse, searching for
SetCharacterEncodingFilter seems to trigger a bug in their search
engine, no answer is shown, only the list of all archives sorted
by month

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: test

2004-12-13 Thread Guillaume Cottenceau
Frank W. Zammetti (MLists) fzlists 'at' omnytex.com writes:

 Please ignore me.  Just seeing if my web host fixed the webmail problem
 I've been having.  Thanks!

No offense, but is it not possible to test that from one email of
yours to another one?

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: html:options and collections

2004-12-09 Thread Guillaume Cottenceau
Erik Weber erikweber 'at' mindspring.com writes:

 I often write a Struts plug-in that sets static collections (such as
 select box values) as ServletContext attributes in the init method.

That becomes more complicated when you handle i18n (e.g. in
labelProperty).

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ValidatorForm ???

2004-12-08 Thread Guillaume Cottenceau
Bala.Paranj 'at' novainfo.com writes:

 Note:  The information contained in this email and in any attachments is
 intended only for the person or entity to which it is addressed and may
 contain confidential and/or privileged material.  Any review,
 retransmission, dissemination or other use of, or taking of any action in
 reliance upon, this information by persons or entities other than the
 intended recipient is prohibited.  The recipient should check this email and
 any attachments for the presence of viruses.  Sender accepts no liability
 for any damages caused by any virus transmitted by this email. If you have
 received this email in error, please notify us immediately by replying to
 the message and delete the email from your computer.  This e-mail is and any
 response to it will be unencrypted and, therefore, potentially unsecure.
 Thank you.  NOVA Information Systems, Inc.

Lawyers have said that these notices have no legal value. Thus,
it's simply annoying.

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: i18n input

2004-12-06 Thread Guillaume Cottenceau
Huw Richards huw.richards 'at' oprig.com writes:

 The one problem I had with i18n input was with European locales where , is
 used as the decimal separator. The number would be formatted with , as the
 decimal separator but as the input boxes are just text, the numeric keypad
 which produces , in excel when . is pressed just produces . in the
 number box. I had to rely on an adapted javascript to mask the numbers on
 field entry  exit.

As a side note, if I'm not mistaken, there has been a Red Hat
Linux release with the numeric keypad key . outputting always
, when using the appropriate locale, but this made the users
quite frustrated because many of them are used to using this key
to really mean ., not always decimal separator (the dot at
the end of a sentence, the dot in programming languages, etc).

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: i18n and the database...

2004-12-03 Thread Guillaume Cottenceau
Michael Klaene mklaene 'at' yahoo.com writes:

 3.)I know that some databases, Oracle, and I hear the newest version
 of MySQL support UTF-8. I've no experience in this area. Does anyone
 have experience with storing text in UTF-8 in the database? This
 *seems* like it could be an ideal approach, eliminating alot of
 on-going work. Obviously, the app would be less portable.

If you want to go with full i18n, even if you don't store
localized messages in database, you will hit the wall sooner or
later if the database is not able to store any string
representing text in any language, because you will want sooner
or later that your users be able to enter localized data in forms
that will end up in the database (their first/last name, etc).

Because of that reason, you need that the database be able to
store and retrieve localized text; a good approach can be to
specify that data is stored in a unicode character encoding;
UTF-8 is typically a good candidate when you have a lot of
latin-based text.

And this is really an issue at the database end. In java, the
Strings can correctly and transparently handle any language. You
just have to make sure that the database driver will correctly
store and retrieve data.

In the application at my company, the (postgres) database is
using UTF-8 and there is really nothing to say here: it works,
there is no problem.

In my opinion, the only issue is really the communication between
the end-user (browser) and your application. Sending data to the
end-user should be ok by using UTF-8 in your webpages, if your
users are not using netscape 2.0 or something. Retrieving data
should be ok by using UTF-8 in your webpages and possibly
specifying accept-charset=UTF-8 in your forms, and filtering
the input to force the CharacterEncoding to UTF-8 (because
browsers usually don't say that the data they send is UTF-8
encoded - there are been many discussions on that topic on this
list).


Please keep us updated about your project; I would be curious to
know about the performance, if you really go to using the
database for localized messages.

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: disable validation of validator.xml validator-rules.xml

2004-12-01 Thread Guillaume Cottenceau
Marco Mistroni mmistroni 'at' waersystems.com writes:

 Hello all,
   Does anyone know how to disable the validation of the two files
 mentioned in the subject?
 Looks like struts, when loaded, is trying to validate those files
 against the DTD... and if by mistake my internet connection goes down,
 then code
 Won\t work. (meaning, I am using WAS Studio, and it complaints that it
 cannot validate the two files... and without tht I cannot build my
 webapp..)
 
 Any help?

Substitute the URL pointing to the DTD by a URI pointing to a
local file?

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Where to store and how to retrieve Images for web app

2004-12-01 Thread Guillaume Cottenceau
Mark Benussi mark_benussi 'at' hotmail.com writes:

 As a second point I would be interested to know if anyone has any code
 snippets to persist (Create and Read) the data to MySQl.

In the application we use at my company, we put images in a
postgres database and we have a servlet which can reply with
image content when giving a proper id.

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: UTF-8 encoding in html form

2004-11-30 Thread Guillaume Cottenceau
Otto, Frank otto 'at' delta-barth.de writes:

 Hi,
 
 I have a html form. The user can input text in ISO-8859-2 format. 
 
 After submit the form the characters are wrong.  I don't know why.
 
 I have set 
 
 %@ page contentType=text/html; charset=UTF-8 pageEncoding=UTF-8%
 
 and there is a filter (filters.SetCharacterEncodingFilter) to encode UTF-8.
 
 How can I convert the polish character, which the user has inputed?

The problem is, in which encoding the browser is sending the
data, and is it telling so (e.g. does the server has a way to
know the encoding of the data it's receiving).

Theoretically, when sending HTTP POST, browsers should put the
charset= parameter in Content-Type and everything should be fine
if the receiving server decodes that correctly. But, as far as I
know, once, Mozilla tried to put the charset in Content-Type:
field when replying with HTTP POST but had to remove this because
it broke too many existing servers with bad configurations.
However, I can't find the bug in their bugzilla again.

The problem is worse with HTTP GET where there is really nothing
to tell the encoding of the parameters passed.

As far as I know, the most reliable way is to specify
accept-charset as UTF-8 in the form of the HTML (w3.org's
description of this parameter: This attribute specifies the list
of character encodings for input data that is accepted by the
server processing this form). Theoretically, this forces the
browser to send the data in UTF-8. As far as I know, tests showed
that this should work correctly with current browsers. The
problem is that this parameter is not available in html:form
from struts, the reason of it I have no clue about.

Something you can try it to specify the encoding of the html page
in which you have your form as UTF-8, it seems that mozilla will
send GET/POST parameters in UTF-8 in such a case, but that's
really a hack and I don't know browser support about it.


And of course, on-the-fly detection of the charset is not
reliable at all :).

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: UTF-8 encoding in html form

2004-11-30 Thread Guillaume Cottenceau
Joe Germuska Joe 'at' Germuska.com writes:

[...]

 As far as I know, the most reliable way is to specify
 accept-charset as UTF-8 in the form of the HTML (w3.org's
 description of this parameter: This attribute specifies the list
 of character encodings for input data that is accepted by the
 server processing this form). Theoretically, this forces the
 browser to send the data in UTF-8. As far as I know, tests showed
 that this should work correctly with current browsers. The
 problem is that this parameter is not available in html:form
 from struts, the reason of it I have no clue about.
 
 This property was added in Struts 1.2.2, as noted on
 http://struts.apache.org/userGuide/struts-html.html#form

Ah, interesting. I was talking about version 1.1 from which I
haven't upgraded yet, my bad.
 
 In my experience, this is not as well supported by browsers as one
 would wish.  My experience is that the most effective way to coax a
 browser to use a specific encoding when returning data is to send the
 page in the encoding which you want the browser to use when returning
 data.  It looks like that's what's being done -- but be careful not to
 count on a JSP page directive in a tile, since only the outermost
 tile (the first one which writes to the response stream) has the
 chance to set the page encoding.

Fine. Then the most effective way would be to do both, probably :)

 Also note that Struts' multipart processing currently is rather clumsy
 in handling form encoding.  If the request object returns null from
 getCharacterEncoding(), then Struts assumes ISO-8859-1.  I was

Isn't it Tomcat itself? This is a behaviour per servlets
specifications (see page 41 of 2.4 specs).

 setting the request encoding with a custom command in a chain-request
 processor, but the request was still returning a null value in
 CommonsMultipartRequestHandler where the non-uploaded fields were
 being processed.  Of course, this may have nothing to do with your
 situation.

As far as I know, this is a behaviour per specifications. Page 41
and 198 of servlets 2.4 specs: changing the character encoding
must be done prior to reading request parameters or reading
input. Odds are high there is something which reads input before
you set the request encoding.

 In the case where I have a non-multipart form, I have consistently
 gotten suitable results simply by making sure that the form page is
 delivered to the browser with the character encoding I want to use.

Good to know!

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DTD resolution

2004-11-26 Thread Guillaume Cottenceau
Emmanouil Batsis Emmanouil.Batsis 'at' eurodyn.com writes:

 Hi,
 
 My jboss tries to resolve the DTDs for the validator plugin. Can
 anyone tell me how to avoid this?

Have it locally. See thread:

http://thread.gmane.org/gmane.comp.jakarta.struts.user/96922

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: XTag problem

2004-11-24 Thread Guillaume Cottenceau
Nishant nishantp 'at' cybage.com writes:

 There is difference between knowing the Path and walking on the Path

Add a to make the beginning There is a difference, and remove
on from on the path to make the ending walking the path,
this will make the sentence correct, and your signature look way
more awesome.

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Post Validation

2004-11-24 Thread Guillaume Cottenceau
Lee Harrington leebase 'at' gmail.com writes:

 I'm using DynaValidator forms.  Works great, except when you have pick

[...]

Please don't hit answer on a random message in your email
program when you want to start a new thread. Your email program
keeps track of what message it thinks you were answering (the
References: header) in the email you send, therefore it appears
inside the appropriate thread when we receive the message,
instead of at top of a new thread, which is misleading.

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



using JSTL with struts (stupid question?)

2004-11-17 Thread Guillaume Cottenceau
Hi,

I hope this is not gonna sound too stupid..

My problem is the inability to use ${expression..} in the JSP
pages I use with struts.

I have tried to look for information but failed to fix the
problem myself, unfortunately. I have followed instructions here:

http://jakarta.apache.org/taglibs/doc/standard-doc/GettingStarted.html

e.g. put jstl.jar and standard.jar in WEB-INF/lib of my webapp,
and actually I suppose this works since the following excerpt
from a JSP doesn't produce any compile error:

%@ taglib uri=http://java.sun.com/jstl/core; prefix=c %

But the ${expression..} stuff keeps showing off raw instead of
interpreted as the expression I give.

I tried to look also in the struts-el page at:

http://struts.apache.org/faqs/struts-el.html

but didn't find any information on how to install it :/

So currently the following JSP excerpt:

-=-=---=-=---=-=---=-=---=-=---=-=--
%@ page contentType=text/html;charset=UTF-8 language=java %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/app.tld prefix=app %
%@ taglib uri=http://java.sun.com/jstl/core; prefix=c %
jsp:useBean id=user
  scope=session
   type=org.gc.skirate.User/

html:html
head
titlebean:message key=main.title//title
html:base/
/head

body
  c:forEach var=i begin=1 end=10 step=1
c:out value=${i} /
br /
  /c:forEach

  app:loggedin
loggedin as user: ${user.login} jsp:getProperty name=user 
property=login/
  /app:loggedin
-=-=---=-=---=-=---=-=---=-=---=-=--

with the user test logged in, renders as:

-=-=---=-=---=-=---=-=---=-=---=-=--
1
2
3
4
5
6
7
8
9
10
loggedin as user: ${user.login} test 
-=-=---=-=---=-=---=-=---=-=---=-=--

Any help would be appreciated. And sorry again if this is real
stupid..

-- 
Guillaume Cottenceau - http://zarb.org/~gc/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using commons HttpUtils to call an Action, but it doesn't work.

2004-11-17 Thread Guillaume Cottenceau
Morgan mrachell 'at' bbandt.com writes:

 I'm using the following code in an initialization routine to call an Action. 
 This occurs the first time a user hits the application. This was all working 
 on 
 WebSphere 4.0.4, but we upgraded to WS 5.1.0.5 and now it doesn't work. No 
 error, no logs, no exception. Just like it doesn't get called. Of course, the 
 same app (EAR file) works fine on a development server.
 
 Any reason why this wouldn't work in the execute() method of another action?
 
 // Create Action URL
 String requestUrl = request.getRequestURL().toString();
 String webAppUrl = requestUrl.substring(0, requestUrl.lastIndexOf(/) );
 String loadStateFormsUrl = webAppUrl + /initAction.do;
 
 HttpClient client = new HttpClient(); 

This is not a thread-safe HttpClient. Any chance the code is
called by several threads at the same time or something?

-- 
Guillaume Cottenceau - http://zarb.org/~gc/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: using JSTL with struts (stupid question?)

2004-11-17 Thread Guillaume Cottenceau
Neil Erdwien neil 'at' k-state.edu writes:

 The ability to use ${expr} in the text of a JSP page is new to
 JSP 2.0.  Does your container support JSP 2.0?  Tomcat 5 does,
 Tomcat 4 doesn't.

Ah. My container tomcat-5.0.27 so I guess it should..

-- 
Guillaume Cottenceau - http://zarb.org/~gc/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: using JSTL with struts (stupid question?)

2004-11-17 Thread Guillaume Cottenceau
Wendy Smoak java 'at' wendysmoak.com writes:

 From: Neil Erdwien [EMAIL PROTECTED]
  The ability to use ${expr} in the text of a JSP page is new to JSP
  2.0.  Does your container support JSP 2.0?  Tomcat 5 does, Tomcat 4
 doesn't.
 
 And if you're not on JSP 2.0, then try:
   c:out value=${user.login}/
 (Assuming the 'user' object has a 'getLogin' method.)

Yes, that does work. However, this much longer than I expected :)
Still, as I'm using tomcat-5.0.27, I guess I should be able to
use the shorter form.

Any place to check where this feature could be turned off
inadvertandly?

-- 
Guillaume Cottenceau - http://zarb.org/~gc/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: using JSTL with struts (stupid question?)

2004-11-17 Thread Guillaume Cottenceau
Guillaume Cottenceau gc3 'at' bluewin.ch writes:

 Wendy Smoak java 'at' wendysmoak.com writes:
 
  From: Neil Erdwien [EMAIL PROTECTED]
   The ability to use ${expr} in the text of a JSP page is new to JSP
   2.0.  Does your container support JSP 2.0?  Tomcat 5 does, Tomcat 4
  doesn't.
  
  And if you're not on JSP 2.0, then try:
c:out value=${user.login}/
  (Assuming the 'user' object has a 'getLogin' method.)
 
 Yes, that does work. However, this much longer than I expected :)
 Still, as I'm using tomcat-5.0.27, I guess I should be able to
 use the shorter form.
 
 Any place to check where this feature could be turned off
 inadvertandly?

Thanks to both the suggestions about JSP 2.0 e.g. implemented
first in tomcat 5, I ended up on the following page:

http://archives.java.sun.com/cgi-bin/wa?A2=ind0305L=jsp-interestD=0P=24887

And actually I was using a web.xml version 2.3, it seems EL is
disabled there by default :(

Using a 2.4 version, it does work perfectly.

But this is kinda stupid, I am using a web.xml file shown as a
demo in the official tomcat 5.0.27 distribution. I don't quite
get why it was using a web.xml of this older version.

Thanks for the help!

-- 
Guillaume Cottenceau - http://zarb.org/~gc/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: using JSTL with struts (stupid question?)

2004-11-17 Thread Guillaume Cottenceau
Gareth Meyrick gareth 'at' kirkstonepass.com writes:

 hi,
 
 Guillaume Cottenceau wrote:
  
  Any place to check where this feature could be turned off
  inadvertandly?
 
 try inserting the page directive
 
   %@ page isELIgnored=false %
 
 before any expression language (EL) stuff.
 
 hope this helps..

Yes, this did workaround the problem, thank you. It turned out
that the whole global turning off of the EL was due to using a
2.3 version of the web.xml file. Now, I don't really understand
why the example web.xml file I found in tomcat 5.0.27 was still
in 2.3 version..

-- 
Guillaume Cottenceau - http://zarb.org/~gc/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: problem with unicode

2004-11-15 Thread Guillaume Cottenceau
Otto, Frank otto 'at' delta-barth.de writes:

 I have a problem with display of characters in latin-1.
 
 for example: The properties file contains the unicode \u0119,
 but the character is not displayed.
 
 If I use #x0119; it will be displayed. I use bean:message key=my.text/
 
 Has someone a solution?

If you're really trying to display that character in latin1, yes
it will fail because this is not a latin1 character. When
converting to java unicode escapes, first 128 latin1/ascii
characters are unchanged and remaining 128 characters are \u0080
to \u00ff, as you can see with this:

[EMAIL PROTECTED] /tmp] perl -e 'print chr($_),   foreach 128..255'  t.p
[EMAIL PROTECTED] /tmp] native2ascii -encoding latin1 t.p
\u0080 \u0081 \u0082 \u0083 \u0084 \u0085 \u0086 \u0087 \u0088 \u0089 \u008a 
\u008b \u008c \u008d \u008e \u008f \u0090 \u0091 \u0092 \u0093 \u0094 \u0095 
\u0096 \u0097 \u0098 \u0099 \u009a \u009b \u009c \u009d \u009e \u009f \u00a0 
\u00a1 \u00a2 \u00a3 \u00a4 \u00a5 \u00a6 \u00a7 \u00a8 \u00a9 \u00aa \u00ab 
\u00ac \u00ad \u00ae \u00af \u00b0 \u00b1 \u00b2 \u00b3 \u00b4 \u00b5 \u00b6 
\u00b7 \u00b8 \u00b9 \u00ba \u00bb \u00bc \u00bd \u00be \u00bf \u00c0 \u00c1 
\u00c2 \u00c3 \u00c4 \u00c5 \u00c6 \u00c7 \u00c8 \u00c9 \u00ca \u00cb \u00cc 
\u00cd \u00ce \u00cf \u00d0 \u00d1 \u00d2 \u00d3 \u00d4 \u00d5 \u00d6 \u00d7 
\u00d8 \u00d9 \u00da \u00db \u00dc \u00dd \u00de \u00df \u00e0 \u00e1 \u00e2 
\u00e3 \u00e4 \u00e5 \u00e6 \u00e7 \u00e8 \u00e9 \u00ea \u00eb \u00ec \u00ed 
\u00ee \u00ef \u00f0 \u00f1 \u00f2 \u00f3 \u00f4 \u00f5 \u00f6 \u00f7 \u00f8 
\u00f9 \u00fa \u00fb \u00fc \u00fd \u00fe \u00ff 

You can also verify that trying to convert to latin1 doesn't
change your character:

[EMAIL PROTECTED] /tmp] echo \u0119 - \u00ea  t.p
[EMAIL PROTECTED] /tmp] native2ascii -encoding latin1 -reverse t.p
\u0119 - ê


Check the html sourcecode in the browser to see what's actually
being transmitted. Verify the encoding/charset specified in the
document header and how the character is actually encoded in the
page.

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: AW: problem with unicode

2004-11-15 Thread Guillaume Cottenceau
Otto, Frank otto 'at' delta-barth.de writes:

 Thanks for your answer. The right character is a polish character: ?

You're sending your mail in latin1. The polish character was
converted to the question mark.
 
 The charset in the document header is:
 
 meta http-equiv=Content-Type content=text/html; charset=iso-8859-2

That should be correct with what you explain.
 
 My character table says \u0119 is ? and not ê. My
 test-html-file contains ê, but ? was displayed. But if I use
 message tag it is wrong.

Please note that ê was just an example in latin1.

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [OT] [Way OT] recommended site to pick up a cheap computer and flat panel?

2004-11-15 Thread Guillaume Cottenceau
Rick Reumann struttin 'at' reumann.net writes:

 I need to pick up a computer for my wife. It doesn't need to be
 anything all that awesome. 2.6-2.8 ghz, 512MB ram is fine. I haven't
 shopped for PCs in a while. Was thinking a refurbished one on
 tigerdirect would be a good bet, but if you guys can recommend some
 other sites I'd appreciate it. My wife also insists on a 17 or 19''
 flat panel (women:), so if you can throw any sites for deals on these
 you know of, it'd be much appreciated.
 
 Offlist is fine if you want to keep down traffic. Thanks and sorry for
 the lazy OT post, but I need to order this stuff real soon.

You want us to select a site which runs Struts?

-- 
Guillaume Cottenceau

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]