The name of application resources?

2002-09-17 Thread Juraj Kazda

Hello everyone,

I'm new to Struts and while discovering its magic I have short question:


Is it possible to get the name of file with internationalized
messages (ie. ApplicationResources.properties, or generally, the name
set up in message-resources element of strusts-config.xml)?


I found something like org.apache.struts.config.MessageResources in
documentation, but how can I obtain instance of this class valid for
actual application?

Thank you very much.


-jerryk.




smime.p7s
Description: application/pkcs7-signature


RE: The name of application resources?

2002-09-17 Thread Juraj Kazda

Hello James.

Yes, I suppose to use it in action class. This action class is
responsible for changing the Locale/language of application. I know,
that if I try to change to language which appropriate message file is
not available, default .properties file will be used. However, I use
logging in my action class and I want to log something like - No such
resources available. I just want to try to check if that file exists
(the name from message-resource element + parameter from reguest) and if
not, log that.

-jerryk.



=
Juraj Kazda
ICQ : 135207538
=


 -Original Message-
 From: James Mitchell [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, September 17, 2002 4:27 PM
 To: Struts Users Mailing List
 Subject: RE: The name of application resources?
 
 
 Perhaps it would be better to explain what you want to do 
 before you do
 this.
 
 Why do you need to extract the name?  Are you needing this in 
 your action
 class?
 
 James Mitchell
 Software Engineer\Struts Evangelist
 Struts-Atlanta, the Open Minded Developer Network
 http://www.open-tools.org/struts-atlanta
 
 
 
 
  -Original Message-
  From: Juraj Kazda [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, September 17, 2002 9:05 AM
  To: STRUTS-USER (E-mail)
  Subject: The name of application resources?
 
 
  Hello everyone,
 
  I'm new to Struts and while discovering its magic I have 
 short question:
 
 
  Is it possible to get the name of file with internationalized
  messages (ie. ApplicationResources.properties, or 
 generally, the name
  set up in message-resources element of strusts-config.xml)?
 
 
  I found something like org.apache.struts.config.MessageResources in
  documentation, but how can I obtain instance of this class valid for
  actual application?
 
  Thank you very much.
 
 
  -jerryk.
 
 
 
 
 --
 To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]




smime.p7s
Description: application/pkcs7-signature


RE: The name of application resources?

2002-09-17 Thread Juraj Kazda

Hello,

I was trying to do this just for curiosity - learning struts. My intent
was just to log an error message when someone (webdesigner/me :-)) tries
to call my ChangeLang action with wrong parameters. Say, I have
ApplicationResources.properties (English messages/texts) and
ApplicationResources_sk.properties (Slovak messages/texts). When I call
myapp/changeLang?lang=sk, it changes to Slovak languages, when lang=en,
it changes back. That's ok, everything works, no error logged. When
lang=anything_else, it changes to default (English in this case). But I
want to log an error message, that there was attempt to change language
to something for which I don't have .properties file. So I wanted to get
the name of .properties files form resource-messages element, add _ +
anything_else + .properties, check if that file exists and log error
message. This the first what comes to my mind...

I will look at that two sources, but I think it's not so important for
me to get it working... I want to continue in my struts learning and
maybe later I will  understand all this things.

But I wulod like to thank you very much for your time.

With best regards

-jerryk.



=
Juraj Kazda
ICQ : 135207538
=



 -Original Message-
 From: James Mitchell [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, September 17, 2002 6:18 PM
 To: Struts Users Mailing List
 Subject: RE: The name of application resources?
 
 
 Take a look at the source code for MessageResources and it's default
 implementation PropertyMessageResources.  You'll gain an 
 appreciation for
 why this won't work (by default) and doing it yourself would 
 be (what I
 consider) a non-supported modification ;)
 
 I'm not trying to discourage you.  I know exactly how to do 
 this.  I just
 can't see WHY you need to do this.
 
 I've written my own MessageResources implementation 
 (DBMessageResources)
 which allows you to store and retrieve the key-value pairs in 
 a database.
 I'm almost finished with the second (XMLMessageResources).
 
 Good luck with it and let me know what you decide.
 
 Cheers,
 
 James Sasquatch on crack Mitchell
 Software Engineer\Struts Evangelist
 Struts-Atlanta, the Open Minded Developer Network
 http://www.open-tools.org/struts-atlanta
 
 
 
 
  -Original Message-
  From: Juraj Kazda [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, September 17, 2002 10:36 AM
  To: Struts Users Mailing List
  Subject: RE: The name of application resources?
 
 
  Hello James.
 
  Yes, I suppose to use it in action class. This action class is
  responsible for changing the Locale/language of application. I know,
  that if I try to change to language which appropriate 
 message file is
  not available, default .properties file will be used. However, I use
  logging in my action class and I want to log something like 
 - No such
  resources available. I just want to try to check if that 
 file exists
  (the name from message-resource element + parameter from 
 reguest) and if
  not, log that.
 
  -jerryk.
 
 
 
  =
  Juraj Kazda
  ICQ : 135207538
  =
 
 
   -Original Message-
   From: James Mitchell [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, September 17, 2002 4:27 PM
   To: Struts Users Mailing List
   Subject: RE: The name of application resources?
  
  
   Perhaps it would be better to explain what you want to do
   before you do
   this.
  
   Why do you need to extract the name?  Are you needing this in
   your action
   class?
  
   James Mitchell
   Software Engineer\Struts Evangelist
   Struts-Atlanta, the Open Minded Developer Network
   http://www.open-tools.org/struts-atlanta
  
  
  
  
-Original Message-
From: Juraj Kazda [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 17, 2002 9:05 AM
To: STRUTS-USER (E-mail)
Subject: The name of application resources?
   
   
Hello everyone,
   
I'm new to Struts and while discovering its magic I have
   short question:
   
   
  Is it possible to get the name of file with internationalized
messages (ie. ApplicationResources.properties, or
   generally, the name
set up in message-resources element of strusts-config.xml)?
   
   
I found something like 
 org.apache.struts.config.MessageResources in
documentation, but how can I obtain instance of this 
 class valid for
actual application?
   
Thank you very much.
   
   
-jerryk.
   
   
  
  
   --
   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]




smime.p7s
Description: application/pkcs7-signature


[Q]: html:img.../ and Javascript; Templates

2001-08-17 Thread Juraj Kazda

Hello friends,

I have a two problems: one with templates, and another (still) with
internationalization, resp. with html:img .../ tag.

First html:img .../ tag:
Is it possible to have struts render the HTML img ... tag _with_
support for _all_ Javascript event listeners? I need to make rollovers
with my navigation bar. However, I need to have my application
internationalized too. With struts' html:img .../ tag I can achieve
internationalization in a very simple and convenient way (thank you for
that advice :-)), but I can't use onMouseOver and onMouseOut event
listeners in that tag. While using HTML img ... tag, I have no problem
with Javascript, but there is a problem with staying international...
How to break this ring?


Second templates:
I've defined very small template framework (all the sources follows) and
after running it, all files in the template which are JSP are not
rendered/processed as JSP (it's just copied source to the output) . Can
someone take a look at these very simple sources and tell me what's
wrong? I think I'm missing something very basic, but I can't find
what...


 BEGIN : index.jsp 
%@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' %

template:insert template='/indexTemplate.jsp'
template:put name='header' content='/header.html' /
template:put name='content' content='/content.jsp'/
template:put name='footer' content='/footer.html' /
/template:insert
 END : index.jsp --




 BEGIN : indexTemplate.jsp 
%@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' %
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"

html

head
titleConfer title/title
/head


body
template:get name="header"/
template:get name="content"/
template:get name="footer"/
/body

/html
 END : indexTemplate.jsp ---




 BEGIN : header.html --
- HEADER
hr
 END : header.html 




 BEGIN : content.jsp --
%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="html" %

h1bean:message key="welcome.message"//h1
 END : content.jsp 




 BEGIN : footer.html --
hr
- FOOTER
 END : footer.html 



That part regarding content.jsp is not processed. There is shown
nothing. The source from browser follows:

 BEGIN : result in browser 






!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"

html

head
titleConfer title/title
/head


body
- HEADER
hr



h1bean:message key="welcome.message"//h1

hr
- FOOTER

/body

/html
- END : result in browser --


I really don't know why it doesn't work. My configuration:
- Resin 2.0.1 (application created in webapps/confer)
- directory struture:
%RESIN_HOME%/webapps/confer/index.jsp
%RESIN_HOME%/webapps/confer/indexTemplate.jsp
%RESIN_HOME%/webapps/confer/header.html
%RESIN_HOME%/webapps/confer/content.jsp
%RESIN_HOME%/webapps/confer/footer.html
%RESIN_HOME%/webapps/confer/WEB-INF/struts-bean.tld
%RESIN_HOME%/webapps/confer/WEB-INF/struts-html.tld
%RESIN_HOME%/webapps/confer/WEB-INF/struts-template.tld
%RESIN_HOME%/webapps/confer/WEB-INF/struts-config.xml
%RESIN_HOME%/webapps/confer/WEB-INF/web.xml

%RESIN_HOME%/webapps/confer/WEB-INF/classes/org/res/confer.properties
%RESIN_HOME%/webapps/confer/WEB-INF/lib/struts.jar
- Struts 1.0-b1
- Internet Explorer 5.5 under W2k Prof.
- configs:

 BEGIN : struts-config.xml 
?xml version="1.0" encoding="windows-1250"?
!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD
Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd"

struts-config


/struts-config
 END : struts-config.xml --




 BEGIN : web.xml --
?xml version="1.0" encoding="ISO-8859-1" ?

!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"

web-app
classpath id="/WEB-INF/classes"/

servlet

servlet-nameaction/servlet-name

servlet-classorg.apache.struts.action.ActionServlet/servlet-class

init-param
param-nameconfig/param-name

param-value/WEB-INF/struts-config.xml/param-value
/init-param

Internationalization of codetables.

2001-08-15 Thread Juraj Kazda

Hello friends,

first, I would like to thank you for answers to my previous quetion.

Now I have another problem - half architectural, half implementational. 

Imagine the situation (example):
One table is dedicated to data about 'pub' (name, address, kinds of
beer, ...). Kinds of beer is reference to code table, where I have
columns: code, type_en, type_de, ... - for every language I would like
to localize my application to there is one column with appropriate
translation of beer kind (bottle - Flasche - ...). This all is because I
would like to show to visitors of my page the kind of beer they can have
in selected pub in their language. What should be the best architectural
solution for retrieving data from code table (I will fill with them a
combo box)? Because code tables are almost (or long-time lasting) static
data, I was thinking about putting a Vector of beans with attributes
corresponding/matching the structure of code table. That means to make
one start-up servlet which will fill all the Vectors of code tables and
puts them in application scope context when the application starts. But
there is a problem: how to access connection pool defined by
struts-config.xml to obtain connection to database? Or dou you know how
to solve the whole problem better?


Thank you very much for help

With best regards

--jerry



Getting locale attribute from session.

2001-08-14 Thread Juraj Kazda

Hello,

I'm new user of struts framework and I have a problem.

I would like to make an internationalized application with _everything_
internationalized. This means that I have a nice graphics (menu too) on
my pages in several language versions. I would like to obtain a LOCALE
key (object) from session (inserted there by html:html locale="true"
tag). And here is the problem: to be perfect, I would like to get this
key by the name which is stored in
org.apache.struts.action.Action.LOCALE_KEY constant. How to access the
key?

I've made my entering (index.jsp) file as a template file and I check
the locale via logic:present and logic:match tags. But inside these
tags I have to use directly the org.apache.struts.action.LOCALE keyword
- it's not possible to ask for key name (by asking I mean getting the
value of org.apache.struts.action.Action.LOCALE_KEY). Or is it possible?

If someone knows, please help me.

I have tried to check archives for this, but with no success (for what I
want is hard to find right keywords... - BTW, I like the archive, it
helped me several times)

Thank you very much.

With regards

--jerry