Re: Best Practices for static content

2005-06-17 Thread Andreas Toom
Can't you use a TilesController-class and manipulate your 
tiles-attribute depending on some parameter in request scope?.

Doing so you only have to declare one action and one tiles-definition.

/Andreas

Ramadi Pearse wrote:

Does anyone have best practices on how to compose or
decorate stand-alone static content? It seems overkill
to have to modify tile-defs.xml for each new static
page I want to add to the website. Is SSI or SiteMesh
more appropriate here? By the way, this is to
complement a web app which already uses Tiles to
compose the data portion of the app. Thanks!



__ 
Discover Yahoo! 
Have fun online with music videos, cool games, IM and more. Check it out! 
http://discover.yahoo.com/online.html


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



locale, Wrong format string

2005-06-02 Thread Andreas Toom
Hello, I thought I finally hade the format/formatKey thing with 
bean:write figured out, but when I tried to switch from a en_US locale 
to a sv I get this exception:


org.apache.jasper.JasperException: Wrong format string: '#,##0'

I've read 
http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html and 
 I ran the code snippet generating format strings for currency, 
integers etc. and took my swedish format string (which is identical to 
en_US), it worked nice for my en_US (firefox default language setting) 
but not when I switched to swedish language settings or in IE with 
swedish region settings in the control panel.


I really need to solve this so any help would be really appreciated.

/Andreas


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



Re: locale, Wrong format string

2005-06-02 Thread Andreas Toom

The problem is solved:

After some examination of the source of the bean:write tag i found this:

  format = NumberFormat.getNumberInstance(locale);
  if (formatStrFromResources) {
   ((DecimalFormat) format).applyLocalizedPattern( 
  formatString);

  } else {
   ((DecimalFormat) format).applyPattern(formatString);
  }

That is, when the format string comes from a resource bundle the 
applyLocalizedPattern is used, so I have to make sure that the pattern I 
use i localized..


/Andreas


Andreas Toom wrote:
Hello, I thought I finally hade the format/formatKey thing with 
bean:write figured out, but when I tried to switch from a en_US locale 
to a sv I get this exception:


org.apache.jasper.JasperException: Wrong format string: '#,##0'

I've read 
http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html and 
 I ran the code snippet generating format strings for currency, integers 
etc. and took my swedish format string (which is identical to en_US), it 
worked nice for my en_US (firefox default language setting) but not when 
I switched to swedish language settings or in IE with swedish region 
settings in the control panel.


I really need to solve this so any help would be really appreciated.

/Andreas


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



numeric format with bean:write

2005-05-31 Thread Andreas Toom
Hello, is it possible to add zero-padding with format in the 
bean:write tag?, I have used format with dates before but I can't find 
any good examples for numeric data.


My bean property is a int representing a month and I want to write 01, 
02,.. instead of just 1,2,..


/Andreas


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



Re: simple Validator question

2005-05-24 Thread Andreas Toom
I haven't tried this but you shouldn't it be possible to use the 
'attribute' attribute in your action mapping configuration ?


action
path=/action1
type=Action1
name=form1
attribute=form

action
path=/action2
type=Action2
name=form2
attribute=form

/Andreas

Riyaz Mansoor wrote:


i saw a doc which had

form name=formaname1,formname2 

wondering if multiple forms could be declared like this? sorry but am 
t tired to test right no :)


riyaz


-
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: Multiple tiles layouts for single application

2005-05-11 Thread Andreas Toom
Hello, actually my solution is on page 16 ;)
It's not that much to say about it, the example is quite straight 
forward. Just point the definition path to a struts action which will, 
based upon some condition, forward to a page or other tile that will be 
used as the path for the definition and extended definitions.

So here's some examples of my tiles:
!-- Main --
definition name=com.acme.web.search.tiles.main 
path=/search/setupTiles.do
	put name=content value=OVERRIDE THIS /
	put name=title value=Search available domains /
/definition

!-- Template definition for site layout 1 --
definition name=com.acme.web.search.tiles.main.acme 
path=/front/tiles/tiles_front_main.jsp
	put name=content value=OVERRIDE THIS /
	put name=title value=Search layout 1 /
/definition

!-- Template definition for yr --
definition name=com.acme.web.search.tiles.main.yr 
path=/search/tiles/tiles_front_yrse.jsp
	put name=content value=OVERRIDE THIS /
	put name=title value=Search layout 2 /
/definition

definition name=com.acme.web.search.tiles.search 
extends=com.acme.web.search.tiles.main
	put name=content value=/search/pages/search.jsp /
/definition

And struts-config
action
path=/setupTiles
type=com.acme.web.search.actions.SetupTilesAction


forward name=acme path=com.nictrade.web.search.tiles.main.acme /
forward name=yr path=com.nictrade.web.search.tiles.main.yr /
/action
And com.acme.web.search.actions.SetupTilesAction
public ActionForward execute( ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response )
{
// Do some conditional logic here to determine layout
return mapping.findForward( yr );
}
Is this the information you wanted?, if so I hope it helps.
/Andreas
Benedict, Paul C wrote:
Andreas,
This is a wild solution. I don't understand page 15 and I've used Tiles
before, but not in this way. Could you explain it?
-Original Message-
From: Andreas Toom [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 10, 2005 1:58 AM
To: Struts Users Mailing List
Subject: Re: Multiple tiles layouts for single application

Hello again, great pdf there, solved my problem nice and easy. Instead 
of a jsp in the path attribute of a definition I used a struts action 
which forwards to the right template, should work really nice.

Thank you very much for the help!
/Andreas
Allistair Crossley wrote:
http://www.lifl.fr/~dumoulin/tiles/tilesAdvancedFeatures.pdf
page 15 may help you
Cheers.

-Original Message-
From: Andreas Toom [mailto:[EMAIL PROTECTED]
Sent: 09 May 2005 15:33
To: Struts Users Mailing List
Subject: Re: Multiple tiles layouts for single application
Yes, but a tile definition is just a.. tile definition. All my 
definitions extends a base tile:

definition name=com.acme.web.search.tiles.main 
path=/front/tiles/tiles_front_main.jsp
	put name=content value=OVERRIDE THIS /
	put name=title value=Search here /
/definition

definition name=com.acme.web.search.tiles.search 
extends=com.acme.web.search.tiles.main
	put name=content value=/search/pages/search.jsp /
/definition

And my forwards are:
forward name=success path=com.acme.web.search.tiles.search /
forward name=failure path=com.acme.web.search.tiles.error /
So now, if a request has been made to 
http://mysite/?layout=layout1 or 
whatever it seems like a nice solution not have to change 
anything in my 
action configuration and instead have a filter/extension of a 
controller 
indicating which tile definitions to use, is this possible? 
or do I have 
to add a action-mapping/forward for each new site I want enable this 
search functionality?

As I sad before, the main problem as I see it is the input 
parameter in 
form validation, I guess I could solve it with some action in 
the input 
parameter instead, but all those solutions feel ugly and 
leaves me with 
much work if anything is about to change..

Any other ideas? :)
/Andreas
Allistair Crossley wrote:

Your requests should be routing through a Struts Controller 
via an ActionMapping, and therefore your Action can examine 
the request and return the appropriate view which will be a 
forward to the tile definition of your choice.


Cheers, Allistair.


-Original Message-
From: Andreas Toom [mailto:[EMAIL PROTECTED]
Sent: 09 May 2005 15:05
To: user@struts.apache.org
Subject: Multiple tiles layouts for single application
Hello, is there a way to switch tiles layout in an applaction 
depending 
on let's say request url. I have a struts-based application with a 
single purpose and I want to share this functionality with other 
php-based sites that my company have.

So if a request comes in to the site I want different layouts, each 
matching the calling site, for example:

http://myhost/myapp/ - Original layout
http://myhost/myapp/site1 - Site1 layout
http://myhost/myapp/site2 - Site2 layout

Multiple tiles layouts for single application

2005-05-09 Thread Andreas Toom
Hello, is there a way to switch tiles layout in an applaction depending 
on let's say request url. I have a struts-based application with a 
single purpose and I want to share this functionality with other 
php-based sites that my company have.

So if a request comes in to the site I want different layouts, each 
matching the calling site, for example:

http://myhost/myapp/ - Original layout
http://myhost/myapp/site1 - Site1 layout
http://myhost/myapp/site2 - Site2 layout
The reason I wan't this is because I don't want do duplicate any action 
mappings in my struts-config. The major problem is form validation, 
since the input is just a simple tile definitions the app has no way to 
determine which layout to use. So if I had tiles-defs.xml, 
tiles-defs-site1.xml tiles-defs-site2.xml and a way to tell struts when 
to use which definition I figure the problem would be solved...

Is there a way to solve this without extending the request processor/ 
tiles plugin?, if not can anyone point me in a good start direction?

Any ideas appreciated.
/Andreas
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Multiple tiles layouts for single application

2005-05-09 Thread Andreas Toom
Yes, but a tile definition is just a.. tile definition. All my 
definitions extends a base tile:

definition name=com.acme.web.search.tiles.main 
path=/front/tiles/tiles_front_main.jsp
	put name=content value=OVERRIDE THIS /
	put name=title value=Search here /
/definition

definition name=com.acme.web.search.tiles.search 
extends=com.acme.web.search.tiles.main
	put name=content value=/search/pages/search.jsp /
/definition

And my forwards are:
forward name=success path=com.acme.web.search.tiles.search /
forward name=failure path=com.acme.web.search.tiles.error /
So now, if a request has been made to http://mysite/?layout=layout1 or 
whatever it seems like a nice solution not have to change anything in my 
action configuration and instead have a filter/extension of a controller 
indicating which tile definitions to use, is this possible? or do I have 
to add a action-mapping/forward for each new site I want enable this 
search functionality?

As I sad before, the main problem as I see it is the input parameter in 
form validation, I guess I could solve it with some action in the input 
parameter instead, but all those solutions feel ugly and leaves me with 
much work if anything is about to change..

Any other ideas? :)
/Andreas
Allistair Crossley wrote:
Your requests should be routing through a Struts Controller via an 
ActionMapping, and therefore your Action can examine the request and return the 
appropriate view which will be a forward to the tile definition of your choice.
Cheers, Allistair.

-Original Message-
From: Andreas Toom [mailto:[EMAIL PROTECTED]
Sent: 09 May 2005 15:05
To: user@struts.apache.org
Subject: Multiple tiles layouts for single application
Hello, is there a way to switch tiles layout in an applaction 
depending 
on let's say request url. I have a struts-based application with a 
single purpose and I want to share this functionality with other 
php-based sites that my company have.

So if a request comes in to the site I want different layouts, each 
matching the calling site, for example:

http://myhost/myapp/ - Original layout
http://myhost/myapp/site1 - Site1 layout
http://myhost/myapp/site2 - Site2 layout
The reason I wan't this is because I don't want do duplicate 
any action 
mappings in my struts-config. The major problem is form validation, 
since the input is just a simple tile definitions the app has 
no way to 
determine which layout to use. So if I had tiles-defs.xml, 
tiles-defs-site1.xml tiles-defs-site2.xml and a way to tell 
struts when 
to use which definition I figure the problem would be solved...

Is there a way to solve this without extending the request processor/ 
tiles plugin?, if not can anyone point me in a good start direction?

Any ideas appreciated.
/Andreas
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE 
---
QAS Ltd.
Developers of QuickAddress Software
a href=http://www.qas.com;www.qas.com/a
Registered in England: No 2582055
Registered in Australia: No 082 851 474
---
/FONT

-
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: Multiple tiles layouts for single application

2005-05-09 Thread Andreas Toom
Hello again, great pdf there, solved my problem nice and easy. Instead 
of a jsp in the path attribute of a definition I used a struts action 
which forwards to the right template, should work really nice.

Thank you very much for the help!
/Andreas
Allistair Crossley wrote:
http://www.lifl.fr/~dumoulin/tiles/tilesAdvancedFeatures.pdf
page 15 may help you
Cheers.

-Original Message-
From: Andreas Toom [mailto:[EMAIL PROTECTED]
Sent: 09 May 2005 15:33
To: Struts Users Mailing List
Subject: Re: Multiple tiles layouts for single application
Yes, but a tile definition is just a.. tile definition. All my 
definitions extends a base tile:

definition name=com.acme.web.search.tiles.main 
path=/front/tiles/tiles_front_main.jsp
	put name=content value=OVERRIDE THIS /
	put name=title value=Search here /
/definition

definition name=com.acme.web.search.tiles.search 
extends=com.acme.web.search.tiles.main
	put name=content value=/search/pages/search.jsp /
/definition

And my forwards are:
forward name=success path=com.acme.web.search.tiles.search /
forward name=failure path=com.acme.web.search.tiles.error /
So now, if a request has been made to 
http://mysite/?layout=layout1 or 
whatever it seems like a nice solution not have to change 
anything in my 
action configuration and instead have a filter/extension of a 
controller 
indicating which tile definitions to use, is this possible? 
or do I have 
to add a action-mapping/forward for each new site I want enable this 
search functionality?

As I sad before, the main problem as I see it is the input 
parameter in 
form validation, I guess I could solve it with some action in 
the input 
parameter instead, but all those solutions feel ugly and 
leaves me with 
much work if anything is about to change..

Any other ideas? :)
/Andreas
Allistair Crossley wrote:
Your requests should be routing through a Struts Controller 
via an ActionMapping, and therefore your Action can examine 
the request and return the appropriate view which will be a 
forward to the tile definition of your choice.

Cheers, Allistair.

-Original Message-
From: Andreas Toom [mailto:[EMAIL PROTECTED]
Sent: 09 May 2005 15:05
To: user@struts.apache.org
Subject: Multiple tiles layouts for single application
Hello, is there a way to switch tiles layout in an applaction 
depending 
on let's say request url. I have a struts-based application with a 
single purpose and I want to share this functionality with other 
php-based sites that my company have.

So if a request comes in to the site I want different layouts, each 
matching the calling site, for example:

http://myhost/myapp/ - Original layout
http://myhost/myapp/site1 - Site1 layout
http://myhost/myapp/site2 - Site2 layout
The reason I wan't this is because I don't want do duplicate 
any action 
mappings in my struts-config. The major problem is form validation, 
since the input is just a simple tile definitions the app has 
no way to 
determine which layout to use. So if I had tiles-defs.xml, 
tiles-defs-site1.xml tiles-defs-site2.xml and a way to tell 
struts when 
to use which definition I figure the problem would be solved...

Is there a way to solve this without extending the request 
processor/ 

tiles plugin?, if not can anyone point me in a good start direction?
Any ideas appreciated.
/Andreas

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


FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE 
---
QAS Ltd.
Developers of QuickAddress Software
a href=http://www.qas.com;www.qas.com/a
Registered in England: No 2582055
Registered in Australia: No 082 851 474
---
/FONT


-
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: How to have a header tile over many modules?

2005-05-03 Thread Andreas Toom
Hello, I have a similiar configuration for my project, a set of menu 
links and a login-box in a tile shared between modules. After reading 
the struts documentation, specifying the property module for html:link 
should imho solve the problem but I've had no luck with this approach 
(all i get back with the module parameter is ). So I've practicly 
hard-coded the links, and with the login-box I run bean:include 
id=login href=/authorized/loginBox.do / since I use ssl-ext and I 
need to use a specific struts-config to determine http/https. I would 
really like a more dynamic and clean solution than the one I have to 
day, like say:

html:link action=menuchoice1 module=module1
html:link action=menuchoice2 module=module1
html:link action=menuchoice3 module=module2
and
html:form action=login module=authorized
any ideas is appreciated.
/Andreas
marc wrote:
So far so good. I have now made 4 modules in struts 1 major and 4 sub 
modules.

I then spilt it all in 2 tiles, a menu and a body(the submodules then 
fill in the body).

The menu I what to be the same on all sites. But when I forward to one 
of the modules, I loss the forwards from me major module. Resulting in 
my menu does work anymore.
So my Q is, is there away to include the forwards in the submoduls. So 
that I dont need to put them in all of me modules, but only have them 
one place.

Thank an regards
/marc

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


jsp location when using modules

2005-04-14 Thread Andreas Toom
Hello, We are currently refactoring our Web applications into one 
application using Struts modules so that we can share common resources 
more easily between the different modules.

Now to the problem, we are currently placing all our jsps in 
/WEB-INF/pages/ but when introducing modules I get 404 for this action:

action path=/test forward=/WEB-INF/pages/test/error.jsp /
Tomcat searches /test/WEB-INF/pages/test/error.jsp
I've read that this behaviour can be overwritten with:
controller 
processorClass=org.apache.struts.tiles.TilesRequestProcessor 
pagePattern=/WEB-INF/pages/$M$P /

But no result.
How can this be solved? do I have to place content for each module in 
/modulename/...

and what does this do to content that we wish to share, for example tile 
 definitions that are now in /WEB-INF/tiles/ ?

/Andreas

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


Re: jsp location when using modules

2005-04-14 Thread Andreas Toom
Hello again,
The main reason I wanted to use WEB-INF at first was to protect jsp/xml 
but this would lead to module contents i two places, static content 
(images etc) in /modulename and pages in WEB-INF/pages/modulename.

After trying some things I have decided, for now, to place each module 
with all it contents in /modulename and use a filter to protect jsp, 
xml:s etc from direct access. It feels good to place all resources for a 
module in one place...

What do you guys think of this approach?
/Andreas

Hubert Rabago wrote:
I haven't done this before, but try this:
1. Use the forwardPattern attribute of controller and give it the
same value you're giving pagePattern now.
2. Set up a custom ForwardAction.  The existing ForwardAction sets
contextRelative which skips the use of forwardPattern.  For your
custom version, copy the code in the existing ForwardAction except
don't set contextRelative to true.
3. Change your mappings to:
action path=/test type=your.ForwardAction parameter=error.jsp/
It should resolve to /WEB-INF/pages/test/error.jsp where
forwardPattern=/WEB-INF/pages/$M$P and the module name is test.
Looking at TilesRequestProcessor.processTilesDefinition(), it doesn't
look like it prefixes the uri with module names, nor does it use
controller.forwardPattern, so if I read it right, it will use the uri
you set in your tile definitions.
hth,
Hubert
On 4/14/05, Andreas Toom [EMAIL PROTECTED] wrote:
Hello, We are currently refactoring our Web applications into one
application using Struts modules so that we can share common resources
more easily between the different modules.
Now to the problem, we are currently placing all our jsps in
/WEB-INF/pages/ but when introducing modules I get 404 for this action:
action path=/test forward=/WEB-INF/pages/test/error.jsp /
Tomcat searches /test/WEB-INF/pages/test/error.jsp
I've read that this behaviour can be overwritten with:
controller
processorClass=org.apache.struts.tiles.TilesRequestProcessor
pagePattern=/WEB-INF/pages/$M$P /
But no result.
How can this be solved? do I have to place content for each module in
/modulename/...
and what does this do to content that we wish to share, for example tile
 definitions that are now in /WEB-INF/tiles/ ?
/Andreas

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


bean:include + SSL ( + foreign context )

2005-03-31 Thread Andreas Toom
Hello,
I have 2 questions (See below for details)
1, Does bean:include work with SSL? if so, how?
2, Does JSTL c:import work with Struts actions?
Yesterday after some months of developing on a Struts application it was 
time to enable SSL. Enabling tomcat with SSL support was no problem and 
it looked like it would be a sweet ride but out of nowhere this 
exception pops up:

Exception opening resource 
https://localhost/fragments/fragment_login.jsp: 
javax.net.ssl.SSLHandshakeException: 
sun.security.validator.ValidatorException: No trusted certificate found

The fragment is included with:
bean:include id=login page=/fragments/fragment_login.jsp /
and then
bean:write name=login filter=false/
Includes works fine without SSL. SSL works and I can render the fragment 
jsp alone without any problems, in fact the whole Struts app works fine 
with SSL as long as I don't use bean:include.

After some googling I find this mailinglist post: 
http://www.newsarch.com/archive/mailinglist/jakarta/struts/user/msg29088.html 
with a similar error but no solution.

Alternative solutions:
I try jsp:include and it works fine, but the problem is that I have 
another app which will include the login fragment aswell so I need 
something that can access a foreign context (App B will access fragments 
from the context of App A) I try JSTL c:import with 
href=/fragments/fragment_login.jsp and context=/ which in my mind 
would lead to a http request from App B to App A and the inclusion of 
the response as a String, but instead I get a action mapping error 
saying action /login cannot be found, well of course since the action 
/login is not defined in App B only in App A.

How does the c:import work? shouldn't c:import return the content in 
HTML not in jsp-code (?) for App B to compile in the App B context?

So this is what it all sums up to:
bean:include cannot include content over SSL ?,
jsp:include and JSTL c:import can both include content over SSL,
JSTL c:import cannot import content with Struts action references from 
antoher context???

Any ideas would be really appreciated.
/Andreas
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]