Re: RE: re. i18n

2002-10-25 Thread Vernon Wu

To my knowledge, there are two ways to set up locale. One is to use the container's 
configuration setting for 
application. The other is to have an application itself session locale attribute. The 
Struts as well as the PetStore use the 
second approach. The locale setting can be changed inside of the container by either 
calling Config.set method for the 
first approach, or reset the locale variable value,

session.setAttribute(org.apache.struts.action.Action.LOCALE_KEY,newLocale);

for the Struts case for the second approach.

The statement, ?locale is unchangeable during a session? is still not true even in 
Struts. Does your code also 
demonstrate locale resetting?
 

10/22/2002 8:15:28 AM, Russ Bonsall <[EMAIL PROTECTED]> wrote:

>
>Vernon,
>
>The last time I checked the Pet Store application does not use Struts.  If
>you look at the Struts source code you will find that the user's locale is
>stored in session and is later used when reconciling which message resources
>to use.  Look at the processLocale() method from the RequestProcessor below
>(very similar to the processLocale() in ActionServlet for 1.0.2).
>
>
>Jeff, 
>
>It appears you are doing everything right.  I think you're right in saying
>there is something small that you're missing.  You shouldn't need to change
>any localization settings through Control Panel.  The browser setting is
>what is sent with your request.  I'm sorry I couldn't be of more help.
>
>Russ
>
>
>protected void processLocale(HttpServletRequest request,
> HttpServletResponse response) {
>
>// Are we configured to select the Locale automatically?
>if (!appConfig.getControllerConfig().getLocale()) {
>return;
>}
>
>// Has a Locale already been selected?
>HttpSession session = request.getSession();
>if (session.getAttribute(Action.LOCALE_KEY) != null) {
>return;
>}
>
>// Use the Locale returned by the servlet container (if any)
>Locale locale = request.getLocale();
>if (locale != null) {
>if (log.isDebugEnabled()) {
>log.debug(" Setting user locale '" + locale + "'");
>}
>session.setAttribute(Action.LOCALE_KEY, locale);
>}
>
>}
>
>-Original Message-
>From: Vernon Wu [mailto:vernonw@;gatewaytech.com]
>Sent: Monday, October 21, 2002 4:30 PM
>To: [EMAIL PROTECTED]
>Subject: re. i18n
>
>
>
>I saw the following statement in today mail archive.
>
>   Also keep in mind that the locality is stored in session.  This
>means you
>   cannot switch languages while using the same session.  The best way
>to test
>   is by setting your language, close and reopen your browser.
>
>This statement is not true. The Pet Store allows users change the locale
>anywhere in the middle of session. You can 
>test out yourself by driving a demo version from 
>http://developer.java.sun.com/developer/technicalArticles/J2EE/deployathon3/
>
>BTW, the locale information management, including changing locale method,
>demonstrated in the latest version PS is 
>not the best way by today's standard. Take a look at JSP/JSTL articales on
>onjava.com by Hans Bergsten.
>
>Hope this helps.
>
>Vernon
>
>
>




--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>




re. i18n

2002-10-21 Thread Vernon Wu

I saw the following statement in today mail archive.

Also keep in mind that the locality is stored in session.  This means you
cannot switch languages while using the same session.  The best way to test
is by setting your language, close and reopen your browser.

This statement is not true. The Pet Store allows users change the locale anywhere in 
the middle of session. You can 
test out yourself by driving a demo version from 
http://developer.java.sun.com/developer/technicalArticles/J2EE/deployathon3/

BTW, the locale information management, including changing locale method, demonstrated 
in the latest version PS is 
not the best way by today's standard. Take a look at JSP/JSTL articales on onjava.com 
by Hans Bergsten.

Hope this helps.

Vernon



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Book Opinions

2002-10-20 Thread Vernon Wu
Nat,

I am thinking about walking the opposite direction as you do. After playing about the 
Pet Market from Macromedia MX, I 
wish my Java Web application have the degree of rich UI. You might be able to tell me 
how to add the MX on the top 
of Struts, or similar MVC Java web application: replaying JSP, the "V" with MX, also 
the "V" with least possible work.

I don't know any Struts books out there. But you shall be able to find tons of on-line 
tutorial in the subject. Remember 
"Google is yor friend". One book I can recommend is "Advanced JaveServer Pages" by 
David Geary. The frameworks 
introduced in the book are very similar with those in Struts, including MVC one.

If you want to write back, please send to my email address.

Regards,

Vernon  

10/20/2002 9:32:49 PM, "Nat Papovich" <[EMAIL PROTECTED]> wrote:

