RE: Second Message Ressource

2002-02-18 Thread Luke Studley

I just created my own Servlet class to load other Resource bundles and place
them in the context where appropriate.

-Original Message-
From: Benoit Segaert [mailto:[EMAIL PROTECTED]] 
Sent: 18 February 2002 09:03
To: [EMAIL PROTECTED]
Subject: Second Message Ressource

How can I use a second ApplicationResource html:errors/ ?

In the JSP page, I can use html:errors
bundle=secondApplicationResource/

Is it possible to define secondApplicationResource in the
ActionServlet parameters
in web.xml? If not how to define it in the servlet context?





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




html:form help!!

2002-02-11 Thread Luke Studley

Hi there.

I just found some 'interesting' behaviour with the html:form tag that I hope
somebody can explain.

I have the action servlet mapped in my web.xml to *.do, this worked fine
for me until I wanted some files to be downloaded with the extension .csv,
so I added another servlet-mapping of action to the *.csv extension.

Now however my old html:forms are appearing with the *.csv extension and
nothing works (except for the csv file download - which works a treat)! Is
it possible to have multiple mappings like this or does Struts just assume
one mapping for actions?

So, e.g. in my jsp
html:form action=/secure/ladida.do

but what now comes out in the browser is 

html:form action=/secure/ladida.csv

Any ideas appreciated

Luke



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




RE: options tag internationalization

2002-01-07 Thread Luke Studley

Laurent

I came across this very issue yesterday, this is how I solved it (probably
straying too much from design into implementation):

I couldn't find a way to easily (or quickly) access the internals of the
messages class so I created my own.

Each varying option set (e.g. coutries, states, person titles etc.) is
mapped to a normal resource bundle file, e.g. countries_en_GB.properties
etc.

I use an application Session listener to insert into each new session a
dynamic proxy that that implements a collection interface for each
internationalised collection.

On each request for the data by a page (i.e. html:options) the dynamic proxy
queries the session for the current struts locale and retrieves the
appropriate list and passes on the call to the appropriate bundle.

Obviously caching and the like goes on so I'm not reloading files all the
time, but the net effect is that if the user changes the locale of their
session the list boxes also change.

Hope that helps. Not really a design pattern though ;-)

Luke

PS I'm relatively new to struts - so will follow with interest to see if
there is a more strutsy way of doing this.


-Original Message-
From: Tettoni, Laurent [mailto:[EMAIL PROTECTED]] 
Sent: 07 January 2002 17:15
To: '[EMAIL PROTECTED]'
Subject: options tag  internationalization

Hi,

Could anybody advise a DESIGN PATTERN for implementing internationalized
struts-form:options (when using a Collection) that would use internally
struts-bean:message (or similar) mechanism ?

Use case:
- draw content for a combo box (names and values) from a database
= options names here expressed as generic, language independent
keys
- encapsulate in a Collection of dedicated objects
- use struts-form:options with the specified collection
= this would fetch localized value in the application's properties
= and display combo box with localized content

I could not find this functionality. Any advice ?

Thanks in advance,

-Laurent





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




RE: Strategy for International/XML Project

2002-01-04 Thread Luke Studley

Robert,

For issues concerning schema languages etc have a look at
http://www.xml.com/pub/a/2001/12/12/schemacompare.html

I definitely recommend Log4J over servletcontext log.

You may want to consider using DOM4J instead of JDOM - similar capabilities
but dom4j has programmatic XPath support. Also for XML handling look at the
the Jakarta xtags taglib (it uses dom4j under the hood).

Luke



-Original Message-
From: Robert Jackson [mailto:[EMAIL PROTECTED]] 
Sent: 04 January 2002 13:33
To: 'Struts Users Mailing List'
Subject: Strategy for International/XML Project

Folks,

I will be arechtecting/developing an application as follows:

1) Support for English/Spanish Presentation
2) No Database Available
3) All site data stored in flat files or XML files
4) XML messages sent/received from third parties
5) App Server will be Weblogic 6.1
6) Use cookie to store user name, address, phone, etc...
7) Use third party Applications (via HTTP) to book reservations, map
vicinity etc...
8) Need Admin Interface to Manage Spanish/English Content


I would appreciate your experiences/ideas about the best way to Architect
this application.

Here are some things I've been thinking...

1) We will Struts!!!
2) Use ApplicationResources file to contain all presentation strings
3) Is Log4J better than servletcontext.log()?
4) Use SSL to transfer user credit card info
5) Use JDOM/Digester to work with XML messages
6) How to service XML (XML-RPC, Weblogic Services, Message Beans, Struts
Actions via HTTP)???
7) Which struts features can I use for Cookies? logic:present for testing,
what about setting?
8) I'm comfortable with DTDs, should I use schemas instead?

