Re: i18n Forwards

2002-02-25 Thread Dmitri Valdin

I just don't want to get this thread die especially considering the fact,
that beta 1.1 will be released soon. There were several proposals, but there
is still no decision how should struts resolve this problem.
Or perhaps I have missed something.

Dmitri Valdin

  What I was thinking of originally was an approach to creating dynamic
  forwards, which could help with several things, including i18n, browser
  detection, multiple platforms, et cetera.

 * What about using a request parameter in {} directly instead of {0}, {1},
 etc ?
 {locale} can be handled in particular way. I can hardly believe that
 directory order
 would be different for different languages.

 * If we misuse parameter (parameter=forward) we can introduce some
 general
 action for handle cases, similar to one described by Ted.

 action
 path=/search/Name
 type=app.Parameter
 name=searchForm
 scope=request
 validate=false
 parameter=forward
 forward  name=prospect
 path=/do/prospect/SearchName?fullName={name}/

 * Yet another idea. What do you think about introducing a default basis
 handler
 for forwards (similar as it is done for exceptions), which can be
overridden
 and specified in config file ?

 forward  name=prospect
 path=/do/{locale}/prospect/SearchName?fullName={name}
 handler=org.apache.struts.action.ForwardHandler/

 * In order to avoid specifying {locale} in every forward, some kind of
 global pattern can be introduced:

 do/{locale}/forward



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





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




Re: i18n Forwards

2002-02-24 Thread Dmitri Valdin

I just don't want to get this thread die especially considering the fact,
that beta 1.1 will be released soon. There were several proposals, but there
is still no decision how should struts resolve this problem.
Or perhaps I have missed something.

Dmitri Valdin

  What I was thinking of originally was an approach to creating dynamic
  forwards, which could help with several things, including i18n, browser
  detection, multiple platforms, et cetera.

 * What about using a request parameter in {} directly instead of {0}, {1},
 etc ?
 {locale} can be handled in particular way. I can hardly believe that
 directory order
 would be different for different languages.

 * If we misuse parameter (parameter=forward) we can introduce some
 general
 action for handle cases, similar to one described by Ted.

 action
 path=/search/Name
 type=app.Parameter
 name=searchForm
 scope=request
 validate=false
 parameter=forward
 forward  name=prospect
 path=/do/prospect/SearchName?fullName={name}/

 * Yet another idea. What do you think about introducing a default basis
 handler
 for forwards (similar as it is done for exceptions), which can be
overridden
 and specified in config file ?

 forward  name=prospect
 path=/do/{locale}/prospect/SearchName?fullName={name}
 handler=org.apache.struts.action.ForwardHandler/

 * In order to avoid specifying {locale} in every forward, some kind of
 global pattern can be introduced:

 do/{locale}/forward


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





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




Re: i18n Forwards

2002-01-21 Thread Ted Husted

Just to toss something else into the pot here, 

A very cool feature of the Tiles taglib is that it allows you to define
a template and set of replacement parameters (other templates, string
variables), and then call this definition from a Struts ActionForward. 

Using the original Template taglib, you would need to have a seperate
JSP for each of these Definitions, but with Tiles you can manage this
from a single XML document. 

This is really quite slick, and a true test of concept for what we are
discussing here, and in the service manager thread, would be if we can
also plug in the Tiles functionality without extended ActionServlet.
Just be extending ActionForward and leverage the service manager (to
load the Tiles definitions - expressed as an XML document of course).

I need to sit down and get this all straight in my mind soon, but just
wanted to put Tiles on the table here.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/

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




Re: i18n Forwards

2002-01-20 Thread Dmitri Valdin

 What I was thinking of originally was an approach to creating dynamic
 forwards, which could help with several things, including i18n, browser
 detection, multiple platforms, et cetera.

* What about using a request parameter in {} directly instead of {0}, {1},
etc ?
{locale} can be handled in particular way. I can hardly believe that
directory order
would be different for different languages.

* If we misuse parameter (parameter=forward) we can introduce some
general
action for handle cases, similar to one described by Ted.

action
path=/search/Name
type=app.Parameter
name=searchForm
scope=request
validate=false
parameter=forward
forward  name=prospect
path=/do/prospect/SearchName?fullName={name}/

* Yet another idea. What do you think about introducing a default basis
handler
for forwards (similar as it is done for exceptions), which can be overridden
and specified in config file ?

forward  name=prospect
path=/do/{locale}/prospect/SearchName?fullName={name}
handler=org.apache.struts.action.ForwardHandler/

* In order to avoid specifying {locale} in every forward, some kind of
global pattern can be introduced:

do/{locale}/forward

Dmitri Valdin



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




Re: i18n Forwards

2002-01-16 Thread Yunfeng Hou

Yes, you can get it from request.

And, comitters, what's your opinion about i18n
forwards?
Because sometimes i18n enabled message can only solve
part of the problem to build a multi-language site, it
may require totally different layout for different
language, so if we have i18n forwards will be a big
help.

 --- Ned Nurk [EMAIL PROTECTED] µÄÕýÎÄ£º 
 yeah cool, as long as it takes the HttpServlet- or
 is there a way to get at 
 that from the request object?
 
 From the servlet you can get the ServletContext,
 which can then do a 
 getRealPath() - invaluable if you are trying to see
 what actually exists in 
 your filesystem before determining which file to
 return :-)
 
 regards
 ned
 
 From: Yunfeng Hou [EMAIL PROTECTED]
 Reply-To: Struts Developers List
 [EMAIL PROTECTED]
 To: Struts Developers List
 [EMAIL PROTECTED]
 Subject: Re: i18n Forwards
 Date: Tue, 15 Jan 2002 11:15:28 +0800 (CST)
 
 Well, how about this, make the ActionMapping
 plugable,
 which means, having attribute in struts-config.xml
 to
 define the ActionMapping class. ActionMapping
 becomes
 an interface having methods as follow,
 findForward(name, request); getInput(request)
 This way, you can get browser type from request and
 determine the forward accordingly. And I think it
 will
 be very flexible, and will make minimal change to
 struts.
 
 Yunfeng Hou
 
   --- Ned Nurk [EMAIL PROTECTED] µÄÕýÎÄ£º
   What is really needed is a hook to allow the
   application to translate the
   forward page name as it sees fit. We have a
 system
   which changes the page
   name depending on the browser platform which is
   heirachical eg:
  
   default html
 +-- html for ipac size screens
   default wml
 +-- specific wml for nokia
 +-- wml for large screens
  
   the decision tree is loaded in from an XML at
 the
   start of the app. When
   forwarding to a page, it checks for the most
   specific version of the file
   (say wml for large screens), if that doesn't
 exist
   it will look for its
   parent, and so on. (all cached as well so it
 doesnt
   need to check again)
  
   so really want an interface which exposes a
 function
   which takes the input
   filename, the request and the servlet object (to
 get
   at the app file
   system).
  
   that same interface could be used for Yunfeng's
   problem too.
  
   Regards
   Ned
  
   From: Yunfeng Hou [EMAIL PROTECTED]
   Reply-To: Struts Developers List
   [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Subject: Re: i18n Forwards
   Date: Tue, 15 Jan 2002 02:38:15 +0800 (CST)
   
   I am really glad to see this this topic, and
 would
   like to share some of my thoughts, which I made
   modification to struts to make the site work
 for
   both
   Chinese and English.
   1. Input is also treat as one form of forwards,
 so
   it
   can be defined as attribute of action, or 
 forward
   of
   the action.
   2. in struts-config.xml, forwards can be
 defined as
   follows
   action path=... input=input.jsp 
   forward name=success path=success.jsp/
   forward name=success_zh_CN
   path=success_zh_CN.jsp/ or forward
   name=success_zh_CN path=zh/success.jsp/
   forward name=input_zh_CN
   path=input_zh_CN.jsp/
   or forward name=input_zh_CN
   path=zh/input.jsp/
   3. add methods in ActionMapping:
   findForward(name, request), it will use locale
 in
   request to find name+_+locale first, if not
   found,
   will return findForward(name);
   getInput(request), where it will first call
   findForward(input,request), if nothing found,
   will
   return getInput();
   4. Modify ActionServlet to call
 getInput(request)
   instead of getInput()
   
   
   
  
 

_
   Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ!
   http://mail.yahoo.com.cn
   
   font
  

color=#FFÎÞÁÄ£¿ÓôÃÆ£¿¸ßÐË£¿Ã»ÀíÓÉ£¿¶¼À´ÁÄÌì°É£¡/font¡ª¡ª
   ÑÅ»¢È«ÐÂÁÄÌìÊÒ!
   http://cn.chat.yahoo.com/c/roomlist.html
   
   --
   To unsubscribe, e-mail:
  
 mailto:[EMAIL PROTECTED]
   For additional commands, e-mail:
   mailto:[EMAIL PROTECTED]
   
  
  
  
  
  

_
   MSN Photos is the easiest way to share and print
   your photos:
   http://photos.msn.com/support/worldwide.aspx
  
  
   --
   To unsubscribe, e-mail:
  
 mailto:[EMAIL PROTECTED]
   For additional commands, e-mail:
   mailto:[EMAIL PROTECTED]
  
 

_
 Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ!
 http://mail.yahoo.com.cn
 
 font

color=#FFÎÞÁÄ£¿ÓôÃÆ£¿¸ßÐË£¿Ã»ÀíÓÉ£¿¶¼À´ÁÄÌì°É£¡/font¡ª¡ª
 ÑÅ»¢È«ÐÂÁÄÌìÊÒ!
 http://cn.chat.yahoo.com/c/roomlist.html
 
 --
 To unsubscribe, e-mail:   
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: 
 mailto:[EMAIL PROTECTED]
 
 
 
 
 

_
 Send and receive Hotmail on your mobile device:
 http://mobile.msn.com
 
 
 --
 To unsubscribe, e-mail:  
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto

Re: i18n Forwards

2002-01-16 Thread Ted Husted

Yunfeng Hou wrote:
 
 Yes, you can get it from request.
 
 And, comitters, what's your opinion about i18n
 forwards?
 Because sometimes i18n enabled message can only solve
 part of the problem to build a multi-language site, it
 may require totally different layout for different
 language, so if we have i18n forwards will be a big
 help.
 

What I was thinking of originally was an approach to creating dynamic
forwards, which could help with several things, including i18n, browser
detection, multiple platforms, et cetera. 

I'm also thinking it can help with bookmarking and some circumstances
where there is a base forward that needs some additional information
at runtime. This could be a path to an alternate page (i18n, browser
platform) or it could be something like a record number (bookmark). 

I'm doing things like this now by hand, but it would be better to
generalize into the forward object. For example, I wanted to create a
common control that would search various tables by name or number
but the actual field names varied from table to table. 

In the HTML control, I used forward as a switch to select the table,
and name for the HTTP parameter/form bean property where they put in
the search string. 

html:form action=/search/Name
tr bgcolor=#FF
td nowrapFind by name: /td
td nowrap
select size=1 name=forward
onchange=document.forms[1].elements[1].focus()
option value=done-- select --/option
option value=prospectProspect/option
option value=donorDonor/option
option value=itemItem/option
option value=scriptScript/option
/select
input type=text name=name size=10 maxlength=30
html:submitGO/html:submit
/td
/tr
/html:form

in the struts-config, I setup a forwarding action like this:

   action 
path=/search/Name
type=app.Parameter
name=searchForm
scope=request
validate=false
parameter=name
forward 
name=prospect  
path=/do/prospect/SearchName?fullName=/ 
forward 
name=item  
path=/do/item/SearchName?name=/ 
forward 
name=donor  
path=/do/donor/SearchName?fullName=/ 
forward 
name=script  
path=/do/script/SearchTitle?title=/ 
forward 
name=done  
path=/do/Menu?name=/ 
/action

and then sent it over to an Action like this:

 public ActionForward perform(
 ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response) {

// Get forward parameter
String parameter = request.getParameter(Tokens.FORWARD);
// Get parameter name for this mapping
String paramName = mapping.getParameter();

StringBuffer path = new StringBuffer(64);

// Get stub URI from mapping (/do/whatever?paramName=)
path.append(mapping.findForward(parameter).getPath());
// Append the value passed
(/do/whatever?paramName=paramProperty)
path.append(request.getParameter(paramName));

// Return a new forward based on stub+value
return new ActionForward(path.toString());

}

People go through gymnastics like this all the time. So I'm thinking an
generalized solution to i18n, platform, and runtime customization is a
dynamic or smart forward, that can merge a forward with runtime
data. 


 Original Message 
Subject: Re: i18n Forwards
Date: Fri, 14 Dec 2001 16:05:20 -0800 (PST)
From: Craig R. McClanahan [EMAIL PROTECTED]
Reply-To: Struts Developers List [EMAIL PROTECTED]
To: Struts Developers List [EMAIL PROTECTED]

On Fri, 14 Dec 2001, Ted Husted wrote:

 Date: Fri, 14 Dec 2001 18:18:18 -0500
 From: Ted Husted [EMAIL PROTECTED]
 Reply-To: Struts Developers List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: i18n Forwards

 Have we ever talked about a standard subclass for ActionForward that
 would automatically expand a path based on the user's locale. I'm pretty
 sure this has come up on the user list, where people were changing the
 forward dynamically in the Action. But maybe we should have a standard
 ActionForward subclass so that you could do like

 forward name=whatever path=\pages\{*}\whatever.jsp locale=true/

 and have it expand to

 \pages\es\whatever.jsp or
 \pages\en\whatever.jsp

 at runtime.

 Or is that too application specific?

 The message resources are great for cobbling together messages, but I
 doubt that it would be a good solution for larger sites.

 But then, what do I know about i18n projects ;-)


I like the idea.

I think the Apache pattern is to add a Locale suffix
(/pages/whatever.jsp
-- /pages/whatever.jsp.es).  This would probably not work well when JSP
pages are extension mapped, but using a replacement pattern lets the
user
configure this to match their own environment.

I would suggest the following as implementation considerations:

* We can just make the existing ActionForward class smarter by adding

Re: i18n Forwards

2002-01-16 Thread Craig R. McClanahan



On Wed, 16 Jan 2002, [gb2312] Yunfeng Hou wrote:

 Date: Wed, 16 Jan 2002 19:56:47 +0800 (CST)
 From: [gb2312] Yunfeng Hou [EMAIL PROTECTED]
 Reply-To: Struts Developers List [EMAIL PROTECTED]
 To: Struts Developers List [EMAIL PROTECTED]
 Subject: Re: i18n Forwards

 Yes, you can get it from request.


For maximum portability, using getRealPath() is problematic -- you will
always get a null back if your webapp is running out of a WAR file
directly.  Use ServletContext.getResource() or
ServletContext.getResourceAsStream() instead.

 And, comitters, what's your opinion about i18n
 forwards?
 Because sometimes i18n enabled message can only solve
 part of the problem to build a multi-language site, it
 may require totally different layout for different
 language, so if we have i18n forwards will be a big
 help.


I think you have identified a very real problem, and am exploring ways
that Struts could be extended to deal with it.  Do you think that putting
i18n-sensitive support into forward is all we need, or do we need to
think about action mapping that is i18n-sensitive as well?

Craig



  --- Ned Nurk [EMAIL PROTECTED] µÄÕýÎÄ£º
  yeah cool, as long as it takes the HttpServlet- or
  is there a way to get at
  that from the request object?
 
  From the servlet you can get the ServletContext,
  which can then do a
  getRealPath() - invaluable if you are trying to see
  what actually exists in
  your filesystem before determining which file to
  return :-)
 
  regards
  ned
 
  From: Yunfeng Hou [EMAIL PROTECTED]
  Reply-To: Struts Developers List
  [EMAIL PROTECTED]
  To: Struts Developers List
  [EMAIL PROTECTED]
  Subject: Re: i18n Forwards
  Date: Tue, 15 Jan 2002 11:15:28 +0800 (CST)
  
  Well, how about this, make the ActionMapping
  plugable,
  which means, having attribute in struts-config.xml
  to
  define the ActionMapping class. ActionMapping
  becomes
  an interface having methods as follow,
  findForward(name, request); getInput(request)
  This way, you can get browser type from request and
  determine the forward accordingly. And I think it
  will
  be very flexible, and will make minimal change to
  struts.
  
  Yunfeng Hou
  
--- Ned Nurk [EMAIL PROTECTED] µÄÕýÎÄ£º
What is really needed is a hook to allow the
application to translate the
forward page name as it sees fit. We have a
  system
which changes the page
name depending on the browser platform which is
heirachical eg:
   
default html
  +-- html for ipac size screens
default wml
  +-- specific wml for nokia
  +-- wml for large screens
   
the decision tree is loaded in from an XML at
  the
start of the app. When
forwarding to a page, it checks for the most
specific version of the file
(say wml for large screens), if that doesn't
  exist
it will look for its
parent, and so on. (all cached as well so it
  doesnt
need to check again)
   
so really want an interface which exposes a
  function
which takes the input
filename, the request and the servlet object (to
  get
at the app file
system).
   
that same interface could be used for Yunfeng's
problem too.
   
Regards
Ned
   