>Hello All -
>
>I'm a recent addition to this list, while I begin learning Struts. Not only am I
>beginning to learn Struts, I'm beginning to learn all things Java.
>
>I come from a ColdFusion/Fusebox background, but as a "leader" in that
>community, I have secretly wanted more structure from a framework, along with
>transitioning to a more "robust" web language. Fusebox also does an incomplete,
>kludgy job dealing with MVC, of which I am fond.
>
>I'm quickly getting knee-deep in many resources, and am burning through my old
>"to be read" book collection of OO programming and JSP (working on Bruce Eckel's
>Thinking in Java now). I consider myself to be well-versed in OO, very
>comfortable with structured programming (structured meaning well-designed in
>this case, not opposed to OO), but being a huge proponent of ColdFusion's
>leading framework, I recognize the importance of starting off on the right foot
>in my J2EE adventure (and think Struts is that right foot).
>
>That exhaustive background was meant to help you fine folks make book
>recommendations for me. I have bookmarked and visit some of the excellent online
>resources for Struts and Java, but I'm the kind of guy who likes to spend money,
>have something bound, with a glossy cover, sitting on my desk - it's like a
>security blanket to me.
>
>So of the apparently excellent titles either currently available or
>soon-to-be-released, which one should I start with? Undoubtedly, I will acquire
>another, and another, but for now... ?
>
>Thanks,
>NAT
>
>Nat Papovich
>Senior Partner & Lead Architect
>Fusium, Inc.
>503-913-1659
>Buy the book: http://fusium.com/go/book
>
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




A better practice: environment entry vs. initialization parameter?

2002-10-20 Thread Vernon Wu


A few of email addresses needed to be accessed from time to time in my current 
project. They can be definited either as 
initialization parameters or environment entries. I can see some pros and cons of 
those two implementations. Do 
someone have  some experience with those two implementation for a heavy loaded 
application?

Thanks for sharing your informaiton.

Vernon



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: RE: How can I get a value from a Javascript for a formbean?

2002-10-03 Thread Vernon Wu

Hi, Mark,

Thanks for sharing your code.

I haven't use Javascript a lot and am sort of figuring out how the JavaScript code 
works: the data will be stored in the 
formbean after the submit button is clicked. It will great appreciated if you can 
elabourate how it works with a formbean.

Regards,

Vernon

10/3/2002 5:42:19 AM, "Galbreath, Mark" <[EMAIL PROTECTED]> wrote:

>Use the attached JavaScript file for your codebase and call the appropriate
>function based on the user's action (onChange(), delete, submite, etc.).
>It's self-evident what values need to be passed.
>
>Mark
>
>-Original Message-
>From: Vernon Wu [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, October 02, 2002 9:42 PM
>To: [EMAIL PROTECTED]
>Subject: How can I get a value from a Javascript for a formbean?
>
>
>I have two selected lists in a form. The data in the second list will change
>accordingly when the selected item in the first 
>list is changed. My question is how to get the second selected item for the
>formbean. I use a framworks similar with 
>Struts. Here is the code segment:
>
>  
> value="-1">-1
> value="0">0
> value="1">1
> value="2">2
>  
>  
>    
>  
>
>
>
>function SetField02(){
>   //...   
>   return ;
>}
>
>
>
>
>
>--
>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]>




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




How can I get a value from a Javascript for a formbean?

2002-10-02 Thread Vernon Wu

I have two selected lists in a form. The data in the second list will change 
accordingly when the selected item in the first 
list is changed. My question is how to get the second selected item for the formbean. 
I use a framworks similar with 
Struts. Here is the code segment:

  
 value="-1">-1
 value="0">0
 value="1">1
 value="2">2
  
  
 
  



function SetField02(){
//...   
return ;
}





--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: RE: RE: The right place/time to clean up a session before sessiontim e out, or user logoff

2002-09-24 Thread Vernon Wu


Jason,

Your solution covers the log off case. How about session time out, say, a user leave a 
page of the application and 
browse another site. There isn't log off action in this case. 

 
9/23/2002 7:31:36 PM, "Miller, Jason" <[EMAIL PROTECTED]> wrote:





--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: RE: RE: The right place/time to clean up a session before sessiontim e out, or user logoff

2002-09-23 Thread Vernon Wu

Jason,

Now, I see what you're doing here. Rather than calling the session invalidate method 
in the log off, you call the method 
to clean up the session. That is some thought. I, however, think there shall be a more 
straight forward solution than 
twise thing around by the servlet desing.

Thanks for explaining your solution.

Vernon
 
9/23/2002 7:31:36 PM, "Miller, Jason" <[EMAIL PROTECTED]> wrote:





--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: RE: User Notification

2002-09-23 Thread Vernon Wu


What else would you suggest? 

The reason I am thinking about use DOM is that messages are stored in a XML format in 
DB since the number of 
messages can vary. The XML format data needs to be parsed either SAX or DOM. If DOM 
parsing is too slow, SAX 
parsing into a collection object is a way to get around.

   
9/23/2002 3:03:49 PM, "Galbreath, Mark" <[EMAIL PROTECTED]> wrote:

>I hope he means stored as an XML doc.  Parsing DOMs are notoriously slow.
>
>-Original Message-
>From: Eddie Bush [mailto:[EMAIL PROTECTED]]
>Sent: Monday, September 23, 2002 5:41 PM
>
>Sounds like a simple DB-lookup to me.  You aren't going to update the 
>client until they refresh at page at least.  You'd just have to include 
>something that polled for new messages in each page you wanted them to 
>receive notification.  I'm not familiar with what you mean by "stored as 
>a DOM" or the implications of that, so maybe this is a bad suggestion ;-)
>
>Vernon Wu wrote:
>
>>I need to implement a message system, sort like email but inside the Java
>web application only for its users. After one 
>>user, A, sends a message to another, B, B shall be notified to retrieve the
>updated messages if B is on line. I plan to 
>>implement messages as stored in a DOM. My question is how the notification
>shall be implemented.  I only use a web 
>>container, and considering to add in a JMS server for IM.
>>
>>Any suggestions?
>>
>>Thanks,
>>
>>Vernon
>>
>
>-- 
>Eddie Bush
>
>
>
>
>--
>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]>
>
>




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