Your ideas will be appreciated...

Thanks,

Robert Jackson

-Original Message-
From: Freek Segers [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 03, 2002 5:42 AM
To: Struts Users Mailing List
Subject: Re: Dynamic properties in ActionForms with custom tag


Hello again,

I've partially solved my problem. I found the new commons-beanutils package
that has new methods in PropertyUtils (getMappedProperty() and
setmappedProperty()).

To solve my second problem I now hardcoded my form bean's name into the
custom tag implementation to look it up in pageContext.

However, my struts release (version 1.0) doesn't populate the form bean when
I submit the form. I the servlet log I do see that Struts looks up and
recycles the form bean and it logs that it populates the form bean but the
dynamic properties' setter method isn't called.

Do I need a new struts release that uses the common-beanutils package. If
so, which build has support for this.

Thanks again,

Freek Segers


on 03-01-2002 08:51 you wrote:

 First, I've created a custom tag that creates different types of HTML form
 fields.
 The number of fields generated varies and the names of the fields are
dynamic.
 I can't figure out how to let Struts populate the ActionForm that's linked
to
 the Action that handles the form.
 I thought I read somewhere that you can use some feature of the JavaBean
specs
 to tell Struts what method to call (maybe by using PropertyDescriptors?),
but
 I can't find anything about this.

 Second, I don't know how I can restore any previously submitted values
when
 the form is shown for a second time, for example in case of a validation
 error. Do I have access to the ActionForm from a custom tag implementation
 somehow? Or can I let the ActionForm set properties in my custom tag?
 I've been looking at the source code for the Struts html:select-tag but
 found no clues to how Struts manages to make the last submitted item
selected
 when the form is redisplayed.


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



_

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com




--
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: Session Timeout question

2002-01-03 Thread Luke Studley

Also if you are using a Servlet2.3/JSP 1.2 container (e.g. tomcat 4) (not
sure about earlier versions) you can register listener(s) that will listen
for all the session timeouts in the system or write an object into the
session that implements HttpSessionAttributeListener which will be notified
when it is unbound (e.g. when the session object is about to be destroyed)

Luke
 
-Original Message-
From: Sean Owen [mailto:[EMAIL PROTECTED]] 
Sent: 03 January 2002 14:57
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Session Timeout question

A new session is created before your JSP is serviced, so I think that's why
you're always getting a session object there.

session.isNew() is an indirect but pretty good way of knowing when a session
has just been created, and thus could be because the old session timed out. 

You can also put some kind of token into the session and look for that; if
it's not there then you know it's a new sesssion and the old one must have
timed out.

Sean


--- TODD HARNEY [EMAIL PROTECTED] wrote:
 How can one accurately detect that a session has timedout? I have a custom
 tag that is automatically included on every jsp page we have. Its job is
to
 detect whether a session has timedout and if it has, to redirect the user
 to a different page to relogin or whatever. I think it is the case that
 when I call request.getSession(false) it is still creating a new session
if
 the old one has expired. Any thoughts on how to approach this issue? I
 don't have access to the name of a login token for example because our
 sign-on functionality is just a drop in without the source code.
 
 Thanks,
 Todd
 
 
 --
 To unsubscribe, e-mail:  
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 


__
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

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




Values in to attribute values for XML JSP Docs?

2002-01-03 Thread Luke Studley

Hi all.

I am using the XML form of JSP (1.2) and wish to write the equivalent of the
following.

jsp:scriptlet
int myvar = 1;
/jsp:scriptlet

input type=hidden value=%= myvar %/

However this doesn't work as the %= myvar % is only evaluated as an
expression when being passed to custom tags. So for example the following is
ok:
html:hidden value=%= myvar %/

.. but I've tried everything I can think of (short of using println
statements!) to output the value of any type of variable (not just scripting
ones) to normal output tag attributes - but nothing works.

NOTE: I cannot use %= myvar % or jsp:expression myvar
/jsp:expression as these are not well formed XML and so the page will not
compile.

Help! I don't know if I am missing something obvious or if this is just not
possible!

Thanks

Luke


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




RE: Using Struts with XSLT

2002-01-03 Thread Luke Studley

Hi Jan

I'm relatively new to struts - but have come from a background of using XSLT
with Servlet2.3 filters.

Have to say this worked great, although as people have pointed out there is
a performance hit. But I found with optimization I could reduce this to a
nearly negligible amount (I also used SAXON - which is great and has
improved quite a bit in recent releases performance wise.)

I have a working site using XSLT, but it was written and maintained purely
by me - so it was a nightmare for other people to support - as all the
presentation stuff was in the XSL, i.e. raw XML data (from app server)
driving XSLT sheets with embedded HTML/WML etc.

This lead me to want to split out the data some more and have 2 XML streams
- one describing the data and one describing the presentation (sounding
familiar yet?) which I implemented myself using XSLT URIResolvers.

Around this time I also discovered Cocoon and spent an interesting, but
ultimately unfruitful, time evaluating and porting to it. It has a lot of
nice features (many of which I'd already implemented for myself previously -
annoyingly :), but I realized that what I was ultimately doing with my dual
XML data flows was effectively implementing custom tags using XSLT. (Also
see Cocoons XSP templating language)

E.g. In your presentation XML you write something like 
sidebar
entryusername//entry
/sidebar

And in your XSLT you have something like:
xsl:template match=sidebar
table
!-- Write your entries here sort of thing --
/table
/xsl:template

You also find your self wanting to substitute data values for elements which
may come from secondary XML streams or you may want to read values directly
from Java classes. This becomes a lot more cumbersome. XSLT - Java bindings
are non standard and mostly awkward to use.

Then I (re-)found JSP and Struts. Taglibs have come a long way since I last
looked at JSPs about 2 years ago and I realized I had the solution to my
problem. Use JSP to generate the presentation layer (as it was meant to do)
and use the taglibs provided by struts and Jakarta. The presentation is
still separated out, using Java to access data is much simplified, and I can
still bring in my XML data using the xtags library.

Currently I am not planning on using XSLT at all for the moment (which makes
me sad as I love it). Although I am considering that it may be useful in
i18n, as I don't like all the properties files you get from the taglib. And
it may be useful in defining on the fly look and feels by restructuring your
XHTML etc.

I'm still not ultimately convinced JSP/Struts is the 'best' way - and in
general I liked cocoon. But now there are so many useful tag libraries
(including support for XSLT) why go re-invent them yourself in XSLT? Plus
ultimately when it comes to getting someone to support my pages when I want
to move on to the next new thing ;-) I know I'm going to find it easier to
find someone to support a JSP/Struts solution than my own bespoke XSLT one!

Hope some of those ramblings were useful.

Luke




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




Setting content attributes

2001-12-14 Thread Luke Studley


How do you set the values from scripting variables or the results of tag
library elements of attributes for output html tags when you are using XML
version of JSP?

E.g.
link rel=StyleSheet href=%= request.getContext %/stylesheet.css/

Simply puts the above string directly in the output (unsurprisingly - I was
getting desperate trying that). If I try to use jsp:expression instead the
page doesn't compile as the resulting fragment is not valid XML.

Apologies for the basic question - this is driving me nuts!!

Any pointers appreciated.

Luke





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




RE: Setting content attributes

2001-12-14 Thread Luke Studley

No. I'd already tried that it doesn't work as it is not well formed XML and
so the JSP page does not parse let alone compile.

:(


-Original Message-
From: Siggelkow, Bill [mailto:[EMAIL PROTECTED]] 
Sent: 14 December 2001 20:43
To: 'Struts Users Mailing List'
Subject: RE: Setting content attributes

link rel=StyleSheet
href=jsp:expressionrequest.getContext()/jsp:expression/stylesheet.css/


-Original Message-
From: Luke Studley [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 14, 2001 3:13 PM
To: struts-user
Subject: Setting content attributes



How do you set the values from scripting variables or the results of tag
library elements of attributes for output html tags when you are using XML
version of JSP?

E.g.
link rel=StyleSheet href=%= request.getContext %/stylesheet.css/

Simply puts the above string directly in the output (unsurprisingly - I was
getting desperate trying that). If I try to use jsp:expression instead the
page doesn't compile as the resulting fragment is not valid XML.

Apologies for the basic question - this is driving me nuts!!

Any pointers appreciated.

Luke





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




html:options

2001-12-12 Thread Luke Studley

Hi all

This is my first post - so excuse me if it is really basic but I am trying
to get the html:options tag to work as documented. My code looks like:

jsp:useBean id=nameTitles scope=page class=java.util.HashMap
jsp:scriptlet
nameTitles.put(Mr,null);
nameTitles.put(Mrs,null);
nameTitles.put(Miss,null);
/jsp:scriptlet
/jsp:useBean

.

html:options collection=nameTitles property=key/


Where I am declaring a simple map and then trying to use it to populate the
option list. But I get the following error:

javax.servlet.jsp.JspException: No getter method available for property
personTitle for bean under name org.apache.struts.taglib.html.BEAN
at
org.apache.struts.taglib.template.GetTag.doStartTag(GetTag.java:193)
at org.apache.jsp.pagetempl$jsp._jspService(pagetempl$jsp.java:265)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)


What am I doing wrong???!

Luke

PS Tomcat 4.0.1, Struts latest nightly build (needed for validator).


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