Re: Internalization problem: two internalizations for the same key

2008-05-07 Thread Toni Lyytikäinen
Which version of Struts 2 are you using? 2.0.11.1 works fine for me in the same situation. Are you using the i18n interceptor? Also, how did you name your resource files? On Wed, May 7, 2008 at 11:30 AM, Jukka Välimaa <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I have the following lines in m

Re: Disabling Browser AutoComplete in Struts tags

2008-04-22 Thread Toni Lyytikäinen
You could probably create your own theme and/or template for the tag where you set the attribute in the template. But why not just use standard xhtml tags for this - I mean just type it like this in the page: < input type="text" name="userid" autocomplete="off" ... /> (extra space there to not ma

Re: Best practise for populating a select from database so that it works for all result types

2008-04-21 Thread Toni Lyytikäinen
t the tag > simply calls the default or specified method on the action. > > > Toni Lyytikäinen on 21/04/08 12:00, wrote: > > > Well, for the retrieval I use stateless session bean injected to the > > action > > with Spring, like this (simplified): > > > &

Re: Best practise for populating a select from database so that it works for all result types

2008-04-21 Thread Toni Lyytikäinen
yet :( > > Re: lists, you can put them into the request but then you have to manage > them in case some other user changes them. Plus you will use up memory. If > you're using a decent persistence layer that has 'second level cache' which > you can set up when you go

Re: Best practise for populating a select from database so that it works for all result types

2008-04-21 Thread Toni Lyytikäinen
dit action > and a Save action. The Edit action fetches the dropdown list and puts it in > the request and results in the form jsp. > > The form submits to Save and if validation fails, the Input result is > resultType="chain" and pipes the request back to the Edit action.

Best practise for populating a select from database so that it works for all result types

2008-04-21 Thread Toni Lyytikäinen
Hello, What is generally regarded as the best practise for populating a select element in a form from database so that it works regardless of the action and the result from which the form is displayed? I've tried this: action configuration: /WEB-INF/jsp/admin/userForm.jsp list /

Re: Converting action configuration from 2.0 to 2.1 - how to convert parameters to actions

2008-04-21 Thread Toni Lyytikäinen
I'm using 2.1.1-SNAPSHOT from the people.apache.org maven snapshot repository. I noticed 2.1.2-SNAPSHOT is already out, maybe I should try it. I have scope="prototype" in the actions that I've defined in the Spring configuration file. The problem also affects actions that are not in the Spring con

Re: Converting action configuration from 2.0 to 2.1 - how to convert parameters to actions

2008-04-18 Thread Toni Lyytikäinen
Well, as I already posted in the issue, it turned out that this is somehow caused by the Spring plugin. If I disable the Spring plugin, it works fine (apart from the fact that my DAOs won't get injected to the actions, of course).

Re: Converting action configuration from 2.0 to 2.1 - how to convert parameters to actions

2008-04-18 Thread Toni Lyytikäinen
SHOT and XWork 2.1.1 On Fri, Apr 18, 2008 at 5:05 PM, Al Sutton <[EMAIL PROTECTED]> wrote: > Toni, > > Can you post your updated action config and the full stack trace here, > there may be something simple we can spot before needing to log a bug. > > Al. > > --

Re: Converting action configuration from 2.0 to 2.1 - how to convert parameters to actions

2008-04-18 Thread Toni Lyytikäinen
t; > wrote: > > > > > Hmm...what should happen is those exceptions should be logged as a > > > warn, but the process should continue like normal. If that isn't the > > > case, definitely file a bug and put it against 2.1.2 > > > > > > Don >

Re: Converting action configuration from 2.0 to 2.1 - how to convert parameters to actions

2008-04-18 Thread Toni Lyytikäinen
configuration from 2.0 to 2.1 - how to > convert parameters to actions > > > > Hmm...what should happen is those exceptions should be logged as a > warn, but the process should continue like normal. If that isn't the > case, definitely file a bug and put it against 2.1.2 &

Converting action configuration from 2.0 to 2.1 - how to convert parameters to actions

2008-04-18 Thread Toni Lyytikäinen
Hello, I'm in the process of converting a Struts 2.0.11 application to Struts 2.1.1, and ran into some trouble concerning the action result configuration in struts.xml. Basically this is what I had in 2.0.11: Users_edit true ${user.username} This resulted in an url like http://.../Users_

Re: persistence and doubts on usage of hibernate in struts 2

2008-02-29 Thread Toni Lyytikäinen
Hard to say where the problem lies without having a look at the DAO code. Are you using OpenSessionInViewFilter or similar mechanism for lazy loading in the view? If yes, try setting the param singleSession to false like this: OSIVFilter org.springframework.orm.hibernate3.support.OpenSessionI

Re: How to get method name in interceptor

2008-02-21 Thread Toni Lyytikäinen
t; Tell me more. One thing I have learned using Struts 2 is if you think it > should be possible, it probably is! What are you trying? > > On Thu, Feb 21, 2008 at 1:29 AM, Toni Lyytikäinen <[EMAIL PROTECTED]> > wrote: > > > Thanks. This approach works, but isn't quite a

Re: How to get method name in interceptor

2008-02-20 Thread Toni Lyytikäinen
will see what's happening right > away. > > > > On Wed, Feb 20, 2008 at 5:40 AM, Toni Lyytikäinen <[EMAIL PROTECTED]> > wrote: > > > Hi, > > > > I'm trying to access the ActionMapping from an interceptor, like the > > following t

How to get method name in interceptor

2008-02-20 Thread Toni Lyytikäinen
Hi, I'm trying to access the ActionMapping from an interceptor, like the following test stub: public String intercept(ActionInvocation invocation) throws Exception { ActionMapping am=ServletActionContext.getActionMapping(); log.info("The method is "+am.getMethod()); return invocation.

Trouble configuring spring plugin

2008-02-08 Thread Toni Lyytikäinen
Hi, I recently started converting an older project to Struts 2.0.11 and maven. The project uses spring plugin for injecting certain dependencies into the actions. The problem is, that I would like to use the constructor autowiring, as described in the configuration file (struts.properties): ### sp

Re: Displaytag problems

2007-09-04 Thread Toni Lyytikäinen
Yes, there are several approaches to it, using AjaxTags, Ajax Anywhere, YUI, Prototype etc. It might be possible to implement it in Dojo too, I don't know enough about Dojo to say anything certain. All solutions are somewhat hackish though, and I wouldn't really recommend using them. AjaxTags is th

Re: tabltags

2007-08-27 Thread Toni Lyytikäinen
http://displaytag.sourceforge.net/11/export_filter.html On 8/27/07, Manuel Correa <[EMAIL PROTECTED]> wrote: > > Sorry is display tags: > > > > http://displaytag.sourceforge.net/11/ > > > > > > > > Manuel Correa. > > Application Analyst Specialist. > > ITOS, Carl Vinson Institute of Government. >

Re: Save Action Invocation

2007-08-23 Thread Toni Lyytikäinen
It's quite possible. Take a look at the comments here: http://www.vitarara.org/cms/struts_2_cookbook/creating_a_login_interceptor On 8/23/07, Phillip Grenier <[EMAIL PROTECTED]> wrote: > > I don't know if this is possible or not but I would like to have a > authentication interceptor that if a use

Re: Sanitize Text

2007-08-23 Thread Toni Lyytikäinen
You could just override the string conversion in xwork: http://struts.apache.org/2.x/docs/type-conversion.html define something like this in xwork-conversion.properties java.lang.String=org.example.MyConverter Then create a class MyConverter that extends the XWorkBasicConverter and override the

Re: Configuring OpenSessionInViewInterceptor as S2's interceptor

2007-08-22 Thread Toni Lyytikäinen
to boost performance. So we should really use eager fetching by > default and minimize the use of OSIV. > > > On 8/22/07, Toni Lyytikäinen <[EMAIL PROTECTED]> wrote: > > "And, is there a better alternative than using > > OpenSessionInViewInterceptor?" >

Re: Configuring OpenSessionInViewInterceptor as S2's interceptor

2007-08-22 Thread Toni Lyytikäinen
"And, is there a better alternative than using OpenSessionInViewInterceptor?" Yes. It's important to realise that while OpenSessionInView feels very handy, it is not a particularly nice design pattern, as it can stress your database with lots of small queries. It's best to learn how to do eager fe

Re: Configuring OpenSessionInViewInterceptor as S2's interceptor

2007-08-22 Thread Toni Lyytikäinen
You can't use the OpenSessionInViewInterceptor from Spring in Struts 2. Struts 2 interceptors are not compatible with Spring interceptors as they have their own interface. You'll have to use OpenSessionInViewFilter. Take a look here: http://www.springframework.org/docs/api/org/springframework/orm/

Re: Having problem with Swedish characters in request

2007-08-21 Thread Toni Lyytikäinen
I don't remember having any similar problems with the Finnish locale which is nearly the same as the Swedish one. The cause of the problem is probably that the parameters are in wrong encoding (UTF-8 most probably). Since you are using ISO-8859-1, check that the browser in the form page is actually

Re: capturing the value of a tag in an action

2007-08-14 Thread Toni Lyytikäinen
I don't know if you can capture the checkbox value to String, boolean should work though (it works for me at least). Try changing the String element to boolean. On 8/14/07, Session A Mwamufiya <[EMAIL PROTECTED]> wrote: > > Hi, > > I started a thread on this topic a while back, but the example I w

Re: struts 2.0.8 problem implementing filter

2007-08-10 Thread Toni Lyytikäinen
Sorry, but why go the hard way when you can achieve the same with a simple interceptor? You can return a global result from a interceptor (f.ex. return "errorPage") which is lot simpler than getting tangled with the RequestDispatcher stuff. On 8/10/07, Toni Lyytikäinen <[EMAIL PROT

Re: struts 2.0.8 problem implementing filter

2007-08-10 Thread Toni Lyytikäinen
Sorry, but why go the hard way when you can achieve the same with a simple interceptor? You can return a global result from a filter (f.ex. return "errorPage") which is lot simpler than getting tangled with the RequestDispatcher stuff. On 8/10/07, Eugen Stoianovici <[EMAIL PROTECTED]> wrote: > > i

Re: How to list a property in a display:table (Struts 2)

2007-08-08 Thread Toni Lyytikäinen
Set the uid attribute in the display:table -tag like this: On 8/8/07, fergunet <[EMAIL PROTECTED]> wrote: > > > Hi all! > > I've created a display table to show a list of things and their > attributes. > But one of those attributes is another list of objects. I don't know how > to > print their

Localizing the list in a -tag?

2007-08-08 Thread Toni Lyytikäinen
Hello, Is it possible to localize the options in the list attribute of the -tag? I've tried several approaches but none of them seem to work. What I'm aiming at is something like the following: For some reason it seems to be impossible to use double quotes (") for the elements in the map, unles

Re: Struts 2 Validation multiple validators on same field

2007-08-07 Thread Toni Lyytikäinen
That validation config doesn't seem to make much sense to me. The field accountNumber cannot be both int and string, so you have to use required instead of requiredstring if you want to process the input as int. If you want it as string, you have to use something else than the int validator, possib

Re: Gettin the selected item in a s:tree

2007-08-06 Thread Toni Lyytikäinen
YUI has great documentation, there are also nice examples at: http://developer.yahoo.com/yui/treeview/ On 8/6/07, Session A Mwamufiya <[EMAIL PROTECTED]> wrote: > > Do you have an example, because I know nothing about YUI. > > Also, I saw in the link you provided that there is a workaround for d

Re: populating input fields on page load

2007-08-06 Thread Toni Lyytikäinen
I believe the correct spelling is redirect-action http://cwiki.apache.org/WW/action-configuration.html On 8/6/07, Session A Mwamufiya <[EMAIL PROTECTED]> wrote: > > I get the following: > Caused by: There is no result type defined for type 'redirectAction' > mapped with name 'createSMIG' - result

Re: populating input fields on page load

2007-08-06 Thread Toni Lyytikäinen
Does your class implement Preparable interface? Do you have the interceptor in your interceptor stack? Also, check the syntax of the preparable method - it should be void like this public class TestAction extends SomeClass implements Preparable { ... public void prepare() { log.debug("This should

Re: Gettin the selected item in a s:tree

2007-08-06 Thread Toni Lyytikäinen
I'm under the impression that the selected topic publishing isn't currently working in Struts 2. At least the examples in the showcase app aren't working for me (in Firefox 2.0.0.6). When I had to do something similar I found this: http://issues.apache.org/struts/browse/WW-1813?page=com.atlassian.j

Re: HTML Encoding in Struts2

2007-08-01 Thread Toni Lyytikäinen
http://struts.apache.org/2.x/docs/property.html The property tag escapes the string by default. Try On 8/1/07, Sawan <[EMAIL PROTECTED]> wrote: > > > Hi experts, > > I have following code... > > JAVA: > ArrayList obj = new ArrayList(); > obj.add(" www.google.com Visit google "); > obj.add(" www.

Re: Contacting struts 2 documentation writers

2007-07-31 Thread Toni Lyytikäinen
Those examples don't actually work the way they should, do they? The tree renders fine, but the topics are not working correctly. The text on the side prompts to click a node, but clicking the node does nothing. Looks like the event handler never gets called. On 7/31/07, Ted Husted <[EMAIL PROTECT

Re: Struts 2 performance

2007-07-15 Thread Toni Lyytikäinen
I tried this too, and I can confirm that it does actually shut down the server. The return value of the method that the property tag references is evaluated for some reason, which makes the application vulnerable to OGNL injection attacks... this is a huge security problem. On 7/16/07, Aram Mkhit

Re: ParameterAware Not Working

2007-07-14 Thread Toni Lyytikäinen
It's not a String but an array of Strings. [ in front of the object indicates an array. On 7/14/07, Richard Sayre <[EMAIL PROTECTED]> wrote: I am implemnting ParameterAware to get my request parameters: http://cwiki.apache.org/WW/how-can-we-access-request-parameters-passed-into-an-action.html

Re: [S2] autocompleter, predefining initial value

2007-07-13 Thread Toni Lyytikäinen
AIL PROTECTED]> wrote: I agree , autocompleter is too slow... Are you using the http://cwiki.apache.org/confluence/display/S2PLUGINS/YUI+Plugin ? Herrera Toni Lyytikäinen wrote: > > I used a JSON action which outputs an array of arrays like this: > > [ > ["VALUE&qu

Re: [S2] autocompleter, predefining initial value

2007-07-13 Thread Toni Lyytikäinen
result that is made from AjaxUtil . Is it possible to use flt for this case ?. In the showcase example, uses a option.flt(value only), but I need two, key and value instead. Thanks Herrera Toni Lyytikäinen wrote: > > Whoops, sorry I should probably think before I post. So you want to

Re: [S2] autocompleter, predefining initial value

2007-07-12 Thread Toni Lyytikäinen
value with the value attribute. It's not very nice solution but it works. On 7/12/07, Pedro Herrera <[EMAIL PROTECTED]> wrote: It´s not working to me I´ve setted the in the action countryIdKey = "29" and the combo comes blank... help me Herrera Toni Lyytikäinen w

Re: [S2] autocompleter, predefining initial value

2007-07-12 Thread Toni Lyytikäinen
Whoops, sorry I should probably think before I post. So you want to set the key, not the value of the input element. I did this by having a getElementKey-method in the Action class which returns the key you want as the default. Element is the name of the input element. On 7/12/07, Toni

Re: [S2] autocompleter, predefining initial value

2007-07-12 Thread Toni Lyytikäinen
The value attribute sets the preset value of the input element, if that is what youre looking for. On 7/12/07, Pedro Herrera <[EMAIL PROTECTED]> wrote: I´m using autocompleter tag with Struts 2.0.8 and I need to show a default value to the user. For example, in the JSON list : [ ["Alabama",

Re: Tab Persistance

2007-07-11 Thread Toni Lyytikäinen
element that I set to the current tab, but it never comes back to the page? Any idea where I went wrong? Thanks, brian- On Jul 10, 2007, at 8:50 AM, Toni Lyytikäinen wrote: > I'd like to know the best practice too. I've done this setting a > parameter > in the request, and in m

Re: Struts 2 performance

2007-07-11 Thread Toni Lyytikäinen
After playing around with Firebug a little I found out that in our project the most costly thing in the page loading process is loading the dojo .js-files. For some reason they are included in the xhtml theme too. If I substitute with leaving out the dojo stuff, pages are loading really fast

Re: redirecting a non-secure request to one that uses https

2007-07-11 Thread Toni Lyytikäinen
Google is your friend, http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/http/HttpServletResponse.html#sendRedirect(java.lang.String) You can get the URL with a method in the HttpServletRequest class, getRequestURL(), substitute "https" for "http" in there and redirect to that page w

Re: Tab Persistance

2007-07-10 Thread Toni Lyytikäinen
I'd like to know the best practice too. I've done this setting a parameter in the request, and in my jsp I have not very elegant but works. On 7/10/07, Brian Trzupek <[EMAIL PROTECTED]> wrote: I have a page with several Struts Tabs on it. When I submit the page, I would like it to come back

Re: redirecting a non-secure request to one that uses https

2007-07-10 Thread Toni Lyytikäinen
It may be an ugly hack, but it has worked for some of my actions. If you return null instead of the action name to be invocated, you can use a response object to send information directly to the user. The HttpServletRequest object has method isSecure() which you can use to determine whether the re

Re: [S2] how to configure Spring's OpenViewInSessionInterceptor for struts2

2007-07-09 Thread Toni Lyytikäinen
cs/non-ioc-version-of-opensessioninviewinterceptor.html I don't know if this one work? Toni Lyytikäinen wrote: > > Sorry, I must have read the post too quickly and assumed you were talking > about the filter, because I haven't really seen a working OSIV interceptor > for Struts 2. If you want to use an i

Re: [S2] how to configure Spring's OpenViewInSessionInterceptor for struts2

2007-07-09 Thread Toni Lyytikäinen
n't know how to configure it in struts2. Thanks again! Toni Lyytikäinen wrote: > > I can't really say about Spring 1.2.8 because I've only ever used 2.0, but > here's what I did: > > in web.xml: > > > > OSIVFilter > > org.springfr

Re: [S2] how to configure Spring's OpenViewInSessionInterceptor for struts2

2007-07-09 Thread Toni Lyytikäinen
I can't really say about Spring 1.2.8 because I've only ever used 2.0, but here's what I did: in web.xml: OSIVFilter org.springframework.orm.hibernate3.support.OpenSessionInViewFilter ... OSIVFilter /* struts2 /* org.springframework.web.context.ContextLoaderListener contextC

The -tag - how to use properly?

2007-07-02 Thread Toni Lyytikäinen
I'm trying to make a simple page like the one in the struts showcase app that displays a tree, and when the user clicks a node, the page will display information about that node. The problem is however, that the documentation on the tree-tag is scarce and the example in the showcase app (version 2

How to pass messages that survive redirects?

2007-06-29 Thread Toni Lyytikäinen
I've used to doing something like this in Ruby on Rails: if @object.updateAttributes(params[:object]) flash[:notice]="Update succesful!" redirect_to :action=>'list' else ... Now that I'm using Struts 2 for a project I tried doing something similar: try { objectService.save(getObject())

Re: Struts 2 Login example using a session

2007-06-27 Thread Toni Lyytikäinen
Or better yet, create a Login interceptor or Login filter that checks the session and redirects to login page if the required key is not there. Make package(s) of the actions you want to expose to authenticated users only and put the interceptor into that packages interceptor stack. On 6/27/07, W

Re: S2: autocompletion trouble in 2.0.8

2007-06-26 Thread Toni Lyytikäinen
Try removing the last comma from the list like this: [ ["ALABAMA STATE UNIV HORNETS"], ["ALBANY ST UNIV GOLDEN RAMS"], ["BALDWIN-WALLCE CLG YELLW JCKTS"], ["BALL ST UNIV CARDINALS"], ["BAYLOR UNIV BEARS"], ["CATAWBA COLLEGE"] <-- removed

Re: integration of hibernate3 in struts2

2007-06-21 Thread Toni Lyytikäinen
What kind of filter are you using? Have you made one yourself or is it the one from the Spring framework? If not, consider looking into Spring. Spring includes an OSIV filter that seems to work for me at least. I'm also using the Spring declarative transactions in my DAOs which makes writing datab