Re: Struts vs. JSTL for i18n

2002-09-23 Thread Vernon Wu


That can't be true since JSTL comes after the Struts tag library. 

What is your definition of "easier"? 

9/23/2002 4:22:21 PM, Matt Raible <[EMAIL PROTECTED]> wrote:

>It seems that Struts makes it much easier to do i18n than JSTL.  Please
>correct me if I'm wrong.
>
>Struts = 
>
>JSTL = 
>  
>   
>  
>
>Thanks,
>
>Matt
>
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: User Notification

2002-09-23 Thread Vernon Wu


I don't follow you. Can you explain with more details?

9/23/2002 3:55:04 PM, Eddie Bush <[EMAIL PROTECTED]> wrote:

>Yeah you could persist it to a DB though and show the message from the 
>DB when they ask to do that... and just rely on your 
>session-manager-thingie for notification.
>
>James Higginbotham wrote:
>
>>Ok, then you could use JMS to store a message in a topic and check for
>>it on each request to show the user an indicator if a message exists.
>>But, unless you turn off persistence for the topic, you will be using a
>>DB on the backend anyway. And a query against a DB on a field that is
>>indexed (such as the userid) would be very fast. 
>>
>>The other option (assuming you are using only 1 server or have sticky
>>sessions in place) is to create a session manager that you store these
>>messages in a list, stored in a hash keyed by user id. It would probably
>>be a singleton within the app server's VM. You would then check this
>>manager on each request and show the indicator/message as appropriate.
>>Just attach a session listener so that when the user's session times out
>>or you kill it forcefully, your session manager will drop any existing
>>messages. Course, this isn't persistent so if the user isn't signed in,
>>they will never get the message (thus, see option 1 and previous posts
>>to this list). 
>>
>>James
>>
>
>-- 
>Eddie Bush
>
>
>
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: RE: The right place/time to clean up a session before session time out, or user logoff

2002-09-23 Thread Vernon Wu


I have tried something similar with yours: a object stored in the session and with a 
HttpSessionBindingListener 
implementation. When the invalidate method is called in the logoff action, it is too 
late for the valueUnbound method to 
retrieve anything from the session since it is invalid already.

9/23/2002 2:56:58 PM, "Miller, Jason" <[EMAIL PROTECTED]> wrote:





--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: User Notification

2002-09-23 Thread Vernon Wu


I want to have a better implementaiton over unnecessary DB access. That is the reason 
I would like to use a 
notification mechanism. 


9/23/2002 2:41:05 PM, Eddie Bush <[EMAIL PROTECTED]> wrote:

>Sounds like a simple DB-lookup to me.  You aren't going to update the 
>client until they refresh at page at least.  You'd just have to include 
>something that polled for new messages in each page you wanted them to 
>receive notification.  I'm not familiar with what you mean by "stored as 
>a DOM" or the implications of that, so maybe this is a bad suggestion ;-)
>
>Vernon Wu wrote:
>
>>I need to implement a message system, sort like email but inside the Java web 
>application only for its users. After one 
>>user, A, sends a message to another, B, B shall be notified to retrieve the updated 
>messages if B is on line. I plan to 
>>implement messages as stored in a DOM. My question is how the notification shall be 
>implemented.  I only use a web 
>>container, and considering to add in a JMS server for IM.
>>
>>Any suggestions?
>>
>>Thanks,
>>
>>Vernon
>>
>
>-- 
>Eddie Bush
>
>
>
>
>--
>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]>




The right place/time to clean up a session before session time out,or user logoff

2002-09-23 Thread Vernon Wu

In order to keep track of who is online, I need to keep a list of on line users. When 
a user sign in, which can have more 
than one routes, an account information object is created. The class implements the 
HttpSessionBindingListener 
interface. The user id is added into the list in the valueBound method. 

I would like to have a single one place to remove the user id from the list when user 
sign out, or session time out. The 
valueUnbound method is not a good place since the session is invalidated already when 
the invalidate method is 
called. The sessionDestroyed method of the HttpSessionListener interface isn't a right 
place neither.

Any suggestions?





--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




User Notification

2002-09-23 Thread Vernon Wu

I need to implement a message system, sort like email but inside the Java web 
application only for its users. After one 
user, A, sends a message to another, B, B shall be notified to retrieve the updated 
messages if B is on line. I plan to 
implement messages as stored in a DOM. My question is how the notification shall be 
implemented.  I only use a web 
container, and considering to add in a JMS server for IM.

Any suggestions?

Thanks,

Vernon



--
To unsubscribe, e-mail:   
For additional commands, e-mail: