Re: get webapp root directory from action constructor

2006-11-06 Thread Antonis Lebesis

Hello,
 I don't know if you still need it, but the "correct" way is to add a
ServletContextListener. To do this, you have to implement the
ServletContextListener interface:

public class FooContextListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent event) {
String homeDir = event.getServletContext().getRealPath("");
}

public void contextDestroyed(ServletContextEvent event) {
}
}

and declare it in the web.xml:







FooContextListener




...


The contextInitialized() method is called when your webapp starts. The
contextDestroyed() is called before the webapp stops and you can use
it to add any cleanup code you wish.

cheers,
Antonis


On 11/3/06, Patrice Le Cozler <[EMAIL PROTECTED]> wrote:

Hi,
I want to load a property file at webapp start. Since that property file is
located in my webapp's directory structure, I want to be able to determine
its absolute name at runtime.
I tried "this.getServlet().getServletContext().getRealPath(PROPS_FILE)" but
"getServlet()" returns null when called from an Action constructor.
Why ?
Is there another way to achieve the same result ? I can't use
MessageResources because it depends on the actual httpRequest instance.

Thanks in advance

Patrice




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



[SOLVED?]: Add request parameter in

2006-10-25 Thread Antonis Lebesis

After a lot of searching, I found that you there is no "struts way" of
adding a request parameter to . I used java code to
solve it:




Antonis.

On 10/25/06, Antonis Lebesis <[EMAIL PROTECTED]> wrote:

Hello Martin,
  thanks for the answer, but I 'm afraid I wasn't clear. I want to set
a parameter to the call of login action not retrieve it in the login
action.

Thanks again,
Antonis

On 10/25/06, Martin Gainty <[EMAIL PROTECTED]> wrote:
> The request parameter is available thru bean:parameter
> be mindful that multiple="true" must be specified in the event you are 
sotring an array
> For more info check out
> 
http://struts.apache.org/1.x/struts-taglib/apidocs/org/apache/struts/taglib/bean/package-summary.html#package_description
>
> Anyone else?
> M-
>
> This e-mail communication and any attachments may contain confidential and 
privileged information for the use of the
> designated recipients named above. If you are not the intended recipient, you 
are hereby notified that you have received
> this communication in error and that any review, disclosure, dissemination, 
distribution or copying of it or its
> contents
> - Original Message -
> From: "Antonis Lebesis" <[EMAIL PROTECTED]>
> To: "struts" 
> Sent: Tuesday, October 24, 2006 7:08 PM
> Subject: Add request parameter in 
>
>
> > Hello,
> >
> >  I want to add a request parameter in  tag. I searched
> > the user guide, but I didn't find anything relevant. Have you any idea
> > on how to do this?
> >
> > The code I 'm using is:
> >
> > 
> > 
> >
> > Thanks,
> > Antonis.
> >
> > -
> > 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]



Re: Add request parameter in

2006-10-25 Thread Antonis Lebesis

Hello Martin,
 thanks for the answer, but I 'm afraid I wasn't clear. I want to set
a parameter to the call of login action not retrieve it in the login
action.

Thanks again,
Antonis

On 10/25/06, Martin Gainty <[EMAIL PROTECTED]> wrote:

The request parameter is available thru bean:parameter
be mindful that multiple="true" must be specified in the event you are sotring 
an array
For more info check out
http://struts.apache.org/1.x/struts-taglib/apidocs/org/apache/struts/taglib/bean/package-summary.html#package_description

Anyone else?
M-

This e-mail communication and any attachments may contain confidential and 
privileged information for the use of the
designated recipients named above. If you are not the intended recipient, you 
are hereby notified that you have received
this communication in error and that any review, disclosure, dissemination, 
distribution or copying of it or its
contents
- Original Message -----
From: "Antonis Lebesis" <[EMAIL PROTECTED]>
To: "struts" 
Sent: Tuesday, October 24, 2006 7:08 PM
Subject: Add request parameter in 


> Hello,
>
>  I want to add a request parameter in  tag. I searched
> the user guide, but I didn't find anything relevant. Have you any idea
> on how to do this?
>
> The code I 'm using is:
>
> 
> 
>
> Thanks,
> Antonis.
>
> -
> 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]



Add request parameter in

2006-10-24 Thread Antonis Lebesis

Hello,

 I want to add a request parameter in  tag. I searched
the user guide, but I didn't find anything relevant. Have you any idea
on how to do this?

The code I 'm using is:




Thanks,
Antonis.

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



Re: Print value of a map

2006-10-01 Thread Antonis Lebesis

You can also try:

 

Antonis

On 10/1/06, Paul Benedict <[EMAIL PROTECTED]> wrote:

Yes, JSTL provides a way:



Where var1 is the name of the bean inside the requestScope (or
sessionScope), and then var2 is the lookup of the bean. The [] notation
works with any collection.

chamal desilva wrote:
> Hi,
>
> Is there a Struts tag to search and print a value of a
> map
>
> for example a tag like this
>
> 
>
> where mapname is the name of map in session or request
> and key is the key in map to be found.
>
> Thanking You,
> Chamal.
>
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> -
> 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]




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



Re: Request parameters in action forward

2006-06-21 Thread Antonis Lebesis

Thanks Lance. This the solution I was looking for...

Antonis

On 6/21/06, Lance Semmens <[EMAIL PROTECTED]> wrote:

You can use an org.apache.struts.action.ActionRedirect

ActionForward forward = mapping.findForward("reload");
ActionRedirect redirect = new ActionRedirect(forward);
redirect.addParameter("id", idValue);
return redirect;


Antonis Lebesis wrote:
> Hi,
>  I do have a SelectFooAction (actually it's called ChooseFooAction
> :)). There is another problem though:
>  This action is used in more than one places so I have to add a
> parameter called action in it's url (action=display for a simple user,
> action=edit for the admin etc). Since I have a lot of foo's, I have a
> form in this page to select which category of Foo's to display. When
> the user selects  a category, the page is reloaded (through another
> "reload" mapping) which leads us from selectFoo.do?action=display to
> selectFoo.do.
>  Do you see a pattern here ;)?
>
> Antonis
>
> On 6/21/06, Monkeyden <[EMAIL PROTECTED]> wrote:
>> >The only thing that I
>> >can think of is to redirect the user to a different (perhaps error)
>>
>> exactly, send them back to wherever they go to select the foo they
>> want to
>> look at.  Do you have a SelectFooAction?
>>
>>
>> On 6/20/06, Antonis Lebesis <[EMAIL PROTECTED]> wrote:
>> >
>> > Thank you Don.
>> > I have done that and the session expiry problem is solved. The
>> > bookmark problem still exists though...
>> > There is a way to overcome this as well:
>> >
>> >   ActionForward forward = new ActionForward();
>> >   forward.setPath(mapping.findForward("reload").getPath() + "&id=23");
>> >
>> > which redirects to http://my.foo.site/loadFoo.do&id=23 , but this is
>> > a hack I wouldn't like to use (plus I would have to change the code
>> > for ~60 classes many of which are DispatchActions: a lot of work
>> > :))...
>> >
>> > Antonis
>> >
>> >
>> > On 6/20/06, Don Vawter <[EMAIL PROTECTED]> wrote:
>> > > Can you take the request parameter and populate a hidden form field
>> > > with it? Mixing request params with form fields
>> > > has caused me grief more than once.
>> > >
>> > > On Jun 19, 2006, at 7:34 PM, Antonis Lebesis wrote:
>> > >
>> > > > Hello,
>> > > >  I have a jsp (foo.jsp) that displays information about a certain
>> > > > foo. I have defined a LoadFooAction, that prepares the foo
>> object and
>> > > > the SubmitFooAction, that is called when I want to change the
>> > > > appearance of foo in foo.jsp [suppose that foo is a list of
>> bars and
>> > > > that I want to change the order of bars (by name, by date etc)].
>> > > >
>> > > >  In struts-config.xml I have defined the following:
>> > > >  
>> > > >
>> > > >  
>> > > >  
>> > > >
>> > > >  
>> > > >
>> > > >  In order to identify which foo to load, I have added a
>> parameter in
>> > > > loadFoo, called id, ie
>> > > >http://my.foo.site/loadFoo.do&id=23
>> > > >
>> > > >  The problem is that when I press submit in foo.jsp, the execute
>> > > > method in SubmitFooAction redirects the browser to
>> > > > http://my.foo.site/loadFoo.do, loosing the id parameter from
>> the url.
>> > > > I can store either foo or "id=23" to session and retrieve them
>> from
>> > > > there when the id parameter is not present, but what happens
>> when the
>> > > > session expires and the user presses refresh or if the user
>> decides to
>> > > > bookmark the page? I end up with a loadFoo.do without any
>> information
>> > > > about which foo to display.
>> > > >
>> > > >  Has any of you dealt with this problem before? The only thing
>> that I
>> > > > can think of is to redirect the user to a different (perhaps
>> error)
>> > > > page when no info is available, but I would really like to be
>> able to
>> > > > do something better than that.
>> > > >
>> > > > Thanks in advance,
>> > > > Antonis
>> > > >
>> > > > PS. I know it's long, but it's 4:30 in the morning (EEST)