From: Yunfeng Hou [EMAIL PROTECTED]
Reply-To: Struts Developers List
[EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: i18n Forwards
Date: Tue, 15 Jan 2002 02:38:15 +0800 (CST)

I am really glad to see this this topic, and
  would
like to share some of my thoughts, which I made
modification to struts to make the site work
  for
both
Chinese and English.
1. Input is also treat as one form of forwards,
  so
it
can be defined as attribute of action, or
  forward
of
the action.
2. in struts-config.xml, forwards can be
  defined as
follows
action path=... input=input.jsp 
forward name=success path=success.jsp/
forward name=success_zh_CN
path=success_zh_CN.jsp/ or forward
name=success_zh_CN path=zh/success.jsp/
forward name=input_zh_CN
path=input_zh_CN.jsp/
or forward name=input_zh_CN
path=zh/input.jsp/
3. add methods in ActionMapping:
findForward(name, request), it will use locale
  in
request to find name+_+locale first, if not
found,
will return findForward(name);
getInput(request), where it will first call
findForward(input,request), if nothing found,
will
return getInput();
4. Modify ActionServlet to call
  getInput(request)
instead of getInput()



   
  
 
 _
Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ!
http://mail.yahoo.com.cn

font
   
 
 color=#FFÎÞÁÄ£¿ÓôÃÆ£¿¸ßÐË£¿Ã»ÀíÓÉ£¿¶¼À´ÁÄÌì°É£¡/font¡ª¡ª
ÑÅ»¢È«ÐÂÁÄÌìÊÒ!
http://cn.chat.yahoo.com/c/roomlist.html

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

RE: i18n Forwards

2002-01-16 Thread Nicholas Lesiecki

I think that this would be very useful, as we are trying to use a single app
with different skins, which could potentially involve very different page
layouts for essentially the same info...

Cheers,

nick

-Original Message-
From: Ted Husted [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 16, 2002 7:28 AM
To: Struts Developers List
Subject: Re: i18n Forwards


Yunfeng Hou wrote:

 Yes, you can get it from request.

 And, comitters, what's your opinion about i18n
 forwards?
 Because sometimes i18n enabled message can only solve
 part of the problem to build a multi-language site, it
 may require totally different layout for different
 language, so if we have i18n forwards will be a big
 help.


What I was thinking of originally was an approach to creating dynamic
forwards, which could help with several things, including i18n, browser
detection, multiple platforms, et cetera.

I'm also thinking it can help with bookmarking and some circumstances
where there is a base forward that needs some additional information
at runtime. This could be a path to an alternate page (i18n, browser
platform) or it could be something like a record number (bookmark).

I'm doing things like this now by hand, but it would be better to
generalize into the forward object. For example, I wanted to create a
common control that would search various tables by name or number
but the actual field names varied from table to table.

In the HTML control, I used forward as a switch to select the table,
and name for the HTTP parameter/form bean property where they put in
the search string.

html:form action=/search/Name
tr bgcolor=#FF
td nowrapFind by name: /td
td nowrap
select size=1 name=forward
onchange=document.forms[1].elements[1].focus()
option value=done-- select --/option
option value=prospectProspect/option
option value=donorDonor/option
option value=itemItem/option
option value=scriptScript/option
/select
input type=text name=name size=10 maxlength=30
html:submitGO/html:submit
/td
/tr
/html:form

in the struts-config, I setup a forwarding action like this:

   action
path=/search/Name
type=app.Parameter
name=searchForm
scope=request
validate=false
parameter=name
forward
name=prospect
path=/do/prospect/SearchName?fullName=/
forward
name=item
path=/do/item/SearchName?name=/
forward
name=donor
path=/do/donor/SearchName?fullName=/
forward
name=script
path=/do/script/SearchTitle?title=/
forward
name=done
path=/do/Menu?name=/
/action

and then sent it over to an Action like this:

 public ActionForward perform(
 ActionMapping mapping,
 ActionForm form,
 HttpServletRequest request,
 HttpServletResponse response) {

// Get forward parameter
String parameter = request.getParameter(Tokens.FORWARD);
// Get parameter name for this mapping
String paramName = mapping.getParameter();

StringBuffer path = new StringBuffer(64);

// Get stub URI from mapping (/do/whatever?paramName=)
path.append(mapping.findForward(parameter).getPath());
// Append the value passed
(/do/whatever?paramName=paramProperty)
path.append(request.getParameter(paramName));

// Return a new forward based on stub+value
return new ActionForward(path.toString());

}

People go through gymnastics like this all the time. So I'm thinking an
generalized solution to i18n, platform, and runtime customization is a
dynamic or smart forward, that can merge a forward with runtime
data.


 Original Message 
Subject: Re: i18n Forwards
Date: Fri, 14 Dec 2001 16:05:20 -0800 (PST)
From: Craig R. McClanahan [EMAIL PROTECTED]
Reply-To: Struts Developers List [EMAIL PROTECTED]
To: Struts Developers List [EMAIL PROTECTED]

On Fri, 14 Dec 2001, Ted Husted wrote:

 Date: Fri, 14 Dec 2001 18:18:18 -0500
 From: Ted Husted [EMAIL PROTECTED]
 Reply-To: Struts Developers List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: i18n Forwards

 Have we ever talked about a standard subclass for ActionForward that
 would automatically expand a path based on the user's locale. I'm pretty
 sure this has come up on the user list, where people were changing the
 forward dynamically in the Action. But maybe we should have a standard
 ActionForward subclass so that you could do like

 forward name=whatever path=\pages\{*}\whatever.jsp locale=true/

 and have it expand to

 \pages\es\whatever.jsp or
 \pages\en\whatever.jsp

 at runtime.

 Or is that too application specific?

 The message resources are great for cobbling together messages, but I
 doubt that it would be a good solution for larger sites.

 But then, what do I know about i18n projects ;-)


I like the idea.

I think the Apache pattern is to add a Locale suffix

Re: i18n Forwards

2002-01-15 Thread Ned Nurk


yeah cool, as long as it takes the HttpServlet- or is there a way to get at 
that from the request object?

From the servlet you can get the ServletContext, which can then do a 
getRealPath() - invaluable if you are trying to see what actually exists in 
your filesystem before determining which file to return :-)

regards
ned

From: Yunfeng Hou [EMAIL PROTECTED]
Reply-To: Struts Developers List [EMAIL PROTECTED]
To: Struts Developers List [EMAIL PROTECTED]
Subject: Re: i18n Forwards
Date: Tue, 15 Jan 2002 11:15:28 +0800 (CST)

Well, how about this, make the ActionMapping plugable,
which means, having attribute in struts-config.xml to
define the ActionMapping class. ActionMapping becomes
an interface having methods as follow,
findForward(name, request); getInput(request)
This way, you can get browser type from request and
determine the forward accordingly. And I think it will
be very flexible, and will make minimal change to
struts.

Yunfeng Hou

  --- Ned Nurk [EMAIL PROTECTED] µÄÕýÎÄ£º
  What is really needed is a hook to allow the
  application to translate the
  forward page name as it sees fit. We have a system
  which changes the page
  name depending on the browser platform which is
  heirachical eg:
 
  default html
+-- html for ipac size screens
  default wml