Re: Request parameters in action forward

2006-06-20 Thread Antonis Lebesis

Hi,
 I do have a SelectFooAction (actually it's called ChooseFooAction
:)). There is another problem though:
 This action is used in more than one places so I have to add a
parameter called action in it's url (action=display for a simple user,
action=edit for the admin etc). Since I have a lot of foo's, I have a
form in this page to select which category of Foo's to display. When
the user selects  a category, the page is reloaded (through another
"reload" mapping) which leads us from selectFoo.do?action=display to
selectFoo.do.
 Do you see a pattern here ;)?

Antonis

On 6/21/06, Monkeyden <[EMAIL PROTECTED]> wrote:

>The only thing that I
>can think of is to redirect the user to a different (perhaps error)

exactly, send them back to wherever they go to select the foo they want to
look at.  Do you have a SelectFooAction?


On 6/20/06, Antonis Lebesis <[EMAIL PROTECTED]> wrote:
>
> Thank you Don.
> I have done that and the session expiry problem is solved. The
> bookmark problem still exists though...
> There is a way to overcome this as well:
>
>   ActionForward forward = new ActionForward();
>   forward.setPath(mapping.findForward("reload").getPath() + "&id=23");
>
> which redirects to http://my.foo.site/loadFoo.do&id=23 , but this is
> a hack I wouldn't like to use (plus I would have to change the code
> for ~60 classes many of which are DispatchActions: a lot of work
> :))...
>
> Antonis
>
>
> On 6/20/06, Don Vawter <[EMAIL PROTECTED]> wrote:
> > Can you take the request parameter and populate a hidden form field
> > with it? Mixing request params with form fields
> > has caused me grief more than once.
> >
> > On Jun 19, 2006, at 7:34 PM, Antonis Lebesis wrote:
> >
> > > Hello,
> > >  I have a jsp (foo.jsp) that displays information about a certain
> > > foo. I have defined a LoadFooAction, that prepares the foo object and
> > > the SubmitFooAction, that is called when I want to change the
> > > appearance of foo in foo.jsp [suppose that foo is a list of bars and
> > > that I want to change the order of bars (by name, by date etc)].
> > >
> > >  In struts-config.xml I have defined the following:
> > >  
> > >
> > >  
> > >  
> > >
> > >  
> > >
> > >  In order to identify which foo to load, I have added a parameter in
> > > loadFoo, called id, ie
> > >http://my.foo.site/loadFoo.do&id=23
> > >
> > >  The problem is that when I press submit in foo.jsp, the execute
> > > method in SubmitFooAction redirects the browser to
> > > http://my.foo.site/loadFoo.do, loosing the id parameter from the url.
> > > I can store either foo or "id=23" to session and retrieve them from
> > > there when the id parameter is not present, but what happens when the
> > > session expires and the user presses refresh or if the user decides to
> > > bookmark the page? I end up with a loadFoo.do without any information
> > > about which foo to display.
> > >
> > >  Has any of you dealt with this problem before? The only thing that I
> > > can think of is to redirect the user to a different (perhaps error)
> > > page when no info is available, but I would really like to be able to
> > > do something better than that.
> > >
> > > Thanks in advance,
> > > Antonis
> > >
> > > PS. I know it's long, but it's 4:30 in the morning (EEST)...
> > >
> > > -
> > > 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]
> >
> >
>
> -
> 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]



Re: Request parameters in action forward

2006-06-20 Thread Antonis Lebesis

Thank you Don.
 I have done that and the session expiry problem is solved. The
bookmark problem still exists though...
 There is a way to overcome this as well:

  ActionForward forward = new ActionForward();
  forward.setPath(mapping.findForward("reload").getPath() + "&id=23");

 which redirects to http://my.foo.site/loadFoo.do&id=23 , but this is
a hack I wouldn't like to use (plus I would have to change the code
for ~60 classes many of which are DispatchActions: a lot of work
:))...

Antonis


On 6/20/06, Don Vawter <[EMAIL PROTECTED]> wrote:

Can you take the request parameter and populate a hidden form field
with it? Mixing request params with form fields
has caused me grief more than once.

On Jun 19, 2006, at 7:34 PM, Antonis Lebesis wrote:

> Hello,
>  I have a jsp (foo.jsp) that displays information about a certain
> foo. I have defined a LoadFooAction, that prepares the foo object and
> the SubmitFooAction, that is called when I want to change the
> appearance of foo in foo.jsp [suppose that foo is a list of bars and
> that I want to change the order of bars (by name, by date etc)].
>
>  In struts-config.xml I have defined the following:
>  
>
>  
>  
>
>  
>
>  In order to identify which foo to load, I have added a parameter in
> loadFoo, called id, ie
>http://my.foo.site/loadFoo.do&id=23
>
>  The problem is that when I press submit in foo.jsp, the execute
> method in SubmitFooAction redirects the browser to
> http://my.foo.site/loadFoo.do, loosing the id parameter from the url.
> I can store either foo or "id=23" to session and retrieve them from
> there when the id parameter is not present, but what happens when the
> session expires and the user presses refresh or if the user decides to
> bookmark the page? I end up with a loadFoo.do without any information
> about which foo to display.
>
>  Has any of you dealt with this problem before? The only thing that I
> can think of is to redirect the user to a different (perhaps error)
> page when no info is available, but I would really like to be able to
> do something better than that.
>
> Thanks in advance,
> Antonis
>
> PS. I know it's long, but it's 4:30 in the morning (EEST)...
>
> -
> 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]




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



Request parameters in action forward

2006-06-19 Thread Antonis Lebesis

Hello,
 I have a jsp (foo.jsp) that displays information about a certain
foo. I have defined a LoadFooAction, that prepares the foo object and
the SubmitFooAction, that is called when I want to change the
appearance of foo in foo.jsp [suppose that foo is a list of bars and
that I want to change the order of bars (by name, by date etc)].

 In struts-config.xml I have defined the following:
 
   
 
 
   
 

 In order to identify which foo to load, I have added a parameter in
loadFoo, called id, ie
   http://my.foo.site/loadFoo.do&id=23

 The problem is that when I press submit in foo.jsp, the execute
method in SubmitFooAction redirects the browser to
http://my.foo.site/loadFoo.do, loosing the id parameter from the url.
I can store either foo or "id=23" to session and retrieve them from
there when the id parameter is not present, but what happens when the
session expires and the user presses refresh or if the user decides to
bookmark the page? I end up with a loadFoo.do without any information
about which foo to display.

 Has any of you dealt with this problem before? The only thing that I
can think of is to redirect the user to a different (perhaps error)
page when no info is available, but I would really like to be able to
do something better than that.

Thanks in advance,
Antonis

PS. I know it's long, but it's 4:30 in the morning (EEST)...

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



Re: multipart/form-data and character encoding

2006-05-29 Thread Antonis Lebesis

Martin,

I' m not sure what you mean. In my Action's execute() method I get a
request, a response and an ActionForm object. Whatever I do to the
request or response objects, the values from the html form are already
in the actionForm (encoded in a false way). The only way to alter the
Strings in the actionForm is to change the method

getMyString() {
 return this.myString;
}
to
getMyString() {
 return new String(this.myString.getBytes(), "UTF-8");
},

which I already tried and miserably failed :)

Antonis

On 5/30/06, Martin Gainty <[EMAIL PROTECTED]> wrote:

Antonis-

Did you set the characterEncoding for the response e.g.
res.setCharacterEncoding("UTF-8")
???
Martin --

This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

- Original Message -
From: "Antonis Lebesis" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" ; "Martin Gainty"
<[EMAIL PROTECTED]>
Sent: Monday, May 29, 2006 7:26 PM
Subject: Re: multipart/form-data and character encoding


> Hello Martin,
>  I tried your suggestion but there is a difference in my case: The
> enctype in my form's declaration is "multipart/form-data" (I have to
> support file upload). If I leave it that way, I get the same results
> (no greek characters). If I change it to "multipart/form-data;
> charset=iso-8859-7", I get a nice exception :(
>
> javax.servlet.ServletException: BeanUtils.populate
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:497)
> 
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> root cause
>
> java.lang.IllegalArgumentException: argument type mismatch
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> java.lang.reflect.Method.invoke(Method.java:585)
> 
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
> 
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
> 
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
> org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
> org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
> 
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> Any ideas?
>
> Thanks,
> Antonis
>
> On 5/29/06, Martin Gainty <[EMAIL PROTECTED]> wrote:
>> Good Afternoon Antonis-
>>
>> This character encoding issue has been addressed
>> http://issues.apache.org/struts/browse/STR-2117 as follows
>>
>> Set your page to use correct character encoding
>> <%@ page ;contentType="text/html" charset=UTF-8"%>
>>
>> Set form to use correct form encoding
>> 
>>
>> Instruct web container to use selected charset when creating request (in
>> server.xml)
>> 
>>
>> HTH,
>> Martin --
>> - Original Message -
>> From: "Antonis Lebesis" <[EMAIL PROTECTED]>
>> To: 
>> Sent: Monday, May 29, 2006 2:07 PM
>> Subject: multipart/form-data and character encoding
>>
>>
>> Hi,
>>  I 've searched the archives but haven't found any solution to my
>> latest problem. I have with a  input and a 
>> input. The problem is that request.getCharacterEncoding() returns null
>> and the text input is considered to be in iso-8859-1 encoding. In the
>> corresponding ActionForm's reset(), I have added the following line:
>>  request.setCharacterEncoding("ISO

Re: multipart/form-data and character encoding

2006-05-29 Thread Antonis Lebesis

Miguel,

 If you ever come to Greece, remind me to offer you some ouzo and
mousaka ;) It worked just fine! I' ll keep looking for a more
"official" solution, but until then you' ve saved me...

Thank you very very much,
Antonis

On 5/29/06, Miguel Galves <[EMAIL PROTECTED]> wrote:

Antonis,

we had the same problem with multi part forms. We tried everithing,
including enctype in the
form tag, URIEncoding, and request.setEncoding...in reset() method. All
theses solutions worked
fine with all kinds of requests, except for the mulipart, which is handled
in a different way.

The only solution that really worked for us was to create a subclass of
TilesRequestProcessor,
and override the handleRequest method as follows:

public class ScyllaRequestProcessor extends TilesRequestProcessor {

public void process(HttpServletRequest request, HttpServletResponse
response) throws IOException,

ServletException {
try {
request.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}

super.process(request, response);
}

To use this processor, just change the controller entry in struts-config.xml

[]s

Miguel


On 5/29/06, Martin Gainty <[EMAIL PROTECTED]> wrote:
>
> Good Afternoon Antonis-
>
> This character encoding issue has been addressed
> http://issues.apache.org/struts/browse/STR-2117 as follows
>
> Set your page to use correct character encoding
> <%@ page ;contentType="text/html" charset=UTF-8"%>
>
> Set form to use correct form encoding
> 
>
> Instruct web container to use selected charset when creating request (in
> server.xml)
> 
>
> HTH,
> Martin --
> - Original Message -
> From: "Antonis Lebesis" <[EMAIL PROTECTED]>
> To: 
> Sent: Monday, May 29, 2006 2:07 PM
> Subject: multipart/form-data and character encoding
>
>
> Hi,
> I 've searched the archives but haven't found any solution to my
> latest problem. I have with a  input and a 
> input. The problem is that request.getCharacterEncoding() returns null
> and the text input is considered to be in iso-8859-1 encoding. In the
> corresponding ActionForm's reset(), I have added the following line:
> request.setCharacterEncoding("ISO-8859-7");
>
> In forms that don't have a  input, the character set is
> correct. The problem occurs only in this form and from what I 've
> found it is caused by the fact that in the form declaration I have
> added enctype="multipart/form-data".
>
> Has anyone solved this problem?
>
> Thanks,
> Antonis
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
Miguel Galves - Engenheiro de Computação
Já leu meus blogs hoje?
Para geeks http://log4dev.blogspot.com
Pra pessoas normais
http://miguelgalves.blogspot.com

"Não sabendo que era impossível, ele foi lá e fez..."




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



Re: multipart/form-data and character encoding

2006-05-29 Thread Antonis Lebesis

Hello Martin,
 I tried your suggestion but there is a difference in my case: The
enctype in my form's declaration is "multipart/form-data" (I have to
support file upload). If I leave it that way, I get the same results
(no greek characters). If I change it to "multipart/form-data;
charset=iso-8859-7", I get a nice exception :(

javax.servlet.ServletException: BeanUtils.populate
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:497)

org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.IllegalArgumentException: argument type mismatch
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)

org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)

org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)

org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)

org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Any ideas?

Thanks,
Antonis

On 5/29/06, Martin Gainty <[EMAIL PROTECTED]> wrote:

Good Afternoon Antonis-

This character encoding issue has been addressed 
http://issues.apache.org/struts/browse/STR-2117 as follows

Set your page to use correct character encoding
<%@ page ;contentType="text/html" charset=UTF-8"%>

Set form to use correct form encoding


Instruct web container to use selected charset when creating request (in 
server.xml)


HTH,
Martin --
- Original Message -
From: "Antonis Lebesis" <[EMAIL PROTECTED]>
To: 
Sent: Monday, May 29, 2006 2:07 PM
Subject: multipart/form-data and character encoding


Hi,
 I 've searched the archives but haven't found any solution to my
latest problem. I have with a  input and a 
input. The problem is that request.getCharacterEncoding() returns null
and the text input is considered to be in iso-8859-1 encoding. In the
corresponding ActionForm's reset(), I have added the following line:
 request.setCharacterEncoding("ISO-8859-7");

In forms that don't have a  input, the character set is
correct. The problem occurs only in this form and from what I 've
found it is caused by the fact that in the form declaration I have
added enctype="multipart/form-data".

Has anyone solved this problem?

Thanks,
Antonis

-
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]



multipart/form-data and character encoding

2006-05-29 Thread Antonis Lebesis

Hi,
I 've searched the archives but haven't found any solution to my
latest problem. I have with a  input and a 
input. The problem is that request.getCharacterEncoding() returns null
and the text input is considered to be in iso-8859-1 encoding. In the
corresponding ActionForm's reset(), I have added the following line:
request.setCharacterEncoding("ISO-8859-7");

In forms that don't have a  input, the character set is
correct. The problem occurs only in this form and from what I 've
found it is caused by the fact that in the form declaration I have
added enctype="multipart/form-data".

Has anyone solved this problem?

Thanks,
Antonis

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