+-- specific wml for nokia
+-- wml for large screens
 
  the decision tree is loaded in from an XML at the
  start of the app. When
  forwarding to a page, it checks for the most
  specific version of the file
  (say wml for large screens), if that doesn't exist
  it will look for its
  parent, and so on. (all cached as well so it doesnt
  need to check again)
 
  so really want an interface which exposes a function
  which takes the input
  filename, the request and the servlet object (to get
  at the app file
  system).
 
  that same interface could be used for Yunfeng's
  problem too.
 
  Regards
  Ned
 
  From: Yunfeng Hou [EMAIL PROTECTED]
  Reply-To: Struts Developers List
  [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Subject: Re: i18n Forwards
  Date: Tue, 15 Jan 2002 02:38:15 +0800 (CST)
  
  I am really glad to see this this topic, and would
  like to share some of my thoughts, which I made
  modification to struts to make the site work for
  both
  Chinese and English.
  1. Input is also treat as one form of forwards, so
  it
  can be defined as attribute of action, or  forward
  of
  the action.
  2. in struts-config.xml, forwards can be defined as
  follows
  action path=... input=input.jsp 
  forward name=success path=success.jsp/
  forward name=success_zh_CN
  path=success_zh_CN.jsp/ or forward
  name=success_zh_CN path=zh/success.jsp/
  forward name=input_zh_CN
  path=input_zh_CN.jsp/
  or forward name=input_zh_CN
  path=zh/input.jsp/
  3. add methods in ActionMapping:
  findForward(name, request), it will use locale in
  request to find name+_+locale first, if not
  found,
  will return findForward(name);
  getInput(request), where it will first call
  findForward(input,request), if nothing found,
  will
  return getInput();
  4. Modify ActionServlet to call getInput(request)
  instead of getInput()
  
  
  
 
 _
  Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ!
  http://mail.yahoo.com.cn
  
  font
 
color=#FFÎÞÁÄ£¿ÓôÃÆ£¿¸ßÐË£¿Ã»ÀíÓÉ£¿¶¼À´ÁÄÌì°É£¡/font¡ª¡ª
  ÑÅ»¢È«ÐÂÁÄÌìÊÒ!
  http://cn.chat.yahoo.com/c/roomlist.html
  
  --
  To unsubscribe, e-mail:
  mailto:[EMAIL PROTECTED]
  For additional commands, e-mail:
  mailto:[EMAIL PROTECTED]
  
 
 
 
 
 
_
  MSN Photos is the easiest way to share and print
  your photos:
  http://photos.msn.com/support/worldwide.aspx
 
 
  --
  To unsubscribe, e-mail:
  mailto:[EMAIL PROTECTED]
  For additional commands, e-mail:
  mailto:[EMAIL PROTECTED]
 

_
Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ! http://mail.yahoo.com.cn

font color=#FFÎÞÁÄ£¿ÓôÃÆ£¿¸ßÐË£¿Ã»ÀíÓÉ£¿¶¼À´ÁÄÌì°É£¡/font¡ª¡ª
ÑÅ»¢È«ÐÂÁÄÌìÊÒ! http://cn.chat.yahoo.com/c/roomlist.html

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





_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




Re: i18n Forwards

2002-01-14 Thread Yunfeng Hou

I am really glad to see this this topic, and would
like to share some of my thoughts, which I made
modification to struts to make the site work for both
Chinese and English.
1. Input is also treat as one form of forwards, so it
can be defined as attribute of action, or  forward of
the action.
2. in struts-config.xml, forwards can be defined as
follows
action path=... input=input.jsp 
forward name=success path=success.jsp/
forward name=success_zh_CN
path=success_zh_CN.jsp/ or forward
name=success_zh_CN path=zh/success.jsp/ 
forward name=input_zh_CN path=input_zh_CN.jsp/
or forward name=input_zh_CN path=zh/input.jsp/
3. add methods in ActionMapping: 
findForward(name, request), it will use locale in
request to find name+_+locale first, if not found,
will return findForward(name);
getInput(request), where it will first call
findForward(input,request), if nothing found, will
return getInput();
4. Modify ActionServlet to call getInput(request)
instead of getInput()



_
Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ! http://mail.yahoo.com.cn

font color=#FFÎÞÁÄ£¿ÓôÃÆ£¿¸ßÐË£¿Ã»ÀíÓÉ£¿¶¼À´ÁÄÌì°É£¡/font¡ª¡ª 
ÑÅ»¢È«ÐÂÁÄÌìÊÒ! http://cn.chat.yahoo.com/c/roomlist.html

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




Re: i18n Forwards

2002-01-14 Thread Ned Nurk


What is really needed is a hook to allow the application to translate the 
forward page name as it sees fit. We have a system which changes the page 
name depending on the browser platform which is heirachical eg:

default html
  +-- html for ipac size screens
default wml
  +-- specific wml for nokia
  +-- wml for large screens

the decision tree is loaded in from an XML at the start of the app. When 
forwarding to a page, it checks for the most specific version of the file 
(say wml for large screens), if that doesn't exist it will look for its 
parent, and so on. (all cached as well so it doesnt need to check again)

so really want an interface which exposes a function which takes the input 
filename, the request and the servlet object (to get at the app file 
system).

that same interface could be used for Yunfeng's problem too.

Regards
Ned

From: Yunfeng Hou [EMAIL PROTECTED]
Reply-To: Struts Developers List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: i18n Forwards
Date: Tue, 15 Jan 2002 02:38:15 +0800 (CST)

I am really glad to see this this topic, and would
like to share some of my thoughts, which I made
modification to struts to make the site work for both
Chinese and English.
1. Input is also treat as one form of forwards, so it
can be defined as attribute of action, or  forward of
the action.
2. in struts-config.xml, forwards can be defined as
follows
action path=... input=input.jsp 
forward name=success path=success.jsp/
forward name=success_zh_CN
path=success_zh_CN.jsp/ or forward
name=success_zh_CN path=zh/success.jsp/
forward name=input_zh_CN path=input_zh_CN.jsp/
or forward name=input_zh_CN path=zh/input.jsp/
3. add methods in ActionMapping:
findForward(name, request), it will use locale in
request to find name+_+locale first, if not found,
will return findForward(name);
getInput(request), where it will first call
findForward(input,request), if nothing found, will
return getInput();
4. Modify ActionServlet to call getInput(request)
instead of getInput()



_
Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ! http://mail.yahoo.com.cn

font color=#FFÎÞÁÄ£¿ÓôÃÆ£¿¸ßÐË£¿Ã»ÀíÓÉ£¿¶¼À´ÁÄÌì°É£¡/font¡ª¡ª
ÑÅ»¢È«ÐÂÁÄÌìÊÒ! http://cn.chat.yahoo.com/c/roomlist.html

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





_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




Re: i18n Forwards

2002-01-14 Thread Yunfeng Hou

Well, how about this, make the ActionMapping plugable,
which means, having attribute in struts-config.xml to
define the ActionMapping class. ActionMapping becomes
an interface having methods as follow,
findForward(name, request); getInput(request)
This way, you can get browser type from request and
determine the forward accordingly. And I think it will
be very flexible, and will make minimal change to
struts.

Yunfeng Hou

 --- Ned Nurk [EMAIL PROTECTED] µÄÕýÎÄ£º 
 What is really needed is a hook to allow the
 application to translate the 
 forward page name as it sees fit. We have a system
 which changes the page 
 name depending on the browser platform which is
 heirachical eg:
 
 default html
   +-- html for ipac size screens
 default wml
   +-- specific wml for nokia
   +-- wml for large screens
 
 the decision tree is loaded in from an XML at the
 start of the app. When 
 forwarding to a page, it checks for the most
 specific version of the file 
 (say wml for large screens), if that doesn't exist
 it will look for its 
 parent, and so on. (all cached as well so it doesnt
 need to check again)
 
 so really want an interface which exposes a function
 which takes the input 
 filename, the request and the servlet object (to get
 at the app file 
 system).
 
 that same interface could be used for Yunfeng's
 problem too.
 
 Regards
 Ned
 
 From: Yunfeng Hou [EMAIL PROTECTED]
 Reply-To: Struts Developers List
 [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Re: i18n Forwards
 Date: Tue, 15 Jan 2002 02:38:15 +0800 (CST)
 
 I am really glad to see this this topic, and would
 like to share some of my thoughts, which I made
 modification to struts to make the site work for
 both
 Chinese and English.
 1. Input is also treat as one form of forwards, so
 it
 can be defined as attribute of action, or  forward
 of
 the action.
 2. in struts-config.xml, forwards can be defined as
 follows
 action path=... input=input.jsp 
 forward name=success path=success.jsp/
 forward name=success_zh_CN
 path=success_zh_CN.jsp/ or forward
 name=success_zh_CN path=zh/success.jsp/
 forward name=input_zh_CN
 path=input_zh_CN.jsp/
 or forward name=input_zh_CN
 path=zh/input.jsp/
 3. add methods in ActionMapping:
 findForward(name, request), it will use locale in
 request to find name+_+locale first, if not
 found,
 will return findForward(name);
 getInput(request), where it will first call
 findForward(input,request), if nothing found,
 will
 return getInput();
 4. Modify ActionServlet to call getInput(request)
 instead of getInput()
 
 
 

_
 Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ!
 http://mail.yahoo.com.cn
 
 font

color=#FFÎÞÁÄ£¿ÓôÃÆ£¿¸ßÐË£¿Ã»ÀíÓÉ£¿¶¼À´ÁÄÌì°É£¡/font¡ª¡ª
 ÑÅ»¢È«ÐÂÁÄÌìÊÒ!
 http://cn.chat.yahoo.com/c/roomlist.html
 
 --
 To unsubscribe, e-mail:   
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: 
 mailto:[EMAIL PROTECTED]
 
 
 
 
 

_
 MSN Photos is the easiest way to share and print
 your photos: 
 http://photos.msn.com/support/worldwide.aspx
 
 
 --
 To unsubscribe, e-mail:  
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
  

_
Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ! http://mail.yahoo.com.cn

font color=#FFÎÞÁÄ£¿ÓôÃÆ£¿¸ßÐË£¿Ã»ÀíÓÉ£¿¶¼À´ÁÄÌì°É£¡/font¡ª¡ª 
ÑÅ»¢È«ÐÂÁÄÌìÊÒ! http://cn.chat.yahoo.com/c/roomlist.html

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




Re: i18n Forwards

2002-01-14 Thread Ted Husted

It is pluggable ;-)

Yunfeng Hou wrote:
 
 Well, how about this, make the ActionMapping plugable,
 which means, having attribute in struts-config.xml to
 define the ActionMapping class. ActionMapping becomes
 an interface having methods as follow,
 findForward(name, request); getInput(request)
 This way, you can get browser type from request and
 determine the forward accordingly. And I think it will
 be very flexible, and will make minimal change to
 struts.
 
 Yunfeng Hou
 
  --- Ned Nurk [EMAIL PROTECTED] µÄÕýÎÄ£º
  What is really needed is a hook to allow the
  application to translate the
  forward page name as it sees fit. We have a system
  which changes the page
  name depending on the browser platform which is
  heirachical eg:
 
  default html
+-- html for ipac size screens
  default wml
+-- specific wml for nokia
+-- wml for large screens
 
  the decision tree is loaded in from an XML at the
  start of the app. When
  forwarding to a page, it checks for the most
  specific version of the file
  (say wml for large screens), if that doesn't exist
  it will look for its
  parent, and so on. (all cached as well so it doesnt
  need to check again)
 
  so really want an interface which exposes a function
  which takes the input
  filename, the request and the servlet object (to get
  at the app file
  system).
 
  that same interface could be used for Yunfeng's
  problem too.
 
  Regards
  Ned
 
  From: Yunfeng Hou [EMAIL PROTECTED]
  Reply-To: Struts Developers List
  [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Subject: Re: i18n Forwards
  Date: Tue, 15 Jan 2002 02:38:15 +0800 (CST)
  
  I am really glad to see this this topic, and would
  like to share some of my thoughts, which I made
  modification to struts to make the site work for
  both
  Chinese and English.
  1. Input is also treat as one form of forwards, so
  it
  can be defined as attribute of action, or  forward
  of
  the action.
  2. in struts-config.xml, forwards can be defined as
  follows
  action path=... input=input.jsp 
  forward name=success path=success.jsp/
  forward name=success_zh_CN
  path=success_zh_CN.jsp/ or forward
  name=success_zh_CN path=zh/success.jsp/
  forward name=input_zh_CN
  path=input_zh_CN.jsp/
  or forward name=input_zh_CN
  path=zh/input.jsp/
  3. add methods in ActionMapping:
  findForward(name, request), it will use locale in
  request to find name+_+locale first, if not
  found,
  will return findForward(name);
  getInput(request), where it will first call
  findForward(input,request), if nothing found,
  will
  return getInput();
  4. Modify ActionServlet to call getInput(request)
  instead of getInput()
  
  
  
 
 _
  Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ!
  http://mail.yahoo.com.cn
  
  font
 
 color=#FFÎÞÁÄ£¿ÓôÃÆ£¿¸ßÐË£¿Ã»ÀíÓÉ£¿¶¼À´ÁÄÌì°É£¡/font¡ª¡ª
  ÑÅ»¢È«ÐÂÁÄÌìÊÒ!
  http://cn.chat.yahoo.com/c/roomlist.html
  
  --
  To unsubscribe, e-mail:
  mailto:[EMAIL PROTECTED]
  For additional commands, e-mail:
  mailto:[EMAIL PROTECTED]
  
 
 
 
 
 
 _
  MSN Photos is the easiest way to share and print
  your photos:
  http://photos.msn.com/support/worldwide.aspx
 
 
  --
  To unsubscribe, e-mail:
  mailto:[EMAIL PROTECTED]
  For additional commands, e-mail:
  mailto:[EMAIL PROTECTED]
 
 
 _
 Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ! http://mail.yahoo.com.cn
 
 font color=#FFÎÞÁÄ£¿ÓôÃÆ£¿¸ßÐË£¿Ã»ÀíÓÉ£¿¶¼À´ÁÄÌì°É£¡/font¡ª¡ª
 ÑÅ»¢È«ÐÂÁÄÌìÊÒ! http://cn.chat.yahoo.com/c/roomlist.html
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Building Java web applications with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/

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




Re: i18n Forwards

2001-12-14 Thread Ted Husted

Craig R. McClanahan wrote:
 Doing something smart (like a browser-detection mechanism) sounds like a
 good case for an application subclass of ActionForward that overrides the
 getPath(Locale) method.  Perhaps we should pass in the current request,
 instead of the Locale, so that the method could get whatever it needed.

+1 

And for the record, I don't think any of us want to get into a
browser-detection mechanism, just provide a hook for anything like that
that an application might want to use.


 You mean in the getMessage() method signatures?  It'd be pretty easy to
 add one more overloaded method that takes an array instead.

Yes. People have asked about that several times, but I've never been
sure of the answer. I wondered if it was because we had to use a certain
number of parameters in the bean tags. But we could do both, yes?


-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/struts/

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




Re: i18n Forwards

2001-12-14 Thread Ted Husted

I was wondering, how would we feel about using Bugzilla for a TODO list.
I could convert this thread to a Bugzilla enhancement, and then link to
that from the TODO page. Over time, we could cover the TODOs to
Enhancements, and then just link to our Bugzilla enhancements for the
TODO list.


-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/struts/

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