Re: Tiles upgrade Path

2020-03-25 Thread Ken McWilliams
Tiles and sitemesh are for traditional (non - single page applications)
development. Tiles has performance advantages over sitemesh. I don't think
the OP should experience any blockers with respect to tiles migration and
will gain version 3 benefits as well.

On Wed., Mar. 25, 2020, 10:40 a.m. M Huzaifah 
wrote:

> Hii
>
> Got the differencea in here
> http://tiles.apache.org/framework/tutorial/pattern.html
>
> I have to try using tiles. When i need a Single Page Application approach,
> currently i use one single jsp page that have iframe in it. So the page
> literally have header, footer, sidebar, and iframe for body content. And
> then, when we hit the menu in sidebar, the iframe body should reload with
> page return from normal struts action. I make all pages in struts (not all
> jsp, except selected jsp e.g login, main page, etc) decorated by sitemesh.
>
> Anyone can give me a efective why to build SPA approach in struts2 ?
>
> Regards.
>
>
> On Wed, Mar 25, 2020, 23:19 M Huzaifah  wrote:
>
> > Hii
> >
> > I am not use tiles before, it seems like site mesh. Currently we use
> > sitemesh to decorate page based on url. I checked the tiles its retired.
> I
> > suggest you to use sitemesh. I dont know what is plus using tiles. With
> > sitemesh you don't even use plugin in struts.
> >
> > Thank you...
> >
> > On Mon, Mar 23, 2020, 16:41 amit vijayvargee 
> > wrote:
> >
> >> Hi,
> >>
> >> We are currently looking to migrate struts 2.3 and tiles 2 to newer
> >> version. As per the security scan, existing tiles (2.0) version is
> >> deprecated and reported some vulnerability in it.
> >> Could you please help to answer following queries?
> >> •   Possible options to migrate to newer version, we are planning to
> >> upgrade to struts 2.5 with tiles plugin, please confirm
> >> •   Any migration documentation or reference link would be helpful
> >> •   Any challenges/issues during the upgrade cycle?
> >> •   Support lifecycle & maintainability of struts2-tiles-plugin
> >> •   As per the maven repository struts2-tiles-plugin has only
> compile
> >> tile dependency upon tiles-jars (core, api etc..) and doesn’t required
> to
> >> bundle with the deployable artifact (.war)?
> >>   Thanks in advance.
> >>
> >> Regards,
> >> Amit V
> >>
> >> -
> >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> >> For additional commands, e-mail: user-h...@struts.apache.org
> >>
> >>
>


Re: Architectural considerations

2019-12-23 Thread Ken McWilliams
Regarding being at the right place, no this is a Struts specific mailing
list. The concerns you bring up are beyond the scope of Struts2, at least
in general. If you needed specific integration help, as you've seen the
people here are quite friendly, do feel free to ask.

Consider a general Java mailing list, and if you provide detailed
requirements and demonstrate efforts at an actual solution then Stack
Overflow would be good (they aren't too friendly if those requirements are
not met. While that can be challenging, the reward is faster and higher
quality results) given the previous threads I strongly advise a general
Java mailing list since the nature of advice is more sound-boarding than
specifics.

On Mon, Dec 23, 2019 at 4:18 AM Zahid Rahman  wrote:

> Hi,
>
> Somebody advised me that I need to consider connection pooling , load
> balancing , whether a database design can be perfect.
> Also not to waste time doing EJBs .
> Am  I at the right place  ?
>


-- 
Sent from my C64 using a 300 baud modem


Re: How to determine if a Windows server is running Apache Struts?

2017-09-06 Thread Ken McWilliams
Programs can also be "exploded" (not in any type of zip file) so be sure to
search all files in the normal filesystem as well. To test your script just
create a couple zip files with some nested folders where you have placed
some made up files either called "struts.xml" or "struts2-core-*.jar" to be
sure that your script is able to identify them. If they don't find those,
your script is unhappy!

On Wed, Sep 6, 2017 at 5:51 PM, Ken McWilliams <ken.mcwilli...@gmail.com>
wrote:

> Struts isn't a stand alone program but a framework, typically seen as
> project dependency which supports web development on the JVM.
>
> I don't know the answer to 1) [although I will at the end go though the
> process I would attempt to find such programs].
>
> 2) No. Struts2 [which is different code base from struts v1, and does not
> share the same issues] is a Java Web Framework, it will run on any JEE
> compliant web server, and will run on embedded web servers such as Jetty.
>
> 3) No. And the program list will not determine if the program uses the
> struts framework.
>
> How I would attempt to determine the issue:
>
> Most programs will not have been obfuscated (which may make determining
> this much harder).
> Java applications are typically packaged as JAR, WAR, or EAR. These are
> all just zip files. I would automate the process to scan for all such
> files, open them recursively travel their internal folder structure and
> search for either struts.xml OR struts2-core-*.jar where "*" is a version
> number, and accumulate all such files and or paths to these files into a
> plain text document and then check them by hand [to determine the version
> of struts, and determine if it has the security exploit and/or is
> exploitable (if it is isn't accessible to the outside world generally it
> isn't a concern, of course this depends company size and the nature of what
> is being secured)]. Some assumptions could be made about the internal
> project structure that could save a great deal of time but because of build
> differences these shortcuts (assuming what folder libraries are stored in)
> could cause you to miss something so it is probably best to just search
> everything.
>
> On Wed, Sep 6, 2017 at 4:56 PM, Sean Son <linuxmailinglistsem...@gmail.com
> > wrote:
>
>> Hello all
>>
>> I am new to the mailing list as well as new to Apache Struts.  We all
>> heard
>> in the news about the vulnerability affecting Apache Struts. I have been
>> tasked to determine which of our servers have Struts running on them.  I
>> have a few questions on how to determine if a server is running Struts or
>> not:
>>
>> 1) How does one determine if a Windows server, running IIS, has the Apache
>> Struts framework installed on it?
>>
>> 2) Does Apache Struts only run on Apache Webserver and Tomcat?
>>
>> 3) Is there a simple way to determine if a server has Struts installed,
>> instead of logging into each of the servers and checking the programs
>> list?
>>
>>
>> I appreciate ALL help!
>>
>>
>> Thanks
>>
>> Sean
>>
>
>
>
> --
> Sent from my C64 using a 300 baud modem
>



-- 
Sent from my C64 using a 300 baud modem


Re: How to determine if a Windows server is running Apache Struts?

2017-09-06 Thread Ken McWilliams
Struts isn't a stand alone program but a framework, typically seen as
project dependency which supports web development on the JVM.

I don't know the answer to 1) [although I will at the end go though the
process I would attempt to find such programs].

2) No. Struts2 [which is different code base from struts v1, and does not
share the same issues] is a Java Web Framework, it will run on any JEE
compliant web server, and will run on embedded web servers such as Jetty.

3) No. And the program list will not determine if the program uses the
struts framework.

How I would attempt to determine the issue:

Most programs will not have been obfuscated (which may make determining
this much harder).
Java applications are typically packaged as JAR, WAR, or EAR. These are all
just zip files. I would automate the process to scan for all such files,
open them recursively travel their internal folder structure and search for
either struts.xml OR struts2-core-*.jar where "*" is a version number, and
accumulate all such files and or paths to these files into a plain text
document and then check them by hand [to determine the version of struts,
and determine if it has the security exploit and/or is exploitable (if it
is isn't accessible to the outside world generally it isn't a concern, of
course this depends company size and the nature of what is being secured)].
Some assumptions could be made about the internal project structure that
could save a great deal of time but because of build differences these
shortcuts (assuming what folder libraries are stored in) could cause you to
miss something so it is probably best to just search everything.

On Wed, Sep 6, 2017 at 4:56 PM, Sean Son 
wrote:

> Hello all
>
> I am new to the mailing list as well as new to Apache Struts.  We all heard
> in the news about the vulnerability affecting Apache Struts. I have been
> tasked to determine which of our servers have Struts running on them.  I
> have a few questions on how to determine if a server is running Struts or
> not:
>
> 1) How does one determine if a Windows server, running IIS, has the Apache
> Struts framework installed on it?
>
> 2) Does Apache Struts only run on Apache Webserver and Tomcat?
>
> 3) Is there a simple way to determine if a server has Struts installed,
> instead of logging into each of the servers and checking the programs list?
>
>
> I appreciate ALL help!
>
>
> Thanks
>
> Sean
>



-- 
Sent from my C64 using a 300 baud modem


Re: struts2 +rest service problem

2017-07-19 Thread Ken McWilliams
As mentioned in the other thread have you added the conventions plug-in?

The indicated error indicates a failure of Struts2 to be able to find what
it needs so your posted source should not be at issue.

On Wed, Jul 19, 2017 at 3:13 PM, john lee 
wrote:

>
> Please help for the struts2 + rest service
>
> http://beta-dev/ecommerce/employee.xml
>
>
>
>
> return the following error report
>
> Struts Problem Report
> Struts has detected an unhandled exception:
> | Messages: |
>- com.thoughtworks.xstream.XStream
>- com/thoughtworks/xstream/XStream
>- java.lang.reflect.InvocationTargetException
>- java.lang.RuntimeException: java.lang.reflect.
> InvocationTargetException
>- java.lang.RuntimeException: java.lang.RuntimeException:
> java.lang.reflect.InvocationTargetException
>- java.lang.RuntimeException: java.lang.RuntimeException:
> java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
>  |
> | File: | org/apache/catalina/loader/WebappClassLoader.java |
> | Line number: | 1,714 |
>
>
> Stacktraces
> java.lang.RuntimeException: java.lang.RuntimeException:
> java.lang.RuntimeException: java.lang.RuntimeException: 
> java.lang.reflect.InvocationTargetException
>   com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(
> ContainerImpl.java:301)
> com.opensymphony.xwork2.inject.ContainerImpl.inject(
> ContainerImpl.java:492)
> com.opensymphony.xwork2.inject.ContainerImpl$6.call(
> ContainerImpl.java:530)
>
>
> source code:
> cat Employee*.java
> package xyz;
> import xyz.*;
> import java.util.Map;
> import org.apache.struts2.rest.DefaultHttpHeaders;import
> org.apache.struts2.rest.HttpHeaders;import 
> com.opensymphony.xwork2.ModelDriven;public
> class EmployeeController implements ModelDriven{private
> static final long serialVersionUID = 1L;private String id;
> private Object model;private EmployeeRepository employeeRepository
> = new EmployeeRepository();private static Map
> map;{map = employeeRepository.findAllEmployee();
>}public HttpHeaders index() {model = map;
> return new DefaultHttpHeaders("index").disableCaching();
>   }public String add(){Integer empId =
> Integer.parseInt(id);Employee emp = new
> Employee(empId,"Ramesh", "PQR");model = emp;
> return "SUCCESS";}public String getId() {
>  return id;}public void setId(String id) {
> model = employeeRepository.getEmployeeById(id);this.id =
> id;}@Overridepublic Object getModel() {
>return model;}}
> package xyz;
> import java.util.*;import xyz.*;
>
> public class Employee {private Integer id;private String
> name;private String company;public Employee(Integer id,
> String name, String company){this.id =id;
> this.name = name;this.company = company;}
> public Integer getId() {return id;}public
> void setId(Integer id) {this.id = id;}
> public String getName() {return name;}
> public void setName(String name) {this.name = name;
>  }public String getCompany() {return company;
>  }public void setCompany(String company) {
>  this.company = company;}} package xyz;
>
> import java.util.*;import java.sql.Timestamp;import xyz.*;
> import java.util.HashMap;import java.util.Map;
> public class EmployeeRepository {private static
> Map map = new HashMap(); public
> EmployeeRepository(){map.put("111", new Employee(111,
> "Ram", "ABC"));map.put("222", new Employee(222, "Shyam",
> "EFG"));map.put("333", new Employee(333, "Mohan", "XYZ"));
>   }public  Employee getEmployeeById(String id){
>  return map.get(id);}public  Map
> findAllEmployee(){return map;}}
>
> my configuration for struts.xml
>
>
> 
>
> 
>
>/>
>
>
>
>
>   
>
>
>
>
>   
>
>value="/rest:rest,:struts"/>
>
>   
>
>   
>
>value="rest-default"/>
>
>   
>
>
>
>
>


-- 
Sent from my C64 using a 300 baud modem


Re: struts2 with rest service

2017-07-19 Thread Ken McWilliams
Have you also included the struts2-conventions-plugin?


org.apache.struts
struts2-convention-plugin
2.5.10.1


struts2-rest-plugin most definitely depends on struts2-conventions-plugin
but it isn't a declared dependency. I've thought that was strange for some
time. All the bean configurations such as struts.convention.action.suffix,
couldn't work otherwise.

On Wed, Jul 19, 2017 at 1:10 PM, john lee 
wrote:

> To whom it may concern,
> my struts+spring+hibernate+mysql works fine, but try to embed the rest
> service in the application and failed to start.
> my adding/change is the following
> WEB-INF/lib  (add the following jar)json-lib-2.3-jdk15.jar
> struts2-rest-plugin-2.3.32.jar
>
> WEB-INF/classes/struts.xml (add the following line with red font)
> 
>   
>   
>name="struts.mapper.prefixMapping" value="/rest:rest,:struts"/>
> 
> 
>  value="rest-default"/>   value="example"/>
>  value="org.apache.struts2.spring.StrutsSpringObjectFactory"
> />
>   
> after start application, but in catalina.out see the following error, i
> did copy struts-plugin.xml into WEB-INF/classes/.
> thanks in advance
> john
>
> ***
> SEVERE: Exception starting filter struts2Unable to load configuration. -
> bean - jar:file:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-
> INF/lib/struts2-rest-plugin-2.3.32.jar!/struts-plugin.xml:30:130
> at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:504)
> at org.apache.struts2.dispatcher.ng.InitOperations.
> initDispatcher(InitOperations.java:74)at
> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.
> init(StrutsPrepareAndExecuteFilter.java:57)at
> org.apache.catalina.core.ApplicationFilterConfig.initFilter(
> ApplicationFilterConfig.java:278)Caused by: Unable to load
> configuration. - bean - jar:file:/var/apache-tomcat-7.
> 0.34/webapps/ecommerce/WEB-INF/lib/struts2-rest-plugin-2.
> 3.32.jar!/struts-plugin.xml:30:130at com.opensymphony.xwork2.
> config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
>   at 
> org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:978)
>   at org.apache.struts2.dispatcher.Dispatcher.init_
> PreloadConfiguration(Dispatcher.java:446)at
> org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490)
> ... 15 moreCaused by: Unable to load bean: 
> type:com.opensymphony.xwork2.ActionProxyFactory
> class:org.apache.struts2.rest.RestActionProxyFactory - bean -
> jar:file:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-
> INF/lib/struts2-rest-plugin-2.3.32.jar!/struts-plugin.xml:30:130
> at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.
> register(XmlConfigurationProvider.java:247)at
> org.apache.struts2.config.StrutsXmlConfigurationProvider.register(
> StrutsXmlConfigurationProvider.java:102)at
> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(
> DefaultConfiguration.java:240)at com.opensymphony.xwork2.
> config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
>   ... 18 moreCaused by: Bean type interface 
> com.opensymphony.xwork2.ActionProxyFactory
> with the name rest has already been loaded by bean -
> file:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/
> classes/struts-plugin.xml:30:130 - bean - jar:file:/var/apache-tomcat-7.
> 0.34/webapps/ecommerce/WEB-INF/lib/struts2-rest-plugin-2.
> 3.32.jar!/struts-plugin.xml:30:130at com.opensymphony.xwork2.
> config.providers.XmlConfigurationProvider.register(
> XmlConfigurationProvider.java:231)... 21 more
>



-- 
Sent from my C64 using a 300 baud modem


Re: Limitations using Struts2-conventions-plugin (lack of multiple configuration roots)

2017-07-12 Thread Ken McWilliams
Thank you for meditating on this!

On Mon, Jul 10, 2017 at 2:07 AM, Lukasz Lenart <lukaszlen...@apache.org>
wrote:

> I thought about this idea and it requires implementation of a root
> Dispatcher with list of child Dispatchers per config file/package/etc.
> Doable but won't happen soon ;-)
>
> 2017-06-23 23:22 GMT+02:00 Ken McWilliams <ken.mcwilli...@gmail.com>:
> > Yes, something like that.
> >
> > But I think i can be done in a hackish way without much change. Really it
> > is the conventions plugin that is at fault, or rather a lack of
> convention
> > regarding sharing configuration that aught to be standardized.
> >
> > The beans and constants are currently scoped globally, just inside the
> >  the beans in struts2-conventions-plugin
> struts-plugin.xml
> > file can only be set once.
> >
> > Consider the struts2-rest plugin, at a quick glance of the setup
> > documentation it is clear that it wants to impose it's own conventions:
> > https://cwiki.apache.org/confluence/display/WW/REST+Plugin you will see
> a
> > number of blocks such as:
> >
> > 
> > 
> >  > "rest-default"/>
> > 
> >
> > Which are required in the setup. This isn't as simple as it aught to be,
> > there should be a number of packages defined in the rest plugins
> > struts-plugin.xml and by extending that get the most typical
> configurations
> > (obviously every configuration can't be known but a couple choices
> wouldn't
> > be bad). Is it reasonable for people to be intimately familiar with the
> > conventions configuration such that they would know how to configure the
> > rest plugin? As it stands this seems to be the case but in terms of user
> > experience, it's a bit of a pain and if you want both your conventions
> AND
> > the rest plugin, you find yourself being stuck (like an under-inflated
> > balloon animal, you can choose to have the head inflated of the tail, but
> > not both).
> >
> > This is one possible way to solve the issue:
> > - Create a new interceptor called "PackageConfigurationInterceptor";
> since
> > interceptors are instantiated once per package they have the scope that I
> > would expect.
> > - When using conventions scan for the existence of this interceptor, if
> > found use it's beans and constants in place of the global ones.
> >
> > ===
> > package com.kenmcwilliams.struts.config;
> >
> > public class ConventionsPackageConfigInterceptor extends
> > PackageConfigInterceptor {
> >
> > public ConventionsPackageConfigInterceptor() {
> > super();
> > //   > name="convention"
> > class="org.apache.struts2.convention.ConventionUnknownHandler"/>
> > this.beans.add(new
> > StrutsBean("com.opensymphony.xwork2.UnknownHandler", "convention",
> > "org.apache.struts2.convention.ConventionUnknownHandler"));
> >
> > //   > name="convention"
> > class="org.apache.struts2.convention.PackageBasedActionConfigBuilder"/>
> > //   > name="convention"
> > class="org.apache.struts2.convention.SEOActionNameBuilder"/>
> > //   > name="convention"
> > class="org.apache.struts2.convention.DefaultResultMapBuilder"/>
> > //   > name="convention"
> > class="org.apache.struts2.convention.DefaultInterceptorMapBuilder"/>
> > //   > name="convention"
> > class="org.apache.struts2.convention.ConventionsServiceImpl"/>
> > this.beans.add(new
> > StrutsBean("org.apache.struts2.convention.ActionConfigBuilder",
> > "convention",
> > "org.apache.struts2.convention.PackageBasedActionConfigBuilder"));
> > this.beans.add(new
> > StrutsBean("org.apache.struts2.convention.ActionNameBuilder",
> "convention",
> > "org.apache.struts2.convention.SEOActionNameBuilder"));
> > this.beans.add(new
> > StrutsBean("org.apache.struts2.convention.ResultMapBuilder",
> "convention",
> > "org.apache.struts2.convention.DefaultResultMapBuilder"));
> > this.beans.add(new
> > StrutsBean("org.apache.struts2.convention.InterceptorMapBuilder",
> > "convention",
> > "org.apache.struts2.convention.DefaultInterceptorMapBuilder"));
> > this.beans.add(new
> > StrutsBean("org.apache.struts2.convention.ConventionsServ

Re: Integrate Apache Shiro with Struts2

2017-06-30 Thread Ken McWilliams
Thank you, look forward to it, I'm working on the same thing!
I'm using this SO Q as my starting point and the accepted answers link
the an similar example using StromPath:
https://stackoverflow.com/questions/27063599/writing-custom-shiro-realm

After that is don't I'll be looking to integrate AspectJ and I've
experimented with Dagger2 so those would be the last pieces before I can do
the "real work".

On Fri, Jun 30, 2017 at 5:46 AM, Kofford, C. Todd <tkoff...@ku.edu> wrote:

> Ken, I'm glad to help!
>
> I tried to use the latest version of shiro (1.4.0) too, but ran into a
> some issues. I've posted a message to the shiro user group, and those guys
> are really good about getting back and resolving issues, so I think it's
> only a matter of time before that gets resolved.
>
> I've started another small project, still on shiro 1.3.2, that
> demonstrates how to define a custom shiro "realm", where you can do
> authentication and authorization. It's really pretty easy to implement, so
> it shouldn't take too long to crank out and post up to GitHub.
>
> Todd Kofford
> tkoff...@ku.edu
>
> -Original Message-
> From: Ken McWilliams [mailto:ken.mcwilli...@gmail.com]
> Sent: Thursday, June 29, 2017 1:25 PM
> To: Struts Users Mailing List <user@struts.apache.org>
> Subject: Re: Integrate Apache Shiro with Struts2
>
> Todd, thank you this was a huge help!
>
> I've followed what you did and added it into a demo project that isn't
> much more complicated than what you provided, just so I know how it all
> works.
>
> One of the things I found the hard way is if you move to Shiro 1.4 (the
> latest) it won't start...
>
> I would like to turn your project into an struts2/shiro integration guide
> (although the provided project is quite straight forward). I'm using JPA
> services to get my user credentials so a bit of a guide there wouldn't
> hurt, so next step is to figure out how to make that work with shiro.
>
> Regards,
> Ken
>
> On Mon, Jun 26, 2017 at 9:40 AM, Kofford, C. Todd <tkoff...@ku.edu> wrote:
>
> > OK, I've just uploaded a very simple struts2 - shiro example to github:
> > https://github.com/tkofford/struts2shiro. NOTE - this is a very simple
> > example that uses a default shiro.ini file for
> > authentication/authorization and struts interceptor for "injecting" the
> shiro subject into the stack.
> >
> > I'll start building a more complicated example that uses spring to
> > inject the shiro parts, and reply back when that's done.
> >
> > Todd Kofford
> > University of Kansas
> > tkoff...@ku.edu
> >
> > -Original Message-
> > From: Ken McWilliams [mailto:ken.mcwilli...@gmail.com]
> > Sent: Thursday, June 22, 2017 11:10 AM
> > To: Struts Users Mailing List <user@struts.apache.org>
> > Subject: Re: Integrate Apache Shiro with Struts2
> >
> > That would be awesome. From having looked around on the web there is
> > very little Struts2/Shiro content. Some examples would be a great help.
> >
> > On Thu, Jun 22, 2017 at 9:51 AM, Kofford, C. Todd <tkoff...@ku.edu>
> wrote:
> >
> > > We've been using strut2 and shiro for a long time (actually since
> > > the old jsecurity days). I'd be happy to contribute some trivial and
> > > more complex examples if needed.
> > >
> > > Todd Kofford
> > > University of Kansas
> > > tkoff...@ku.edu
> > >
> > >
> > > -Original Message-
> > > From: Lukasz Lenart [mailto:lukaszlen...@apache.org]
> > > Sent: Sunday, June 18, 2017 3:23 AM
> > > To: Struts Users Mailing List <user@struts.apache.org>
> > > Subject: Re: Integrate Apache Shiro with Struts2
> > >
> > > 2017-06-17 19:08 GMT+02:00 Ken McWilliams <ken.mcwilli...@gmail.com>:
> > > > If not I hope to follow up with a solution.
> > >
> > > +1 and we can add it to our docs :)
> > >
> > >
> > > Regards
> > > --
> > > Łukasz
> > > + 48 606 323 122 http://www.lenart.org.pl/
> > >
> > > 
> > > - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > > For additional commands, e-mail: user-h...@struts.apache.org
> > >
> > >
> >
> > -
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
>
>
>
> --
> Sent from my C64 using a 300 baud modem
>



-- 
Sent from my C64 using a 300 baud modem


Re: Integrate Apache Shiro with Struts2

2017-06-29 Thread Ken McWilliams
Todd, thank you this was a huge help!

I've followed what you did and added it into a demo project that isn't much
more complicated than what you provided, just so I know how it all works.

One of the things I found the hard way is if you move to Shiro 1.4 (the
latest) it won't start...

I would like to turn your project into an struts2/shiro integration guide
(although the provided project is quite straight forward). I'm using JPA
services to get my user credentials so a bit of a guide there wouldn't
hurt, so next step is to figure out how to make that work with shiro.

Regards,
Ken

On Mon, Jun 26, 2017 at 9:40 AM, Kofford, C. Todd <tkoff...@ku.edu> wrote:

> OK, I've just uploaded a very simple struts2 - shiro example to github:
> https://github.com/tkofford/struts2shiro. NOTE - this is a very simple
> example that uses a default shiro.ini file for authentication/authorization
> and struts interceptor for "injecting" the shiro subject into the stack.
>
> I'll start building a more complicated example that uses spring to inject
> the shiro parts, and reply back when that's done.
>
> Todd Kofford
> University of Kansas
> tkoff...@ku.edu
>
> -Original Message-
> From: Ken McWilliams [mailto:ken.mcwilli...@gmail.com]
> Sent: Thursday, June 22, 2017 11:10 AM
> To: Struts Users Mailing List <user@struts.apache.org>
> Subject: Re: Integrate Apache Shiro with Struts2
>
> That would be awesome. From having looked around on the web there is very
> little Struts2/Shiro content. Some examples would be a great help.
>
> On Thu, Jun 22, 2017 at 9:51 AM, Kofford, C. Todd <tkoff...@ku.edu> wrote:
>
> > We've been using strut2 and shiro for a long time (actually since the
> > old jsecurity days). I'd be happy to contribute some trivial and more
> > complex examples if needed.
> >
> > Todd Kofford
> > University of Kansas
> > tkoff...@ku.edu
> >
> >
> > -Original Message-
> > From: Lukasz Lenart [mailto:lukaszlen...@apache.org]
> > Sent: Sunday, June 18, 2017 3:23 AM
> > To: Struts Users Mailing List <user@struts.apache.org>
> > Subject: Re: Integrate Apache Shiro with Struts2
> >
> > 2017-06-17 19:08 GMT+02:00 Ken McWilliams <ken.mcwilli...@gmail.com>:
> > > If not I hope to follow up with a solution.
> >
> > +1 and we can add it to our docs :)
> >
> >
> > Regards
> > --
> > Łukasz
> > + 48 606 323 122 http://www.lenart.org.pl/
> >
> > -
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> >
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>



-- 
Sent from my C64 using a 300 baud modem


Re: Limitations using Struts2-conventions-plugin (lack of multiple configuration roots)

2017-06-23 Thread Ken McWilliams
ntion.action.checkImplementsAction", "true"));
this.constants.add(new
StrutsConstant("struts.convention.default.parent.package",
"convention-default"));
this.constants.add(new
StrutsConstant("struts.convention.action.name.lowercase", "true"));
this.constants.add(new
StrutsConstant("struts.convention.action.name.separator", "-"));
this.constants.add(new
StrutsConstant("struts.convention.package.locators",
"action,actions,struts,struts2"));
this.constants.add(new
StrutsConstant("struts.convention.package.locators.disable", "false"));
this.constants.add(new
StrutsConstant("struts.convention.package.locators.basePackage", ""));
this.constants.add(new
StrutsConstant("struts.convention.exclude.packages",
"org.apache.struts.*,org.apache.struts2.*,org.springframework.web.struts.*,org.springframework.web.struts2.*,org.hibernate.*"));
this.constants.add(new
StrutsConstant("struts.convention.relative.result.types",
"dispatcher,velocity,freemarker"));
this.constants.add(new
StrutsConstant("struts.convention.redirect.to.slash", "true"));
this.constants.add(new
StrutsConstant("struts.convention.action.alwaysMapExecute", "true"));
this.constants.add(new
StrutsConstant("struts.mapper.alwaysSelectFullNamespace", "true"));
this.constants.add(new
StrutsConstant("struts.convention.action.fileProtocols", "jar"));

//  
this.constants.add(new
StrutsConstant("struts.convention.classes.reload", "false"));
//  
this.constants.add(new
StrutsConstant("struts.convention.exclude.parentClassLoader", "true"));
}
}

===

package com.kenmcwilliams.struts.config;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;

/**
 * One instance of an interceptor is created per struts-package
 * @author ken
 */
public class PackageConfigInterceptor implements Interceptor{
public final HashSet constants = new HashSet();
public final List beans = new ArrayList();

public List findBean(String name, String type){
List found = new ArrayList();
for(StrutsBean bean : beans){
if(bean.getName().equals(name) && bean.getType().equals(type)){
found.add(bean);
}
}
return found;
}

public Optional findConstant(String name){
Iterator iterator = this.constants.iterator();
while(iterator.hasNext()){
StrutsConstant constant = iterator.next();
if(constant.getName().equals(name)){
return Optional.of(constant);
}
}
return Optional.ofNullable(null);
}

@Override
public void destroy() {
}

@Override
public void init() {

}

@Override
public String intercept(ActionInvocation invocation) throws Exception {
return invocation.invoke();
}
}

===

The above was just a quick hack for illustration. If struts could extend
it's configuration and xml to provide package level scope (struts packages)
and object for such purposes, and some functionality to provide
configuration lookup from the perspective of a particular package a less
hackish/reflective hoop-jumping could be done when reimplementing the
conventions plugin, as it stands it's probably possible using this
interceptor technique.






On Fri, Jun 23, 2017 at 12:39 AM, Lukasz Lenart <lukaszlen...@apache.org>
wrote:

> 2017-06-22 2:45 GMT+02:00 Ken McWilliams <ken.mcwilli...@gmail.com>:
> > Sure, doing Struts2/Shiro integration at the moment. Will come back to
> > this, it was a rant from running into issues when setting up some
> personal
> > demo projects. The limitation from one static configuration to cover all
> > conventions (which really just lets you use one convention, at least
> well).
>
> Did I get this right, you want to have multiple configuration in the
> same app, like having multiple struts.xml files in one app, right?
> Hmm... maybe it is doable ... per a root package 
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
Sent from my C64 using a 300 baud modem


Re: Integrate Apache Shiro with Struts2

2017-06-22 Thread Ken McWilliams
That would be awesome. From having looked around on the web there is very
little Struts2/Shiro content. Some examples would be a great help.

On Thu, Jun 22, 2017 at 9:51 AM, Kofford, C. Todd <tkoff...@ku.edu> wrote:

> We've been using strut2 and shiro for a long time (actually since the old
> jsecurity days). I'd be happy to contribute some trivial and more complex
> examples if needed.
>
> Todd Kofford
> University of Kansas
> tkoff...@ku.edu
>
>
> -Original Message-
> From: Lukasz Lenart [mailto:lukaszlen...@apache.org]
> Sent: Sunday, June 18, 2017 3:23 AM
> To: Struts Users Mailing List <user@struts.apache.org>
> Subject: Re: Integrate Apache Shiro with Struts2
>
> 2017-06-17 19:08 GMT+02:00 Ken McWilliams <ken.mcwilli...@gmail.com>:
> > If not I hope to follow up with a solution.
>
> +1 and we can add it to our docs :)
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: Limitations using Struts2-conventions-plugin (lack of multiple configuration roots)

2017-06-21 Thread Ken McWilliams
Sure, doing Struts2/Shiro integration at the moment. Will come back to
this, it was a rant from running into issues when setting up some personal
demo projects. The limitation from one static configuration to cover all
conventions (which really just lets you use one convention, at least well).
And issues in certain configuration being picked up from the xml, views and
annotations(class and package level). Namely when actions are created by
only creating views, I didn't think I couldn't apply package level
annotations and have them configure the actions unless a class is also
created.

So yes I'll come back to this in a bit.

On Wed, Jun 21, 2017 at 1:56 PM, Adam Brin <ab...@digitalantiquity.org>
wrote:

> Hi Ken,
>   I think I’m with Lukasz, I wonder if the following might be useful for
> folks to get onto the same page (just from my own head):
>
> • a sample project that shows the trade-offs?
> • a diagram or visualization that shows how the new model might lay out?
>
>
> thanks,
>
> adam
>
> --
> _
> Adam Brin
> Director of Technology, Digital Antiquity
> 480.965.1278
>
> > On Jun 21, 2017, at 11:34 AM, Ken McWilliams <ken.mcwilli...@gmail.com>
> wrote:
> >
> > Sure, it would be most ideal if there could be variables scoped to struts
> > action packages, and accessible from only within that package.
> >
> > Step 1 (Create beans and constants scoped to the package level):
> > Simply creating an interceptor to hold all the configuration that is
> > currently found in struts-plugin.xml would be a lazy start, interceptors
> > are instantiated once per package so they meet the scope requirement
> well.
> > Perhaps creating extending
> >
> >
> > Step 2: (Create configuration based on the per-instance package state.)
> > I'm not sure how that would work out... The actions convention wiring
> > configuration would be run, once for each package that has this magical
> > conventions-config-interceptor in its stack. Probably creating a new
> > conventions plugin as proof of concept. I tried creation a configuration
> > provider a while back and got slowed down to the point of giving up.
> >
> > End Objective:
> > To encapsulate conventions such that multiple types of conventions could
> > operate simultaneously starting at different roots. As an example, the
> rest
> > plugin depends on the conventions plugin however it changes the global
> > configuration in such a way that normal conventions no longer work. In
> this
> > way contributors could develop conventions based code which would be
> > readily mergeable with anyone else's (plugins which use conventions but
> > have no side effects).
> >
> >
> >
> >
> >
> > On Wed, Jun 21, 2017 at 12:39 AM, Lukasz Lenart <lukaszlen...@apache.org
> >
> > wrote:
> >
> >> 2017-06-20 21:48 GMT+02:00 Ken McWilliams <ken.mcwilli...@gmail.com>:
> >>> I like to use the conventions plugin but find myself fighting with it
> >> more
> >>> often than not.
> >>>
> >>> I think conventions should establish a "convention". Now the plugin
> >>> certainly does this in the *singular* but say I want restful services
> >>> handled by conventions, and then I want perhaps a set of packages to
> >>> contain public documents, and another set of packages to require some
> >> form
> >>> of security but also follow some sort of conventions... well I find it
> >>> impossible to use the conventions plugin and need to resort to
> additional
> >>> configuration. Creating packages in struts.xml, or using XML to
> override
> >>> the conventions.
> >>>
> >>> Do you think it would be reasonable to have the conventions plugin,
> >> create
> >>> a new configuration interceptor for which all the constants (package
> >> level
> >>> constants, as there is one interceptor instance per stack), and the
> rest
> >> of
> >>> the conventions configuration could be looked up from each of these
> >>> configurations?
> >>>
> >>> So the conventions plugin would need to check each struts package to
> see
> >> if
> >>> extends conventions-default and if so, wire the actions at startup for
> >> each
> >>> in turn. If that is too limiting perhaps just make this one
> interceptor a
> >>> requirement for the scan.
> >>>
> >>> Also under this scheme, it would be good to create an "include&qu

Re: Limitations using Struts2-conventions-plugin (lack of multiple configuration roots)

2017-06-21 Thread Ken McWilliams
Sure, it would be most ideal if there could be variables scoped to struts
action packages, and accessible from only within that package.

Step 1 (Create beans and constants scoped to the package level):
Simply creating an interceptor to hold all the configuration that is
currently found in struts-plugin.xml would be a lazy start, interceptors
are instantiated once per package so they meet the scope requirement well.
Perhaps creating extending


Step 2: (Create configuration based on the per-instance package state.)
I'm not sure how that would work out... The actions convention wiring
configuration would be run, once for each package that has this magical
conventions-config-interceptor in its stack. Probably creating a new
conventions plugin as proof of concept. I tried creation a configuration
provider a while back and got slowed down to the point of giving up.

End Objective:
To encapsulate conventions such that multiple types of conventions could
operate simultaneously starting at different roots. As an example, the rest
plugin depends on the conventions plugin however it changes the global
configuration in such a way that normal conventions no longer work. In this
way contributors could develop conventions based code which would be
readily mergeable with anyone else's (plugins which use conventions but
have no side effects).





On Wed, Jun 21, 2017 at 12:39 AM, Lukasz Lenart <lukaszlen...@apache.org>
wrote:

> 2017-06-20 21:48 GMT+02:00 Ken McWilliams <ken.mcwilli...@gmail.com>:
> > I like to use the conventions plugin but find myself fighting with it
> more
> > often than not.
> >
> > I think conventions should establish a "convention". Now the plugin
> > certainly does this in the *singular* but say I want restful services
> > handled by conventions, and then I want perhaps a set of packages to
> > contain public documents, and another set of packages to require some
> form
> > of security but also follow some sort of conventions... well I find it
> > impossible to use the conventions plugin and need to resort to additional
> > configuration. Creating packages in struts.xml, or using XML to override
> > the conventions.
> >
> > Do you think it would be reasonable to have the conventions plugin,
> create
> > a new configuration interceptor for which all the constants (package
> level
> > constants, as there is one interceptor instance per stack), and the rest
> of
> > the conventions configuration could be looked up from each of these
> > configurations?
> >
> > So the conventions plugin would need to check each struts package to see
> if
> > extends conventions-default and if so, wire the actions at startup for
> each
> > in turn. If that is too limiting perhaps just make this one interceptor a
> > requirement for the scan.
> >
> > Also under this scheme, it would be good to create an "include" for the
> > Java package scan rather than the "exclude" which is more suited to one
> > root.
> >
> > I think this scheme would greatly reduce annotation usage as it would be
> > possible to stay entirely within established conventions, rendering
> > overrides unnecessary.
>
> This sounds interesting but I'm not really grasp all the details.
> Maybe we can start with a one thing and then implement another. Can
> you split your idea into single steps?
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
Sent from my C64 using a 300 baud modem


Limitations using Struts2-conventions-plugin (lack of multiple configuration roots)

2017-06-20 Thread Ken McWilliams
I like to use the conventions plugin but find myself fighting with it more
often than not.

I think conventions should establish a "convention". Now the plugin
certainly does this in the *singular* but say I want restful services
handled by conventions, and then I want perhaps a set of packages to
contain public documents, and another set of packages to require some form
of security but also follow some sort of conventions... well I find it
impossible to use the conventions plugin and need to resort to additional
configuration. Creating packages in struts.xml, or using XML to override
the conventions.

Do you think it would be reasonable to have the conventions plugin, create
a new configuration interceptor for which all the constants (package level
constants, as there is one interceptor instance per stack), and the rest of
the conventions configuration could be looked up from each of these
configurations?

So the conventions plugin would need to check each struts package to see if
extends conventions-default and if so, wire the actions at startup for each
in turn. If that is too limiting perhaps just make this one interceptor a
requirement for the scan.

Also under this scheme, it would be good to create an "include" for the
Java package scan rather than the "exclude" which is more suited to one
root.

I think this scheme would greatly reduce annotation usage as it would be
possible to stay entirely within established conventions, rendering
overrides unnecessary.

-- 
Sent from my C64 using a 300 baud modem


Re: Is it the mailing list for struts2?

2017-06-17 Thread Ken McWilliams
Yes

On Sat, Jun 17, 2017 at 9:22 AM, ssmtpmailtesting ssmtpmailtesting <
ssmtpmailtest...@gmail.com> wrote:

> Can I ask question about struts2 here?
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
Sent from my C64 using a 300 baud modem


Integrate Apache Shiro with Struts2

2017-06-17 Thread Ken McWilliams
Looking to Integrate Apache Shiro with Struts2.

If anyone on the list has done this I would love to hear about it.

If not I hope to follow up with a solution.

-- 
Sent from my C64 using a 300 baud modem


Re: Update request to web site regarding Log4j and "Getting Started" section

2017-06-13 Thread Ken McWilliams
Thank you, I've just looked into how to edit the pages, I'll keep it in
mind for the future. Thank you!

I'll try to make a couple edits in the near future, something about those
tag reference pages have been annoying me for years (I'm aware they are
automatically generated).

On Tue, Jun 13, 2017 at 12:03 AM, Łukasz Lenart <lukasz.len...@gmail.com>
wrote:

> Done
>
> 2017-06-12 20:28 GMT+02:00 Ken McWilliams <ken.mcwilli...@gmail.com>:
> > Sorry...
> >
> > The following "Getting started" page "How To Create A Struts 2 Web
> > Application:
> > http://struts.apache.org/getting-started/how-to-create-
> a-struts2-web-application.html
> >
> > Tells you to add:
> >
> > 
> > org.apache.logging.log4j
> > log4j-core
> > 2.8.2
> >
> >
> > When it should be both log4j-core and log4j-api:
> >
> >
> > 
> > org.apache.logging.log4j
> > log4j-core
> > 2.8.2
> > 
> > 
> > org.apache.logging.log4j
> > log4j-api
> > 2.8.2
> > 
> >
> > Because struts has a dependency to an earlier version of log4j... if both
> > are explicitly specified even with x.x.x versions, most users would use
> the
> > latest and keep them in sync. It isn't fun to experience _any_ errors
> when
> > doing a starting tutorial.
> >
> >
> >
> >
> >
> > On Mon, Jun 12, 2017 at 12:22 PM, Ken McWilliams <
> ken.mcwilli...@gmail.com>
> > wrote:
> >
> >> The following "Getting started" page:
> >>
> >>
> >
> >
> > --
> > Sent from my C64 using a 300 baud modem
>
>
>
> --
> Łukasz
> mobile +48 606 323 122 http://www.lenart.org.pl/
> Confitura conference http://confitura.pl/
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
Sent from my C64 using a 300 baud modem


Re: Update request to web site regarding Log4j and "Getting Started" section

2017-06-12 Thread Ken McWilliams
Sorry...

The following "Getting started" page "How To Create A Struts 2 Web
Application:
http://struts.apache.org/getting-started/how-to-create-a-struts2-web-application.html

Tells you to add:


org.apache.logging.log4j
log4j-core
2.8.2


When it should be both log4j-core and log4j-api:



org.apache.logging.log4j
log4j-core
2.8.2


org.apache.logging.log4j
log4j-api
2.8.2


Because struts has a dependency to an earlier version of log4j... if both
are explicitly specified even with x.x.x versions, most users would use the
latest and keep them in sync. It isn't fun to experience _any_ errors when
doing a starting tutorial.





On Mon, Jun 12, 2017 at 12:22 PM, Ken McWilliams <ken.mcwilli...@gmail.com>
wrote:

> The following "Getting started" page:
>
>


-- 
Sent from my C64 using a 300 baud modem


Update request to web site regarding Log4j and "Getting Started" section

2017-06-12 Thread Ken McWilliams
The following "Getting started" page:


Re: convention plugin struts.xml interceptors

2016-11-01 Thread Ken McWilliams
Am I wrong in assuming that this new package is supposed to be the default?
If so it should extend conventions-default and there is some constant that
should be set such that conventions uses this package by default.

Also, perhaps of greater importance: If conventions was working before then
the results would by default be in /WEB-INF/content/ and does not  now ask struts
to search at the root? In which case it probably won't find the previously
established views?

For reference see: https://struts.apache.org/docs/convention-plugin.html
Search on that page for:
struts.convention.result.path and
struts.convention.default.parent.package

On Tue, Nov 1, 2016 at 1:05 PM, ronald.a.ander...@gmail.com <
ronald.a.ander...@gmail.com> wrote:

>
>
> On 2016-11-01 12:20 (-0400), Lukasz Lenart 
> wrote:
> > 2016-11-01 4:00 GMT+01:00 Ronald Andersen :
> > > Hi Lakasz
> > >
> > > Below is the struts.xml and LoginAction (for reference). Using default
> for
> > >  package name in struts.xml:
> > >
> > > 
> > >
> > >  > > "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
> > > "http://struts.apache.org/dtds/struts-2.3.dtd;>
> > > 
> > > 
> > > 
> > > 
> > > 
> > >  > > class="net.codejava.struts.MyCustomInterceptor" />
> > > 
> > > 
> > > 
> > > 
> > > 
> > >
> > > 
> >
> > Do you have more interceptors in your customStack? Secondly, did you
> > define it as a default stack with  ?
> >
> > I'm using almost the same setup and everything is working perfectly
> > fine. Are you sure there is no exception when starting container?
> > Here you have almost the same setup
> > https://github.com/apache/struts-examples/tree/master/unknown-handler
> >
> >
> > Regards
> > --
> > Łukasz
> > + 48 606 323 122 http://www.lenart.org.pl/
> >
> > -
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> > Hi Lukasz,
>
> Reviewing struts-examples/unknown-handler/ and interceptors
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
Sent from my C64 using a 300 baud modem


Re: Struts2 Rest Mapper Taking Over Non Rest Json Result

2016-09-20 Thread Ken McWilliams
To solve a similar issue I ended up creating my own ContentTypeHandler. As
you already have a result it should be pretty easy to wrap (at least I
found it so). The problem is that after doing so all JSON will be handled
by your new Content type...

While this link shows how to use Jackson, you can create your own
implementation and then apply your own configuration in the same way:
http://struts.apache.org/docs/rest-plugin.html#RESTPlugin-UseJacksonframeworkasJSONContentTypeHandler




On Tue, Sep 20, 2016 at 12:34 PM, Paul Zepernick <
paul.zepern...@healthsmart.com> wrote:

> Thanks Martin, it was getting to the correct action class buy it was not
> using the result I defined in the action.  It was going to its own result
> implementation based on the fact that I am requesting an application/json
> data type.  I found out that if I add ".action" to the url it processes
> everything correctly and goes to the correct result.  I am not sure if that
> is the intended behavior, a setup issue on my part, or a bug?
>
> -Original Message-
> From: Martin Gainty [mailto:mgai...@hotmail.com]
> Sent: Tuesday, September 20, 2016 2:24 PM
> To: Struts Users Mailing List 
> Subject: RE: Struts2 Rest Mapper Taking Over Non Rest Json Result
>
> to control navigation why not map it? className="org.healthsmart.NonRestfulAction"> name="id">{1}...
> GET: /grid/method="index"when you reference /grid/ struts will call
> org.healthsmart.NonRestfulAction index method https://struts.apache.org/
> docs/restfulactionmapper.html
>
> or use DMI
> 
>   
> /WEB-INF/content/hello.jsp name="redisplay" type="redirectAction">hello
> add
> https://struts.apache.org/docs/action-configuration.
> html#ActionConfiguration-ActionMappings
> I would check struts.mapper.prefixMapping for normal "rest prefixMapping
> vs struts prefixMapping" configurationhttps://struts.apache.org/docs/
> restfulactionmapper.html
> if that looks ok as a last result you can implement a custom mapper which
> will read the URL and redirect to correct class programaticallyhttp://
> stackoverflow.com/questions/17697432/struts2-rest-plugin-making-
> both-struts-actions-rest-actions-work-together-but
> Martin
> __
>
>
>
> > From: paul.zepern...@healthsmart.com
> > To: user@struts.apache.org
> > Subject: Struts2 Rest Mapper Taking Over Non Rest Json Result
> > Date: Tue, 20 Sep 2016 15:28:42 +
> >
> > This was also posted to stackoverflow and relevant config information
> can be seen in the post: http://stackoverflow.com/
> questions/39593721/struts2-rest-mapper-taking-over-non-rest-json-result
> >
> > I am working with the DataTables JS library and am trying to write
> actions for the grid. I have a api in place that creates the json for me
> already and I just need to stream it back. I created a custom result to
> handle this, but the result mapped in the action never runs. No matter what
> the result type, the REST mapper tries to handle it as soon as it sees that
> application/json has been requested from the client. I have used the prefix
> mapping in the configuration to have all url's using /grid to bypass the
> rest mapper. It seems to be working in some capacity because it runs the
> correct interceptor stack and is using the @Action annotation information
> to map the url. However, the result specified is NOT running and is instead
> being provided by the rest mapper based on the stack trace I am receiving.
> I would like to completely bypass the rest mapper for any actions in the
> /grid namespace. Have I done something wrong in the configuration that is
> still causing rest to be involved in the request to those actions?
> >
> > Paul R. Zepernick
> > Sr. Programmer Analyst
> >
> >
> >
> >
> >
> >
> > Disclaimer: This communication and any files transmitted with it may
> contain information that is privileged, confidential and/or exempt from
> disclosure under applicable law. If you are not the intended recipient, you
> are hereby notified that any disclosure, copying, distribution, or use of
> the information contained herein (including any reliance thereon) is
> strictly prohibited. If you received this communication in error, please
> immediately contact the sender and destroy the material in its entirety,
> whether in electronic or hard copy format. Thank you.
> >
> > -
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
Sent from my C64 using a 300 baud modem


Re: [Question] [struts2-rest-plugin] How shall I handle GET request /orders/{id}/items?

2016-09-07 Thread Ken McWilliams
There isn't a recommended way to handle deeply set lists as per your
example... Or I missed it. I'm not a fan of that plugin.

It is really trivial to do this without any plugins:
https://struts.apache.org/docs/wildcard-mappings.html
Wildcards or using the named-pattern matcher (although in the linked
documentation the heading is "Parameters in namespaces").

It may be possible to use conventions, it might be nice to use annotations
to specify the root and the child actions in the same class for grouping:
http://stackoverflow.com/questions/6037820/is-it-possible-to-use-wildcard-method-invocation-in-struts2-with-conventions-plu

Since you may need to resolve the child entity before fetching the child,
it might be convenient to have them in the same class... save you from
chaining.

Create/Update/Delete using the struts2-rest-plugin are pretty straight
forward but at only one level of access.



On Wed, Sep 7, 2016 at 3:45 AM, Yong Kang Guo  wrote:

> Hi experts,
>
> I'm learning to use the struts2-rest-plugin. In the sample project
> 'rest-showcase', I see a good example where I can GET /orders and
> /orders/1. But how to implement navigation from one resource to another?
> E.g., Let's say an Order has many Items. Then how to implement the proper
> handler to request:
>
> GET /orders/{id}/items, and
>
> GET /orders/{id}/items/{item_id} ?
>
>
> And how to handle Create/Update/Delete requests to the navigation path,
> e.g.
>
> POST /orders/{id}/items
>
> to create a new item under the order?
>
>
> Thanks and Best Regards,
>
> Guo
>



-- 
Sent from my C64 using a 300 baud modem


Re: Struts2 documentation and Stack Overflow

2016-08-31 Thread Ken McWilliams
The Tao of SO is changing all the time, perceptions of what was or was not
acceptable years back have changed. Documentation being so new I think it's
hard to say exactly how it will establish its self.   SO has _a_lot_ of
struts 2 questions... 10,334 at this time. If they were all distinct that
would be staggering but a lot of questions are minute variations of
each-other, if even that. Documentation could be used to fully explain
those sets and variations, so we can reference that one source. I've
stopped answering questions largely because struts2 isn't that complicated
and if one looks for all normal use cases, they've been addressed...
probably in triplicate.

What I am getting at is not reinventing the wheel. "About Struts", "About
Tags", "About Interceptors" there are things that can be said but in the
main, if it was to be all done over by several different groups... they
would probably need to speak to the same things before going someplace new.
Without some duplication, everything would be links. Which in theory makes
sense, in practice would result in unreadable garbage that wouldn't likely
be expanded upon.

I don't think it's any reflection on poor documentation by developers. The
Struts 2 documentation is very good. Sometimes the user community will do
interesting integrations, it would be trivial to plug this into
documentation but harder to get into official struts2 documentation. Which
frankly should probably be concerned with core functionality, aside from
plugins which document common integrations such as Spring. There are some
confusing areas involving some plugins that could stand for some user
supplied documentation. I think people would be more inclined to contribute
with some framework in place.

Anther way to put it, while the developer mind set is to factor out
commonality, "boiler plate is bad" It's really hard to create documents
without boiler plate. Templates and skeletons are our friend. I don't want
to move the whole site, but there are stubs that are reasonably needed.
Sound bites that have been well thought out, and silly to do over. It's not
a duplication, it's a shove another ship off the shore.

On Wed, Aug 31, 2016 at 6:04 PM, Doug Erickson <doug.erick...@part.net>
wrote:

> Stack Overflow Documentation isn't meant to duplicate existing
> documentation. It's intended to provide missing documentation and
> compensate for poor documentation.
>
> So, copying current documentation to SO is definitely not in line with
> their goals.
>
> It *could *be a place to create better documentation for Struts2, but I
> don't think so. I think Documentation's focus on examples is wrong. As an
> experienced Struts2 developer, when I need documentation, I want to look up
> something specific in a reference guide. As a beginner, examples were more
> helpful, but I would want to encounter them in a logical progression, not
> the disorganized grab bag that Documentation uses.
>
> If there's a commitment from Struts developers to improve documentation,
> they should do it on the struts site. Documentation is a place for the
> community to go to contribute their own documentation when maintainers fail
> to do a good job.
>
> On Wed, Aug 31, 2016 at 5:45 PM, Ken McWilliams <ken.mcwilli...@gmail.com>
> wrote:
>
> > StackOverflow is a pretty huge site and a lot of people seek out Struts2
> > Q there, it would be nice if the Struts 2 documentation was available
> via
> > the new StackOverflow documentation initiative.
> >
> > I was tempted to simply copy good chunks of the existing documentation,
> > there is certainly room for improvement but starting from scratch is
> > certainly a daunting effort.
> >
> > What is the view on copying data from struts.apache.org to SO? (I know
> > there will be others from SO who follow this list and would probably do
> > pretty reasonable and good things with a green light)
> >
> > Anyone can write a blurb, and it's looking a bit barren over there right
> > now.
> >
> >
> > --
> > Sent from my C64 using a 300 baud modem
> >
>



-- 
Sent from my C64 using a 300 baud modem


Struts2 documentation and Stack Overflow

2016-08-31 Thread Ken McWilliams
StackOverflow is a pretty huge site and a lot of people seek out Struts2
Q there, it would be nice if the Struts 2 documentation was available via
the new StackOverflow documentation initiative.

I was tempted to simply copy good chunks of the existing documentation,
there is certainly room for improvement but starting from scratch is
certainly a daunting effort.

What is the view on copying data from struts.apache.org to SO? (I know
there will be others from SO who follow this list and would probably do
pretty reasonable and good things with a green light)

Anyone can write a blurb, and it's looking a bit barren over there right
now.


-- 
Sent from my C64 using a 300 baud modem


Re: struts2-rest-plugin issues getting non-restful urls to cooperate

2016-06-29 Thread Ken McWilliams
I have not forgotten about this but in setting up a project I like
everything to work well, the restful urls and non-restful urls are more
less happy. My issue was with POST and PUT requests. The Action uses
model-driven, and with POST which calls create() all is well, while PUT
which calls update() and has almost identical code did not (there are a few
questions on StackOverflow with several different answers). The put method
also sets an id, and then decides to use model driven. I'm not sure what I
did wrong, anyways it somehow was solved out of frustration when I
re-implemented org.apache.struts2.rest.handler.ContentTypeHandler to use
FlexJson.

So a couple observations as a first time user of the struts2-rest-plugin:
- I like the Idea of this extension of conventions, adding constraints can
make you think along certain tried and true methods and make work faster.
- It would be nice if somehow this plugin directly required the conventions
plugin such that it also was able to incorporate the convention
annotations; that is, while these restful conventions are good being able
to override the result with a tiles result (and all the other conventions
overrides afforded with the well though out annotations provided by the
conventions plugin) would be particularly interesting.
- Since I couldn't get such annotations working I need non-restful urls to
render the views, which then call the service provided by the rest-plugin,
that really isn't a big deal.
- Back to results, the rest-plugin seems to favor ContentTypeHandlers...
which I was not familiar with until I ran into an issue where I didn't like
what it was producing. I found that I could recycle the code of my
FlexJsonResult type, if I used ActionContext to get the action (I forget
why right now, but there is a difference in method arguments) then I had
enough information to render what was needed.
- In using the rest-plugin for crud operations, I felt the need to create
interfaces so I would be forced/reminded of what needs to be implemented,
Struts2 has ActionSupport, it would be nice if similar interfaces already
existed for the rest-result type as there are a lot more methods which
typically need to be implemented.
- The documentation shows model driven, so I assume that is the suggested
method of use: I really don't like how the models type is required to be
Object because we are to support the index() method, which returns List
while the rest of the methods return T. So there are more often than not a
ternary operator in the getModel() method.





On Mon, May 30, 2016 at 12:18 AM, Lukasz Lenart <lukaszlen...@apache.org>
wrote:

> 2016-05-27 17:41 GMT+02:00 Ken McWilliams <ken.mcwilli...@gmail.com>:
> > I got it working but I think the documentation could be made with more
> > "hand holding". I'll post a "How to set up struts2 with conventions and
> > both restful and non-restful urls". Then self-answer  the question this
> > weekend with all the configuration and project set-up steps and then post
> > the link here for review, in-case there are any
> differences/recommendations
> > in setup.
>
> Great! Looking forward :)
>
>
> Best
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
Sent from my C64 using a 300 baud modem


Re: struts2-rest-plugin issues getting non-restful urls to cooperate

2016-05-27 Thread Ken McWilliams
I got it working but I think the documentation could be made with more
"hand holding". I'll post a "How to set up struts2 with conventions and
both restful and non-restful urls". Then self-answer  the question this
weekend with all the configuration and project set-up steps and then post
the link here for review, in-case there are any differences/recommendations
in setup.

On Thu, May 26, 2016 at 1:17 PM, Aleksandr Mashchenko <
amashche...@apache.org> wrote:

> Working fine in my project. Can you show your project configuration?
>
> ---
> Regards,
> Aleksandr
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
Sent from my C64 using a 300 baud modem


struts2-rest-plugin issues getting non-restful urls to cooperate

2016-05-24 Thread Ken McWilliams
I'm following these instructions to get restful and non-restful urls to
cooperate:

http://struts.apache.org/docs/rest-plugin.html#RESTPlugin-RESTandnon-RESTfulURL%27sTogetherConfiguration

Having followed the instructions on that page I've been able to set up a
project _only_ containing restful urls, but when I use the config which
supports both I get issues ( action not found).

A while back I used these instructions successfully but on an earlier
version of Struts. Can someone verify that these instructions work for
Struts 2.5?

I probably missed something really simple but a sanity test would be
greatly appreciated.


Re: Editing a JPA entity

2016-01-07 Thread Ken McWilliams
Just my two cents, you can avoid the lookup by using a JPQL UPDATE query.
If used to update a single record you avoid the lookup. If versioning is an
issue this may not be ideal (still you could manually set the version),
also if you expect to reuse objects you lose the ability to proxy, if those
are not issues... there is no reason not to do this.

On Thu, Jan 7, 2016 at 4:26 PM, CRANFORD, CHRIS 
wrote:

> In the case of non-versioned domain models or cases where you aren't
> concerned with state collisions, the traditional lookup/render/lookup/merge
> workflow works quite well.
>
> The problem though comes into play when you are concerned about versioned
> models and more importantly, controlling state transition across concurrent
> modifications.  What I have seen developers do in the past is that they
> expose the @Version property to the form and have that value posted back
> along with the changed attributes during the save/update operation.  This
> approach works, but the security risk is you're exposing a critical piece
> of data that is subject to user manipulation to bypass optimistic locking.
>
> A better approach is to follow a similar paradigm that JSF uses called
> conversation scopes.  The struts2-conversation-plugin offers this kind of
> feature.
>
> The plugin basically allows you to expose a set of action properties to a
> named scope.  The plugin in combination with a few custom tags, allowed a
> form identifier to be placed as a hidden field in your form when you render
> your view.  When the view's changes are posted back to the save/update
> action, the plugin first takes the hidden field conversation id and looks
> up the state from the session that was saved when the conversation was
> started.  Any field flags to be included in the conversation will be
> rehydrated with the state it had when the prior action was executed.  The
> struts framework then can use it's normal property injection mechanism to
> set the appropriate state on the model.  Since the version of the domain
> model isn't being exposed to the client, there is no concern with a user
> hijacking the optimistic locking mechanism of your JPA provider to force
> changes  to occur when a collision should happen.
>
> A typical action might look like the following.  The annotations I show my
> now map exactly to the plugin as we use a modified proprietary version here
> but the gist remains the same.
>
> @ConversationSupport(conversation = "myconversion")
> public class SomeAction extends ActionSupport implements
> ModelDriven {
>
>   private Long id;
>   @ConversationField private DomainModel domainModel;
>   @ConversationField private ViewModel viewModel;
>
>   @BeginConversation(conversation = "myconversion")
>   public String renderView() {
> try {
>   this.domainModel = someService.find(id);
>   this.viewModel = new ViewModel(domainModel);
>   return SUCCESS;
> }
> catch(Exception ex) {
>   addActionError(getText(ERROR_UNEXPECTED_EXCEPTION));
>   return ERROR;
> }
>   }
>
>   @Conversation(conversation = "myconversion")
>   public String saveView() {
> try {
>   // copy values from this.viewModel to this.domainModel
>   someService.update(this.domainModel);
>   return SUCCESS;
> }
>catch(OptimisticLockException ex) {
>  // you could elect to find the domainModel again, update it and try
> to take
>  // the changes in domainModel + the changes from the user in viewModel
>  // and merge them then send the user back to the view again letting
> them
>  // know some fields were changed while they were making their changes.
>  // They can verify their changes again and resubmit.   I don't do
> this here
>  // but instead just tell the user the record was changed and they
> need to
>  // leave and come back in, but its up to you.
>  addActionError(getText(ERROR_RECORD_ALREADY_MODIFIED));
>  return INPUT;
>}
>catch(Exception ex) {
>  addActionError(getText(ERROR_UNEXPECTED_EXCEPTION));
>  return ERROR;
>}
>   }
>
>   /* other stuffs */
>
> }
>
>
>
> -Original Message-
> From: C N Davies [mailto:c...@xcogia.com]
> Sent: Wednesday, January 06, 2016 10:24 PM
> To: 'Christoph Nenning' ; 'Struts Users
> Mailing List' 
> Subject: RE: Editing a JPA entity
>
> Christoph I understand why this happens, I was simply asking if there was
> a better way to do this using some struts session magic or such. Seems
> there isn't so I'll just do it the old long winded way.
>
>
> -Original Message-
> From: Christoph Nenning [mailto:christoph.nenn...@lex-com.net]
> Sent: Tuesday, January 5, 2016 6:57 PM
> To: Struts Users Mailing List 
> Subject: Re: Editing a JPA entity
>
> > I'm using an action to retrieve a list of entities and render these as
> > a list, the user can then select an edit button that calls an 

Re: S2: How to tell if a response has been committed from an interceptor?

2016-01-06 Thread Ken McWilliams
Well you go down the chain create the result and then back up the chain.
So when going back up the response should already be committed.

see: https://struts.apache.org/docs/writing-interceptors.html

//modified code from above link to clarify
public String intercept(ActionInvocation invocation) throws Exception {
   //do stuff before response, going down the chain
   String result = invocation.invoke();
   //do stuff after response, going back up the chain, can't do what
you seem to be trying to do here...
   return result;
}

That aside, "Cannot create a session" isn't a good message because you
shouldn't be trying to create a session at all! It's part of the containers
responsibility to do that. You just ask for it. So the real cause of the
issue might be something else.

On Wed, Jan 6, 2016 at 11:41 AM, Greg Lindholm 
wrote:

> Inside an Interceptor I'm getting an exception
>
> java.lang.IllegalStateException: Cannot create a session after the response
> has been committed
> I have access to the ActionInvocation as this is passed into doIntercept()
> public String doIntercept(ActionInvocation invocation) throws Exception
>
> My question is: from the ActionInvocation how do I find out if the response
> has been committed?
>
> Can I get the HttpServletResponse? So I can call response.isCommitted() ?
>
> How?
>
> Thanks,
> Greg
>


Re: struts2.5 - Action class is not called

2015-11-16 Thread Ken McWilliams
I think you should be able to add a more precise definition ahead of the
wild card definition (one without a wildcard) and get the behaviour
expected.

On Mon, Nov 16, 2015 at 1:07 PM, Emi  wrote:

>
> using wild cards in action. If you don't want to switch between methods
>> dynamically,
>>
> Use switch methods dynamically.
>
> In action class:
>
> execute() as default
>
> method_name2()
> method_name3()..
>
>
> that is to call execute then you should remove the "*" from the name,
>> remove method
>> parameter, and then struts2 will assume execute should be called by
>> default.
>>
> Need to keep the wild cards setup in struts.xml.
>
> Is there a way, if no method names specified in jsp/tiles/struts, the
> default execute() method is called for Action Class please?
>
> If no such way, there will be too many places have to change /ActionName
> to "/executeActionName"...
>
> Do not have this issue for 2.3.x.
>
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: struts2.5 - Action class is not called

2015-11-16 Thread Ken McWilliams
Well you are using wild cards in the action name. If you don't want to
switch between methods dynamically, that is you _always_ want to call
execute then you should remove the "*" from the name, remove the method
parameter, and then struts2 will assume execute should be called by
default.

On Mon, Nov 16, 2015 at 12:33 PM, Emi  wrote:

>
> struts2.5:
>>
>> (2) index.jsp
>>  <%
>>   String context_path = request.getContextPath();
>>   response.sendRedirect(context_path +
>> "/Login/ProcessLoginAction.action");
>> %>
>>
>>
>> (3) struts.xml
>>
>>   > class="project.action.ProcessLoginAction">
>>  login_main_page
>>   
>>
> If written executeProcessLoginAction.action in jsp, the action class will
> be called.
>
> But wouldn't jsp automatically runs
> "/Login/executeProcessLoginAction.action".
>
> How to call execute() method as default if no method name specified?
>
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: TokenInterceptor locking HTTP session for entire action invocation?

2015-07-13 Thread Ken McWilliams
Could a Striped lock not be used? If done, machinery would need to be
introduced which would quickly go beyond s2's prerogative. For instance an
interceptor could have this magic locking service injected and then say:
For User X, is token Y in use? Or for any user is token Y in use? But then
this brings up user management, which is outside of S2 and then security
quickly follows...

So keeping is simple, S2 offers a reasonable solution but I think you could
develop a more narrow locking scheme that locks on the value of the token
stored in a Striped lock:
http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/util/concurrent/Striped.html




On Mon, Jul 13, 2015 at 5:26 AM, Lukasz Lenart lukaszlen...@apache.org
wrote:

 2015-07-10 20:37 GMT+02:00 rgm str...@rgm.nu:
  Using Struts 2.3.20.1.
 
  We have a long-running token-protected (for CSRF) action that can take up
  to about 30 seconds sometimes.  When this action is running on behalf of
  Alice, the List Users page for all other people on the system such as
  Bob and Charlie is hung, because the List Users page is trying to show
  whether or not Alice is logged in by accessing properties of her HTTP
  session.
 
  Is it necessary for TokenInterceptor to hold onto the session lock for
 the
  entire action invocation?

 It is. It's the only way to be sure that we do not have duplicated
 submits for the same token


 Regards
 --
 Łukasz
 + 48 606 323 122 http://www.lenart.org.pl/

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: OGNL making me nutty

2015-03-26 Thread Ken McWilliams
Is there a method in gov.usbr.mechdb.struts.GovernorAction class called
action which takes nothing and returns a String?

On Thu, Mar 26, 2015 at 5:05 PM, Ellson, Jared jell...@usbr.gov wrote:

 Hi All,

 I have a simple struts action class calling setters on a simple JPA object
 and for some reason the setters are not working and it is blowing up.  I am
 doing the exact same thing in other actions with in the same application
 and it is working fine.  What am I missing?

 *Struts.xml:*
 action name=governor class=gov.usbr.mechdb.struts.GovernorAction
 method
 =action
  result name=success/article.jsp/result
 /action

 *Error:*
 16:50:20,324 ERROR
 [com.opensymphony.xwork2.interceptor.ParametersInterceptor] (default
 task-55) Developer Notification (set struts.devMode to false to disable
 this message):

 Unexpected Exception caught setting 'selectedGovernor.pcase' on 'class
 gov.usbr.mechdb.struts.GovernorAction: Error setting expression
 'selectedGovernor.pcase' with value ['', '', ]

 16:50:20,327 ERROR
 [com.opensymphony.xwork2.interceptor.ParametersInterceptor] (default
 task-55) Developer Notification (set struts.devMode to false to disable
 this message):

 Unexpected Exception caught setting 'selectedGovernor.prvfull' on 'class
 gov.usbr.mechdb.struts.GovernorAction: Error setting expression
 'selectedGovernor.prvfull' with value ['', ]

 16:50:20,329 ERROR
 [com.opensymphony.xwork2.interceptor.ParametersInterceptor] (default
 task-55) Developer Notification (set struts.devMode to false to disable
 this message):

 Unexpected Exception caught setting 'selectedGovernor.tgate2' on 'class
 gov.usbr.mechdb.struts.GovernorAction: Error setting expression
 'selectedGovernor.tgate2' with value ['', ]

 16:50:20,336 WARN  [com.opensymphony.xwork2.util.LocalizedTextUtil]
 (default task-55) Missing key [invalid.fieldvalue.pcase] in bundles
 [[org/apache/struts2/struts-messages,
 com/opensymphony/xwork2/xwork-messages]]!

 16:50:20,336 WARN  [com.opensymphony.xwork2.util.LocalizedTextUtil]
 (default task-55) Missing key [invalid.fieldvalue.selectedGovernor.pcase]
 in bundles [[org/apache/struts2/struts-messages,
 com/opensymphony/xwork2/xwork-messages]]!

 16:50:20,339 ERROR [org.apache.struts2.dispatcher.Dispatcher] (default
 task-55) Could not find action or result

 /MechDB/governor.action: No result defined for action
 gov.usbr.mechdb.struts.GovernorAction and result input - action -

 vfs:/Users/jellson/devTools/jboss/jboss8/standalone/deployments/MechDBEAR.ear/MechDB.war/WEB-INF/classes/struts.xml:25:89

 at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(
 DefaultActionInvocation.java:371) [xwork-core-2.3.20.jar:2.3.20]

 I don't think the true error is what the stack is saying it is because it
 never makes it to my action.

 *Here is what it is trying to set:*

 private BigDecimal pcase;

 public void setPcase(BigDecimal pcase) {


 Thank you to anybody that can help...




 --

 Jared Ellson

 U.S. Bureau of Reclamation

 IT Specialist

 Office: 303-445-3354

 Cell: 303-916-0304

 jell...@usbr.gov



Re: Struts 2.3.15 and Tiles 3 Plugin

2015-01-14 Thread Ken McWilliams
The steps for integration from scratch is here(useful to understand what
the plugin is doing exactly):
http://stackoverflow.com/questions/13337938/how-to-integrate-struts-2-with-tiles-3
The steps assume maven.
Of further use regarding tiles3 integration this may also be useful:
http://stackoverflow.com/questions/16116142/how-to-integrate-struts-conventions-with-tiles-such-that-the-benefit-of-conventi


On Wed, Jan 14, 2015 at 10:23 AM, Kiran Badi ki...@poonam.org wrote:

 thanks Chris, Makes Sense.

 On Wed, Jan 14, 2015 at 5:43 AM, Christoph Nenning 
 christoph.nenn...@lex-com.net wrote:

   Hi Lukasz
  
   I downloaded complete struts 2.3.15 package which contains all jars and
   have put everything under app /web inf lib folder. Then I removed tiles
  2
   plugin jar. Is this not suppose to work
  
   But I do believe more of version mismatch but not sure which jar let me
   check again
  
 
 
  In such cases I setup a small maven project just to download the jars and
  copy them to my real project.
 
 
  Regards,
  Christoph
 
  This Email was scanned by Sophos Anti Virus
 



Re: Struts 2 support of Java 8

2014-12-11 Thread Ken McWilliams
@Paweł, I must admit I had a similar problem, but it was not one with
struts2. When deploying with Glassfish you have to use the latest version
4.1 or lambda expressions in services will cause it to fail. Considering
the 4.1 was very recently released this was a big pain.

On Thu, Dec 11, 2014 at 12:56 AM, Paweł Wielgus poulw...@gmail.com wrote:

 Maybe there is something like i have,
 some module is trying to locate classes that have lambdas in it
 and fails to do so.

 In my case i can't have lambdas in Action classes
 but everywhere else is ok.

 --
 Pozdrawiam,
 Paweł Wielgus.
 tel: +48 604 603 546


 2014-12-11 3:07 GMT+01:00 Greg Lindholm greg.lindh...@gmail.com:
  I'm using Java 8 with Struts 2 and have had no issues.
 
  On Wed, Dec 10, 2014 at 1:00 PM, Schlachter, Gary 
  gary.schlach...@sensus.com wrote:
 
  Yes, it is a Spring 3.1.
 
  -Original Message-
  From: Dave Newton [mailto:davelnew...@gmail.com]
  Sent: Wednesday, December 10, 2014 12:58 PM
  To: Struts Users Mailing List
  Subject: Re: Struts 2 support of Java 8
 
  Are you using Spring?
 
  This looks like the JavaBeans naming convention wasn't followed.
 
  On Wed, Dec 10, 2014 at 12:51 PM, Schlachter, Gary 
  gary.schlach...@sensus.com wrote:
 
   That is what I was looking for.I upgraded Java 7 to 8 on my
  previously
   working Spring/Struts/Tomcat application and ran into the following
   exception:
  
   Unable to instantiate Action, com.sms.web.site.IndexAction,  defined
   for 'Index' in namespace '/'Failed to obtain BeanInfo for class
   [com.sms.web.site.IndexAction]; nested exception is
   java.beans.IntrospectionException: type mismatch between read and
   write methods
  
   I was checking to see if there were any known issues and/or basic
   failures before I spent time digging deeper.
  
   Thanks,
   Gary
  
   -Original Message-
   From: Lukasz Lenart [mailto:lukaszlen...@apache.org]
   Sent: Wednesday, December 10, 2014 12:44 PM
   To: Struts Users Mailing List
   Subject: Re: Struts 2 support of Java 8
  
   2014-12-10 18:37 GMT+01:00 Schlachter, Gary 
 gary.schlach...@sensus.com
  :
I have spent time searching and could not find a definitely answer
on
   whether or not Struts 2.3 support Java 8.  In what version of Struts
   is Java 8 supported?
  
   What you mean by supported?
  
   There are few issues that directly target JDK8 but S2 should work on
   Java8 without problems
  
   https://issues.apache.org/jira/browse/WW-4402
   https://issues.apache.org/jira/browse/WW-4403
  
  
   Regards
   --
   Łukasz
   + 48 606 323 122 http://www.lenart.org.pl/
  
   -
   To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
   For additional commands, e-mail: user-h...@struts.apache.org
  
  
 
 
  --
  e: davelnew...@gmail.com
  m: 908-380-8699
  s: davelnewton_skype
  t: @dave_newton https://twitter.com/dave_newton
  b: Bucky Bits http://buckybits.blogspot.com/
  g: davelnewton https://github.com/davelnewton
  so: Dave Newton http://stackoverflow.com/users/438992/dave-newton
 

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Struts 2 support of Java 8

2014-12-10 Thread Ken McWilliams
I'm using struts2 with Java 8 without issues. It will be awhile before
struts2 will *require* Java 8, being a popular framework in the business
world, accessibility is highly valued.

On Wed, Dec 10, 2014 at 10:43 AM, Lukasz Lenart lukaszlen...@apache.org
wrote:

 2014-12-10 18:37 GMT+01:00 Schlachter, Gary gary.schlach...@sensus.com:
  I have spent time searching and could not find a definitely answer on
 whether or not Struts 2.3 support Java 8.  In what version of Struts is
 Java 8 supported?

 What you mean by supported?

 There are few issues that directly target JDK8 but S2 should work on
 Java8 without problems

 https://issues.apache.org/jira/browse/WW-4402
 https://issues.apache.org/jira/browse/WW-4403


 Regards
 --
 Łukasz
 + 48 606 323 122 http://www.lenart.org.pl/

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Upgrading from Struts 2.0 to 2.3.16

2014-07-16 Thread Ken McWilliams
I'd be of the mind that during the upgrade that some how the resource:
'/mmr/jsp/templates/layout_
admin_window.jsp' and other folders were somehow moved and that
org.apache.tiles.
TilesException: ServletException including path is perfectly accurate.
Generally you don't want templates to be exposed and the include path
should start with /WEB-INF/...

If in doubt about dependencies follow one of the several struts2-tiles
integration threads using maven. I'm assuming you are not using maven. Then
copy the required dependencies into your project.

On Tue, Jul 15, 2014 at 11:42 PM, Sreekanth S. Nair 
sreekanth.n...@egovernments.org wrote:

  Caused by: java.lang.NoSuchMethodError:
  org.apache.tiles.jsp.taglib.InsertAttributeTag.doFinally()
 

 Must be tiles not compatible

 --
 Thanks  Regards

 Sreekanth S Nair
 Java Developer
 ---
 eGovernments Foundation http://www.egovernments.org
 Ph : 9980078913
 ---
 http://in.linkedin.com/pub/sreekanth-s-nair/b/946/5a0/
 https://github.com/sreekanthsnair   sreekanthsn...@hotmail.co.uk
 sreekanths...@gmail.com
 ---



Re: Hello World does not work.

2014-07-05 Thread Ken McWilliams
What IDE are you using? Knowing the IDE someone might be willing to give
click by click instructions.


On Sat, Jul 5, 2014 at 7:23 AM, Jim Anderon jim_ander...@jjajava.com
wrote:


 index.jsp is in my hello_world.war file and hello_world.war is at
 /var/lib/tomcat6/webapps/hello_world/hello_world.war.

 I have used the web.xml file, unchanged, from the tutorial area. Here is
 the content, where the line numbers are
 inserted by my editor and are not part of the file:


   1 ?xml version=1.0 encoding=UTF-8?
   2 web-app id=WebApp_ID version=2.4 xmlns=http://java.sun.com/
 xml/ns/j2ee xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
   3 display-nameHello World Struts 2/display-name
   4 welcome-file-list
   5 welcome-fileindex.jsp/welcome-file
   6 /welcome-file-list
   7
   8
   9 filter
  10 filter-namestruts2/filter-name
  11 filter-classorg.apache.struts2.dispatcher.ng.filter.
 StrutsPrepareAndExecuteFilter/filter-class
  12 /filter
  13
  14 filter-mapping
  15 filter-namestruts2/filter-name
  16 url-pattern/*/url-pattern
  17 /filter-mapping
  18
  19 /web-app

 I can see there is some struts filtering, but at this point I do not know
 if something needs to be changed.


 Jim A.




 On 07/05/2014 10:08 AM, jayachandra B wrote:

 do you have index.jsp in your webContent folder and did you configure
 struts2 filter in web.xml?


 On Sat, Jul 5, 2014 at 5:33 PM, Jim Anderon jim_ander...@jjajava.com
 mailto:jim_ander...@jjajava.com wrote:


 Hello All,

 I am an experienced programmer, but inexperienced in web
 programming and a total newbie to struts.
 Struts looks like it will be very useful to my web programming so
 I have ventured into the tutorials to
 start learning how to use it. I ran the first tutorial
 'basic_struts' successfully. Next, I am trying to
 run the 'Hello World' tutorial, but it is failing. I could use
 some suggestions on what may be wrong and
 some suggestions on debug methodology when using struts. Or at
 least pointers on where to looking
 for debugging techniques.  I am trying to do some reading to teach
 myself, but I'm floundering at this
 point.

 I'm running crunchbang Linux, using firefox 30.0, which is close
 to the latest edition. By the way, I'm
 aware of the firefox 'web console' but a beginner with that tool
 so I have not taken advantage of it so far.
 I'm running the tomcat6 server on my localhost.

 I have read the tutorial for 'Hello World' from:

 *
 *file:///usr/share/struts/struts-2.3.16.3/docs/hello-
 world-using-struts-2.html

 I have read each step in that tutorial and verified that the
 source code explained in the tutorial
 is in my sand box. I ran 'mvn clean project' and got a successful
 build. Then then copied the
 hello_world.war file to:

 * * /var/lib/tomcat6/webapps/hello_world
 *
 *enter the URL:

 http://localhost:8080/hello_world/index.action

 in the address box on Firefox and got the following error from tomcat:


 Start Error
 Window--
 
 ---

 HTTP Status 404 - /hello_world/index.action
 
 
 *type* Status report
 *message* _/hello_world/index.action_
 *description* _The requested resource (/hello_world/index.action)
 is not available._
 
 
 Apache Tomcat/6.0.35

 ---End Error Window
 
 
 --


 My other webapps run ok out of /var/lib/tomcat6/webapps, so I at
 least know my environment is set up
 correctly, at least for the most part. When I check directory
 permissions from the /var/lib/tomcat6/webapps/hello_world
 directory, I get:

 % ls -ld . *
 drwxr-xr-x 2 jimA jimA4096 Jul  2 09:15 .
 -rw-r--r-- 1 jimA jimA 3991999 Jul  4 15:29 hello_world.war

 I thought about attaching the hello_world.war file, but because it
 is 4M-bytes, I decided not to. If someone would like
 to see it, I can provide it or a portion of it.

 I feel like there is an obvious error in my set up, but I cannot
 see it. Can anyone offer some suggestions?

 Regards,
 Jim Anderson










 --
 Thanks and Regards
 Jayachandra





Re: Struts2 namespace confusion

2014-05-24 Thread Ken McWilliams
What he explains is likely the result of a search action also mapped in the
default namespace.
On 2014-05-24 9:35 AM, John Patrick nhoj.patr...@gmail.com wrote:

 Not seen this happen myself, what strut

 Not seen this happen myself, what struts jar's do you have as it might be
 something like the convention plugin...

 If your using maven then it might be useful for others to include what
 specific maven dependencies your including so potentially someone else can
 try using the exact same jars.

 John



 On 24 May 2014 15:28, Matt Williams mattwms1998...@yahoo.com wrote:

  Hello,
  I have been using struts 2.1.8 for a while and last night noticed an
 issue
  with mapping actions working with any url.
 
  For instance in the struts.xml file:
  - I have a package with a namespace of /employee.
  - Within the package, I have an action mapping search
  - The webapp name is TestWeb.
 
  So to access this page, I can go to:
  http://localhost:8080/TestWeb/employee/search.action and this works.
  However, if anything is added to the URL after the namespace such as:
  http://localhost:8080/TestWeb/employee/someExtraText/search.action the
  page still loads.
 
  Why does this happen?
 
 
  Reading the struts documentation
  (
 http://struts.apache.org/release/2.1.x/docs/namespace-configuration.html)
  would make me assume that it should search the /employee/someExtraText
  namespace...not find it, so then it should fall back to the default 
  namespace...not find it...then display no action mapping found.
 
 
  Any insight? Thanks!
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 



OT: Architectural Semantics: Model View Presenter

2014-04-08 Thread Ken McWilliams
Marked as OT because this more of a conceptual issue and has to do with
talking to .NET developers regarding framework difference than with
framework use.

I'm trying to wrap my head around the Model View Pattern (MVP) pattern. My
issue is that I can't really differentiate it from what I do in Struts2.
But in no documentation is there any claim that Struts2 follows MVP. Also
it seems to be a term that only shows up mainly in Microsoft circles, is it
a sort of branding?

Given the Wikipedia article:
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter

There is a picture at the top of the wiki article that shows the following:


Model Business Objects = Presenter Contains the logic for application =
View UI Components Has no notion of the model.


This looks a lot like, the pattern most of us take for Struts2, where the
middle part, the presenter, is replaced by the Struts2 action.

The main difference is that this is less of an abstraction than found in
most JEE applications, as the chain is typically: Data tier objects =
service tier objects = struts2 action = view.

I'm supposing that this extra level, isn't required for the MVP pattern and
so omitted to focus on the pattern and not perhaps would be done in best
practice.

So is then is Struts2 following MVP (in most cases)? I've read that wiki
article twice and still don't see a difference. Any light on the matter
would be most welcome.

On the other hand if there isn't a difference, we should add Struts2 to the
list of MVP frameworks at the bottom!

Regards,
Ken


Re: Struts 2: Howto render output as HTML?

2014-03-02 Thread Ken McWilliams
If you want this behaviour for the whole application then set
struts.ui.theme to simple, inside struts.xml. Like so:

struts
   constant name=struts.ui.theme value=simple /
/struts

Since you mentioned a single page, you can do that too, you can even have a
single struts2 UI tag render under a different theme, these various options
are listed here:
http://struts.apache.org/release/2.3.x/docs/selecting-themes.html




On Sun, Mar 2, 2014 at 2:08 PM, Fredrik Andersson fredan...@hotmail.comwrote:




 Hello guys!
 I use struts 2.3.15.3.
 I have created a form with code like:
 s:form action=productsave
   s:hidden name=A_HIDDEN value=%{formToken} /
   s:textfield
 name=A_TEXT label=Email address labelposition=top maxlength=128
 size=40 /...
 I would like the output to be rendered as HTML and not XHTML.
 I found this tag for struts 1.x:
 http://struts.apache.org/development/1.x/struts-taglib/tlddoc/index.html
 Is there some tag in struts 2 that does the same?
 Best regardsFredrik



Re: REST question

2014-02-11 Thread Ken McWilliams
Sounds like you have used the Open Session in View method... probably
provided by a custom interceptor, when adding the rest plugin you have
changed your action to the rest package and forgot to put your interceptor
back in place, so now you don't have a hibernate session and the view
generates this error.


On Mon, Feb 10, 2014 at 10:40 PM, Miguel miguel...@gmail.com wrote:

 Hi,

 A strange situation happens when I load *struts2-rest-plugin-2.3.16.jar*
 With out the REST plugin my action and jsp's works as always has worked.
 But with the mere inclusion of the REST Plugin, some jsp's stops finding
 variables, because the variable name changes.
 Here is the snippet:

 struts.xml

 constant name=struts.objectFactory
 value=org.apache.struts2.spring.StrutsSpringObjectFactory /
 constant name=struts.objectFactory.spring.autoWire value=name /
 package name=proyectox extends=json-default 
 !-- Si no le pones este stack, pues no funciona...--
 interceptors
 interceptor name=strutsSpring

 class=com.proyectox.ui.interceptor.HibernateOpenSessionInViewInterceptor/
 interceptor name=viewuseragentselector
 class=com.proyectox.ui.interceptor.UserAgentResultInterceptor/
 interceptor-stack name=strutsSpringPPPStack
 interceptor-ref name=strutsSpring/
 interceptor-ref name=paramsPrepareParamsStack/
 interceptor-ref name=viewuseragentselector/
 /interceptor-stack
 /interceptors
 ...
 /package

 package name=cfdi extends=proyectox namespace=/cfdi
 action name=header_* class=com.fcm.cfdi.ui.HeaderAction
 result type=redirectAction
 param name=actionNameedit/param
 /result
 !--result printHeader.jsp/result--
 result name=inputheaderEdit.jsp/result
 result name=error/facturaerror.jsp/result
 interceptor-ref name=scope
 param name=sessioncontribuyente/param
 param name=autoCreateSessiontrue/param
 param name=keycontribuyenteActual/param
 /interceptor-ref
 interceptor-ref name=scope
 param name=sessionfactura/param
 param name=autoCreateSessionfalse/param
 param name=keycfdi/param
 /interceptor-ref
 interceptor-ref name=strutsSpringPPPStack/
 /action



 HeaderAction.java:

 public class HeaderAction extends ActionSupport implements Preparable {
 protected Contribuyente contribuyente;
 protected Long contribuyenteId;

 public void prepare() throws Exception {
 ...
 }


 public String input(){

 dirReceptorId = factura.getDomicilioReceptor().getId();
 dirEmisionId  = factura.getDomicilioEmision().getId();
 return INPUT;
 }
 ...
 public Contribuyente getContribuyente() {
 return contribuyente;
 }

 public void setContribuyente(Contribuyente contribuyente) {
 this.contribuyente = contribuyente;
 }
 ...
 }

 edit.jsp:
 ...
 s:select label=Direccion Emision
name=dirEmisionId
list=*contribuyente*.domicilios
listKey=id
listValue=nombre
multiple=false
size=1
required=true
key=factura.direccionEmision.id
 /
 ...

 After loading *struts2-rest-plugin-2.3.16.jar* it starts giving the
 following exception:
 Caused by: org.hibernate.LazyInitializationException: failed to lazily
 initialize a collection of role: *contribuyentes.domicilios*, no session or
 session was closed
 ...

 I know that's a Hibernate exception, but the jsp works fine without the
 REST Plugin.
 It's like the REST Plugin appends that extra s after the variable name in
 the .jsp or the value stack changes or something like that.

 The action is invoked without error in either case, and has into it's
 fields the required values.


 Does anyone has any pointer of what can be happening?

 Thanks

 Si quieres ser más positivo, pierde un electrón
 Miguel Ruiz Velasco Sobrino



Re: S2 how to determine if a session exists from an Interceptor

2014-02-06 Thread Ken McWilliams
The OP has abstracted away most of the details, he is working with
MapString, Object! The session is not generally struts2s responsibility
it, generally it is maintained by the web container. Tomcat/Glassfish, etc.
And generally you would consider it in such an environment to always exist.
What kind of container are you deploying your application in? I recall
there being an interceptor that will attempt to create a session for light
weight containers, however if struts needs to create such a session object
it is doubtful that the container will be able to use it in a meaningful
way.


On Thu, Feb 6, 2014 at 9:58 AM, Maurizio Cucchiara mcucchi...@apache.orgwrote:

 Hi Greg,
 I seem to recall that this is not the best way to handle the session and
 generally speaking, it always better to abstract as much as possible http's
 details

 I could be wrong, but It would be better if your action implements a
 specific interface (SessionAware or HttpSessionAware)

 Twitter :http://www.twitter.com/m_cucchiara
 G+  :https://plus.google.com/107903711540963855921
 Linkedin:http://www.linkedin.com/in/mauriziocucchiara
 VisualizeMe: http://vizualize.me/maurizio.cucchiara?r=maurizio.cucchiara

 Maurizio Cucchiara


 On 6 February 2014 14:14, Greg Lindholm greg.lindh...@gmail.com wrote:

  I have an Interceptor that wants to put something in the session after
 the
  action has executed.
 
  But if the session doesn't already exist I get an exception:
 
  java.lang.IllegalStateException: Cannot create a session after the
 response
  has been committed
  How can I determine if the session already exists from within an
  Interceptor?
 
   public String doIntercept(ActionInvocation invocation) throws Exception
   {
 String result = invocation.invoke();
 MapString, Object session =
  invocation.getInvocationContext().getSession();
 session.put(key, value); // throws exception if session doesn't exist
 return result;
   }
 
  Thanks
  Greg
 



Re: Struts + Spring

2014-01-25 Thread Ken McWilliams
Could you please explain further what it is you are trying to do. Struts2
does things differently, if you are open to change there is probably a nice
way to resolve your issue. If we know a bit more... I'm certain we could
supply a much better answer than telling you to use the chain result
type... although I think that is what you are searching for, in the long
run (or possibly the short term) I have the feeling you're working towards
spaghetti actions.


On Thu, Jan 23, 2014 at 2:23 PM, vvc rhyken.t...@gmail.com wrote:

 Hi all,

 I'm working on an struts2+Spring application where the action could call
 any of the two sub-app flow, which wil eventually have seperate URL
 domains. Is it possible to mask the URL as we do InsideRedirect in Struts1.

 Thanks,
 Venkat



Re: Tiles with Annotations

2014-01-02 Thread Ken McWilliams
I arrived at the same conclusion when trying to remove my tiles
configuration. I upgraded to tiles 3 in the process and wrote a custom
result handler (sorry a custom unknown result handler). It is invoked
when conventions isn't able to find an appropriate result.

 Here is a stack overflow Q  A which covers that process: How to
Integrate Struts Conventions with Tiles such that the benefit of
conventions is maintained http://stackoverflow.com/q/16116142/514065



On Thu, Jan 2, 2014 at 9:16 AM, Paul Benedict pbened...@apache.org wrote:

 Annotations usually help augment the class being annotated. I don't think
 annotating a Struts action with Tile definitions is very appropriate for
 this purpose. The purposes are just very different. XML seems more
 appropriate than annotations here.




 On Thu, Jan 2, 2014 at 10:02 AM, Christoph Nenning 
 christoph.nenn...@lex-com.net wrote:

  Dear List,
 
 
  in our applications we often use the convention-plugin together with
  tiles-plugin (tiles 2).
 
  convention-plugin has the advantage that it is not necessary to put an
  entry in struts.xml for each action. So struts.xml usually is very small.
  But we still have tiles.xml which needs an entry for each action. In big
  applications that file becomes huge and hard to maintain.
 
  To fix that I created a bunch of Annotations and a struts2 result to be
  able to create tile defs with annotations.
 
 
  It would take me some time to turn that into a proper framework patch.
 
  Now my question is: Do you like that stuff?
 
 
 
  Sample application code:
 
 
  
  tiles.xml
  
  tiles-definitions
  definition name=.default-layout template=
  /WEB-INF/tiles/layout/layout.jsp
  put-attribute name=titleMsgKey value=.titleMsgKey /
  put-attribute name=content value=.content /
  /definition
 
  !-- no more entries ! --
  !-- except you have several layouts --
  /tiles-definitions
 
 
  
  SampleAction
  
  @Result(name=SampleAction.INPUT, type=tiles-annotation)
  @TileDef(
  extend=.default-layout,
  attributes={
  @TileAttribute(name=titleMsgKey,
 value=text.key.test),
  @TileAttribute(name=content, value=
  /WEB-INF/tiles/test/test.jsp)
  }
  )
  public class SampleAction extends ActionSupport {
  ...
  }
 
 
  
  web.xml
  
 
  !-- a parameter for TilesListener is required which I wrapped in
  a specialized context listener --
  !-- that parameter is:
  param-name
  org.apache.tiles.factory.TilesContainerFactory.MUTABLE/param-name
  param-valuetrue/param-value
  --
  listener
  listener-class
   org.apache.struts2.tiles.StrutsTilesAnnotationsListener
  /listener-class
  init-param
  param-name
  org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG/param-name
  param-value/WEB-INF/classes/tiles.xml/
  param-value
  /init-param
  /listener
 
 
 
  regards,
  Christoph
 
  This Email was scanned by Sophos Anti Virus
 



 --
 Cheers,
 Paul



Re: In which action, do i write boolean tests ( SGBD or LDAP )

2013-12-13 Thread Ken McWilliams
Write an interceptor then apply it to the actions, assuming that the rules
for what to access can be encoded in the url. If not it then probably
belongs in the service tier.


On Thu, Dec 12, 2013 at 3:01 AM, Chris christal...@yahoo.fr wrote:

 Hello,

 How to organize the actions, when you just want check the password and the
 user, on a LDAP or SGBD system . For a  boolean response only. ( authorised
 / or not )
 You do write all the command in the only same action , don't you ?


Re: Struts Validation

2013-12-13 Thread Ken McWilliams
Have the action extend ActionSupport and have the class implement its own:
public validate(void).

Look at the code of ActionSupport (or JavaDoc) for how to set error
messages, if an error is set, after validate() executes, Struts2 will
assume an error has occurred and the action will return input.

This can be used in conjunction with the xml. Sometimes code just makes
more sense.


On Fri, Dec 13, 2013 at 6:13 AM, Vibhuti Pithwa vibhutipit...@gmail.comwrote:

 Hello,
I had successfully written a conditional visitor validator for a
 ListEmployee in a
 validation.xml for a list of Object say Employee. Then I wrote a
 validation.xml of the
 type Employee-validation.xml where i wrote the validation to be done for
 say First
 Name , Last Name. Now the validations in Employee-validation.xml are
 executed as many times as there are objects the list ListEmployees.
 Now i have a Map of objects and i tried to write similar thing for it but
 it does not
 work. Has anyone tried doing such for a Map and can explain me an approach
 to do
 it.? This is appearing way out of my reach as we need optimised code that
 can
 iterate over the map and do validation instead of writing hard coded
 validation.Need
 some help.

 Thanks,
 Vibhuti Pithwa



Re: Passing jsp tag attribute to Struts 2 tags

2013-10-21 Thread Ken McWilliams
Untested, and I didn't check the docs... but your expression in attribute
key of the following would require double evaluation. This is because an
attribute is a simple String or an OGNL expression. Your value in key
requires that concatenation occur after evaluation...

s:label key=form.label.%{name} cssClass=ym-required /

In stead an expression of the form: %{form.label. + name}, would be
better. Although there is still the issue of _name_ being in scope, maybe
you will need an  #attr. prefix...


On Sat, Oct 19, 2013 at 6:09 PM, Martin Gainty mgai...@hotmail.com wrote:

 //only if component-name and its URL is placed into a HashMap and that
 HashMap is set into the bean

 //here is the chronology:


 //straightforward HashMap which contains component name and the component

 private java.util.MapString, Object dynamicAttrs = new
 java.util.HashMapString, Object();



 //In this case we are setting data-remote and data-label components into
 dynamicAttrs HashMap

 dynamicAttrs.put(data-remote, data-remote_);
 dynamicAttrs.put(data-label, data-label_);


 //to tell the bean which Attributes will be set dynamically

 org.apache.struts2.components.UIBean bean;

 bean.setDynamicAttributes(dynamicAttrs);



 //the dynamicAttributes functionality is in struts2-javatemplates-plugin so

 //when you building struts make sure you add struts2-javatemplates-plugin
 dependency as seen here

 dependency
 groupIdorg.apache.struts/groupId
 artifactIdstruts2-javatemplates-plugin/artifactId
 version${project.version}/version
 /dependency


 did you set your component-name and URL into dynamicAttrs
 setDynamicAttributes of the bean you wish to access?



 HTH,
 Martin
 __
 Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
 Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
 Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
 dient lediglich dem Austausch von Informationen und entfaltet keine
 rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
 E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.

 Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
 destinataire prévu, nous te demandons avec bonté que pour satisfaire
 informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
 de ceci est interdite. Ce message sert à l'information seulement et n'aura
 pas n'importe quel effet légalement obligatoire. Étant donné que les email
 peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
 aucune responsabilité pour le contenu fourni.




  Date: Sat, 19 Oct 2013 05:15:16 -0700
  From: afatt...@yahoo.com
  Subject: Re: Passing jsp tag attribute to Struts 2 tags
  To: user@struts.apache.org
 
  Actually I am not calling any action class getKeyLable
 
  I try to:
  1- Make the s:label tag get a dynamic (Is it poosibel ?!)
  2- The above dynamic value must be read from jsp tag ( The s:label is
 used in a tag itself)
 
  ~Regards,
  ~~Alireza Fattahi
 
 
 
  On Saturday, 19 October 2013, 15:35, Martin Gainty mgai...@hotmail.com
 wrote:
 
  * In this example, a label is rendered. The label is retrieved from a
 ResourceBundle via the key attribute
  * giving you an output of 'User Name: Ford.Prefect'. Assuming that i18n
 message userName corresponds
  * to 'User Name' and the action's getUserName() method returns
 'Ford.Prefect'p/
  * !-- END SNIPPET: exdescription --
  * pre
  * !-- START SNIPPET: example --
  * s:label key=userName /
  * !-- END SNIPPET: example --
  * /pre
  * pre
  * !-- START SNIPPET: example2 --
  * s:label name=userName label=User Name /
  * !-- END SNIPPET: example --
  * /pre
 
 
  what is returned by your Action Class getLabelKey Method
 
 
  Martin
  __
  Verzicht und Vertraulichkeitanmung
 
  Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
 Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
 Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
 dient lediglich dem Austausch von Informationen und entfaltet keine
 rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
 E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
 
 
 
 
 
   Date: Sat, 19 Oct 2013 04:23:55 -0700
   From: afatt...@yahoo.com
   Subject: Passing jsp tag attribute to Struts 2 tags
   To: user@struts.apache.org
  
  
   Hi,
  
   I am creating a new tag in jsp, named `RequiredLabel` , but I can not
 pass tag attribute to struts label ( The css are based on YAML)
  
   The tag will be used as:
  myTag:RequiredLabel name=amount/
  
   The label should be get from struts as it must be localized.
  %@tag description=Renders a label with required css and error
 label 

Re: Re: Re: Url rewriting of .action to .jsp

2013-10-10 Thread Ken McWilliams
Sorry that was confusing. A new ModelDriven Interface would be better.

ModelFacing? from an Implementation perspective:
- push the Model object to the top of the stack such that members can be
set directly (same as model driven)
- register a pre-result listener, which will revert the action class to
being at the top of the stack.


ModelBacking?
- Leave the model as is
- Register a pre-result listener, which will push the object specified in
ModelBacking to the top of the value stack.

Since the later functionality is readily achieved using s:push there is
not much need for the second. But someone recently was talking about
managing legacy views
 and this sort of decoupling might have minor use in that case. It could
also have use with Struts results which expect a certain object, but then
using the appropriate interface directly on the action is more obvious.
Another possible use is for security. Certain results can serialize the
action, a decoupling here could be useful (on action uses the same class
for a JSP view, an XML producing result and a JSON producing result). In
this case having the opportunity to create an object against which the view
will only have access could make what people are supposed to have access to
clearer and allow the serializers to cleanly operate over the whole object
rather than having to use there APIs to prune parts of the tree.

Hope this is clearer. I don't know if it is just me. I like the idea of
ModelDriven but find that having the same model for the front and the back
too restrictive. After all the general flow in most actions is: Get data,
execute business logic, marshal data for view, possibly some processing of
view data...

How often do we want to send the same type of object back to the view we
just received?  Not that often.


On Mon, Sep 30, 2013 at 2:26 AM, Lukasz Lenart lukaszlen...@apache.orgwrote:

 @Ken I'm bit lost with your mails, right now I don't know what you
 want - new Model interfaces or current ModelDriven approach is valid?
 Maybe start a new discussion?


 Regards
 --
 Łukasz
 + 48 606 323 122 http://www.lenart.org.pl/

 2013/9/26 Ken McWilliams ken.mcwilli...@gmail.com:
  ...more often than not, NOT what I want (wrt: Maybe it's just me but for
  some reason this is more often than not what I want (I want the model
  towards the request but not towards the view), so I need to forgo
  ModelDriven.). Sorry everyone!
 
 
  On Wed, Sep 25, 2013 at 7:39 PM, Ken McWilliams 
 ken.mcwilli...@gmail.comwrote:
 
  Sorry should have read the last couple lines before posting! It was in
  defense of ModelBacking suggesting that the congruent structure could
 allow
  us to publish the action into the stack and then handle it knowing the
  interface. A certain result type for instance could require a specific
  backing model to even handle the request (could include it in the plugin
  for that request, as a way to clearly make you satisfy it's
 requirements).
 
  Seems to be in the actions scope. Get data, validate data, invoke
 business
  logic, marshal data for view (massage data for view if required). If
 would
  fall under the latter.
 
 
  On Wed, Sep 25, 2013 at 7:32 PM, Ken McWilliams 
 ken.mcwilli...@gmail.comwrote:
 
  Not sure if this is the place to bring this up, this is an annoyance
  coming from ModelDriven may offer a solution...
 
  Issue: It's hard to get past the model if you want to add more
 attributes
  to the action. Also when using ModelDriven the same view of the action
 is
  applied from the HTTP side as the views side. Maybe it's just me but
 for
  some reason this is more often than not what I want (I want the model
  towards the request but not towards the view), so I need to forgo
  ModelDriven.
 
  What I though might be interesting is a ModelFacing? and
  ModelBacking? interfaces.
 
  ModelFacing provides the same functionality as ModelDriven but only
  towards the request. Any other methods defined in the action are not
  accessible. ModelBacking isn't so interesting, same effect could be
  achieved using s:push tag I suppose, so the later isn't needed so
 much. But
  it wouldn't to have the later because should we want to expose an
 interface
  via OGNL we could say some component provides X interface and it would
 be
  available from the value stack that way without needing a view. It's
 pretty
  obvious how conventions could determine the white listed methods from
 this.
 
 
  On Tue, Sep 24, 2013 at 3:21 AM, Lukasz Lenart 
 lukaszlen...@apache.orgwrote:
 
  2013/9/24 Christoph Nenning christoph.nenn...@lex-com.net:
But still: method:add works while !add does not.
  
   If you could prepare a small demo app, I'd like investigate that.
  
  
  
   I can do so next week, sorry for the delay
 
  No problem, I'm busy too ;-)
 
 
  Regards
  --
  Łukasz
  + 48 606 323 122 http://www.lenart.org.pl/
 
  -
  To unsubscribe, e-mail: user-unsubscr

Re: Re: Re: Url rewriting of .action to .jsp

2013-09-25 Thread Ken McWilliams
Sorry should have read the last couple lines before posting! It was in
defense of ModelBacking suggesting that the congruent structure could allow
us to publish the action into the stack and then handle it knowing the
interface. A certain result type for instance could require a specific
backing model to even handle the request (could include it in the plugin
for that request, as a way to clearly make you satisfy it's requirements).

Seems to be in the actions scope. Get data, validate data, invoke business
logic, marshal data for view (massage data for view if required). If would
fall under the latter.


On Wed, Sep 25, 2013 at 7:32 PM, Ken McWilliams ken.mcwilli...@gmail.comwrote:

 Not sure if this is the place to bring this up, this is an annoyance
 coming from ModelDriven may offer a solution...

 Issue: It's hard to get past the model if you want to add more attributes
 to the action. Also when using ModelDriven the same view of the action is
 applied from the HTTP side as the views side. Maybe it's just me but for
 some reason this is more often than not what I want (I want the model
 towards the request but not towards the view), so I need to forgo
 ModelDriven.

 What I though might be interesting is a ModelFacing? and ModelBacking?
 interfaces.

 ModelFacing provides the same functionality as ModelDriven but only
 towards the request. Any other methods defined in the action are not
 accessible. ModelBacking isn't so interesting, same effect could be
 achieved using s:push tag I suppose, so the later isn't needed so much. But
 it wouldn't to have the later because should we want to expose an interface
 via OGNL we could say some component provides X interface and it would be
 available from the value stack that way without needing a view. It's pretty
 obvious how conventions could determine the white listed methods from this.


 On Tue, Sep 24, 2013 at 3:21 AM, Lukasz Lenart lukaszlen...@apache.orgwrote:

 2013/9/24 Christoph Nenning christoph.nenn...@lex-com.net:
   But still: method:add works while !add does not.
 
  If you could prepare a small demo app, I'd like investigate that.
 
 
 
  I can do so next week, sorry for the delay

 No problem, I'm busy too ;-)


 Regards
 --
 Łukasz
 + 48 606 323 122 http://www.lenart.org.pl/

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org





Re: Re: Re: Url rewriting of .action to .jsp

2013-09-25 Thread Ken McWilliams
...more often than not, NOT what I want (wrt: Maybe it's just me but for
some reason this is more often than not what I want (I want the model
towards the request but not towards the view), so I need to forgo
ModelDriven.). Sorry everyone!


On Wed, Sep 25, 2013 at 7:39 PM, Ken McWilliams ken.mcwilli...@gmail.comwrote:

 Sorry should have read the last couple lines before posting! It was in
 defense of ModelBacking suggesting that the congruent structure could allow
 us to publish the action into the stack and then handle it knowing the
 interface. A certain result type for instance could require a specific
 backing model to even handle the request (could include it in the plugin
 for that request, as a way to clearly make you satisfy it's requirements).

 Seems to be in the actions scope. Get data, validate data, invoke business
 logic, marshal data for view (massage data for view if required). If would
 fall under the latter.


 On Wed, Sep 25, 2013 at 7:32 PM, Ken McWilliams 
 ken.mcwilli...@gmail.comwrote:

 Not sure if this is the place to bring this up, this is an annoyance
 coming from ModelDriven may offer a solution...

 Issue: It's hard to get past the model if you want to add more attributes
 to the action. Also when using ModelDriven the same view of the action is
 applied from the HTTP side as the views side. Maybe it's just me but for
 some reason this is more often than not what I want (I want the model
 towards the request but not towards the view), so I need to forgo
 ModelDriven.

 What I though might be interesting is a ModelFacing? and
 ModelBacking? interfaces.

 ModelFacing provides the same functionality as ModelDriven but only
 towards the request. Any other methods defined in the action are not
 accessible. ModelBacking isn't so interesting, same effect could be
 achieved using s:push tag I suppose, so the later isn't needed so much. But
 it wouldn't to have the later because should we want to expose an interface
 via OGNL we could say some component provides X interface and it would be
 available from the value stack that way without needing a view. It's pretty
 obvious how conventions could determine the white listed methods from this.


 On Tue, Sep 24, 2013 at 3:21 AM, Lukasz Lenart 
 lukaszlen...@apache.orgwrote:

 2013/9/24 Christoph Nenning christoph.nenn...@lex-com.net:
   But still: method:add works while !add does not.
 
  If you could prepare a small demo app, I'd like investigate that.
 
 
 
  I can do so next week, sorry for the delay

 No problem, I'm busy too ;-)


 Regards
 --
 Łukasz
 + 48 606 323 122 http://www.lenart.org.pl/

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org






Re: Issues with docs

2013-09-16 Thread Ken McWilliams
Still you can't have users going to improper content, how would they know
it works elsewhere?
The content missing on the page (code) is a significant issue.


On Sun, Sep 15, 2013 at 11:16 PM, Lukasz Lenart lukaszlen...@apache.orgwrote:

 Thanks, but it is already solved with Draft docs

 http://struts.apache.org/development/2.x/docs/unit-testing.html


 Regards
 --
 Łukasz
 + 48 606 323 122 http://www.lenart.org.pl/

 2013/9/16 Eric MacAdie emaca...@gmail.com:
  I don't know if this is the place to point this out, but it looks like
 the
  docs on the Apache website need a bit of work.
 
  When I go to
 http://struts.apache.org/release/2.3.x/docs/unit-testing.html,
  I got a warning pop-up window saying: Syntax Highlighter: Can't find
 brush
  for: xml
 
  That happens on quite a few of the 2.3 pages, but none of the 2.2 pages.
 
  - Eric MacAdie

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Inquiry

2013-09-08 Thread Ken McWilliams
It's a good idea to put your action classes into packages.

Not on the topic of the question exactly but the long inheritance chain on
your action is suspicious. Consider struts2 Interceptors and since you are
using Spring inject what you need where you need it.



 action name=GenericPresentationAction
 class=GenericPresentationAction method=listAll
 result name=list
 ${destination}
 /result
 /action


JL already asked where is destination defined? In the execute method of the
GenericPresentationAction class output to the console the value contained
in destination.

Does it contain what you expect? Also how is the value of destination
determined? Is it passed in from the client?




 action name=GenericPresentationAction_*
 class=GenericPresentationAction method={1}
 result name=input type=dispatcher
 param
 name=location/WEB-INF/jsp/setup/genericPresentationForm.jsp/param
 /result
 result name=success type=dispatcher
 param
 name=location/WEB-INF/jsp/setup/genericPresentationForm.jsp/param
 /result
 result name=list type=dispatcher
 param
 name=location/WEB-INF/jsp/setup/genericPresentationList.jsp/param
 /result
 /action



It would be helpful if we could see how tiles was tied into the above there
is no tile result type in clear use.
Also 'type=dispatcher' is the default, so long as you extended
struts-default.



 In tiles.xml:

 definition name=AdministratorBase
 template=/WEB-INF/jsp/setup/layout.jsp 
 put-attribute name=header value=/WEB-INF/jsp/setup/header.jsp
 /
 put-attribute name=menu value=/WEB-INF/jsp/setup/menu.jsp  /
 put-attribute name=footer
 value=/WEB-INF/jsp/setup/footer.jsp  /
 /definition
 definition name=GenericPresentationAction
 extends=AdministratorBase
 put-attribute name=title value=Presentación /
 put-attribute name=description value=Administrar Contenido /
 put-attribute name=content
 value=/WEB-INF/jsp/setup/genericPresentation.jsp /
 /definition


What version of tiles are you using?


 In spring-data.xml:

 bean id=genericHibernateDAO
 class=ro.dao.hibernate.GenericHibernateDAO abstract=true
 autowire=byName
 property name=sessionFactory ref=sessionFactory /
 /bean

 In spring-servlet.xml:

 bean id=genericPresentationDAO
 class=com.tipuana.rf.dao.hibernate.GenericPresentationDAOHibernate
 parent=genericHibernateDAO autowire=byName /


 In spring-servlet-setup.xml:

 bean id=GenericPresentationAction
 class=com.tipuana.rf.action.setup.GenericPresentationAction
 scope=prototype
 property name=genericPresentationDAO
 ref=genericPresentationDAO /
 /bean




 On Thu, Sep 5, 2013 at 9:05 PM, jlm...@gmail.com wrote:

 You need to provide some code if you want some answers. Where is
 destination defined? What's your action definition? Your tiles.xml? The
 stacktrace?

 JL
 Sent via BlackBerry from T-Mobile

 -Original Message-
 From: Hernán heam...@gmail.com
 Date: Thu, 5 Sep 2013 19:32:14
 To: Struts Users Mailing Listuser@struts.apache.org
 Reply-To: Struts Users Mailing List user@struts.apache.org
 Subject: Inquiry

 Hi you all developers! I'm currently developing a web application, I have
 added a new CRUD action which extend several abstract classes whereas the
 first one extend action support. The web app uses tiles and when trying to
 find a Tile Definition to render ${destination} it can't find it. It says,
 cannot find ' ' definition. Other instance variables which are declared in
 the upper most class of the class hierarchy (I mean after action support)
 aren't able to be seen. I wonder what might be wrong since all other
 actions work properly. My CRUD system is based in the one that exists in
 struts2 in action book it is a version I improved. This action implements
 ModelDriven interface, whilst the majority doesn't. Thank you. I hope you
 can help me! Have a nice day!

 --
 Hernán




 --
 Hernán


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org



Understanding Struts2 Internals : Result Configuration

2013-09-05 Thread Ken McWilliams
The following is a direct copy of a question at SO which has been repeated
here for completeness but can be found here with nice syntax highlighting :
http://stackoverflow.com/questions/18650377/understanding-struts2-internals-result-configuration


In an effort to understand how struts2 loads its configuration I wanted to
display the path to the JSP which would be rendered. Given the following
very minimal struts.xml:

struts
constant name=struts.devMode value=true /
constant name=struts.ui.theme value=simple /

package name=base namespace=/
result-types
result-type name=dispatcher
class=org.apache.struts2.dispatcher.ServletDispatcherResult
default=true/
/result-types
action name=test class=com.kenmcwilliams.badwebapp.action.Test
result/WEB-INF/content/test.jsp/result
/action
/package
/struts

I want to be able to log /WEB-INF/content/test.jsp from within the
action. Given the following action:

package com.quaternion.badwebapp.action;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.interceptor.PreResultListener;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Test extends ActionSupport {
//used for a sanity test on JSP
public String getMessage() {
return From test;
}

@Override
public String execute() throws Exception {

System.out.println(ActionContext.getContext().getActionInvocation().getResultCode():
 + ActionContext.getContext().getActionInvocation().getResultCode());
ActionInvocation ai = ActionContext.getContext().getActionInvocation();
ai.addPreResultListener(new PreResultListener() {
@Override
public void beforeResult(ActionInvocation invocation,
String resultCode) {
try {
System.out.println(PreResultListener resultCode:
 + resultCode);
System.out.println(PreResultListener result:  +
invocation.getResult());
} catch (Exception ex) {

Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
return SUCCESS;
}
}

There are three print statements which produce the following output on my
console:

INFO:   ActionContext.getContext().getActionInvocation().getResultCode(): null
INFO:   PreResultListener resultCode: success
INFO:   PreResultListener result: null

From testing both the result invocation.getResult() and the resultcode is
null *before* the PreResultListener is called but *within* the
PreResultListener the resultcode is set, yet the result still returns null!

From the JavaDoc of the getResult() method:

If the ActionInvocation has been executed before and the Result is an
instance of {@link ActionChainResult}, this method will walk down the chain
of ActionChainResult's until it finds a non-chain result, which will be
returned. *If the ActionInvocation's result has not been executed before,
the Result instance will be created and populated with the result params.*

Seems pretty clear that a result instance is *not* being created.

So how do I display /WEB-INF/content/test.jsp within this action? This is
not for typical struts2 use, I'm want to test a configuration provider for
which there is something wrong with the construction of the result for the
action, hopefully understanding why this isn't working will let me fix that
too.


Custom ConfigurationProvider is not able to find result

2013-09-02 Thread Ken McWilliams
Probably something silly but the following is just a rough effort at
proving to myself that I can add a new action though a configuration
provider...

It adds the package and action but there is something wrong with the
result. If the results name is set to error I get there is no mapping for
result success but when the name is set to success the message is then:
message *result 'null' not found


*
So it seems the result is mostly configured correctly...

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.config.ConfigurationException;
import com.opensymphony.xwork2.config.ConfigurationProvider;
import com.opensymphony.xwork2.config.entities.ActionConfig;
import com.opensymphony.xwork2.config.entities.PackageConfig;
import com.opensymphony.xwork2.config.entities.ResultConfig;
import com.opensymphony.xwork2.config.entities.ResultTypeConfig;
import com.opensymphony.xwork2.inject.ContainerBuilder;
import com.opensymphony.xwork2.util.location.LocatableProperties;
import com.opensymphony.xwork2.util.location.LocationImpl;

public class DBConfigurationProvider implements ConfigurationProvider {

private Configuration configuration;

@Override
public void destroy() {
}

@Override
public void init(Configuration configuration) throws
ConfigurationException {
this.configuration = configuration;
}

@Override
public boolean needsReload() {
return false;//clearly this is conditional on the status of the
model
}

@Override
public void register(ContainerBuilder cb, LocatableProperties lp)
throws ConfigurationException {
//throw new UnsupportedOperationException(Not supported yet.);
//To change body of generated methods, choose Tools | Templates.
}

@Override
public void loadPackages() throws ConfigurationException {
String packageName = /trial-package;
String namespace = packageName;
PackageConfig parentPackage =
configuration.getPackageConfig(struts-default);

PackageConfig.Builder cfg = new PackageConfig.Builder(packageName)
.addParent(parentPackage)
.namespace(packageName)
.isAbstract(false)
.strictMethodInvocation(false);//TODO: Consider defaulting
this to true
addAction(test, com.kenmcwilliams.demo.Test2, cfg);//Test
Driven Development! TDD: externalize all this hard wired cfg to a test case

System.out.println(CONFIGURATION, adding namespace:  +
cfg.getNamespace());
PackageConfig packageConfig = cfg.build();
System.out.println(packageConfig:  + packageConfig);

configuration.addPackageConfig(cfg.getNamespace(), packageConfig);
//configuration.
}

private void addAction(String actionName, String clazz,
PackageConfig.Builder packageContext){
ActionConfig.Builder actionBuilder = new
ActionConfig.Builder(packageContext.getNamespace(), actionName, clazz);
ResultTypeConfig resultType =
packageContext.getResultType(dispatcher);

System.out.println(resultType.getClassName(): +
resultType.getClassName());
System.out.println(resultType.getName(): + resultType.getName());
ResultConfig.Builder resultBuilder = new
ResultConfig.Builder(ActionSupport.SUCCESS, resultType.getClassName());
String jsp = /WEB-INF/other/test.jsp;
resultBuilder.location(new LocationImpl(jsp, jsp));
ResultConfig result = resultBuilder.build();
System.out.println(result.getLocation().getURI(): +
result.getLocation().getURI());
actionBuilder.addResultConfig(result);
ActionConfig action = actionBuilder.build();
packageContext.addActionConfig(actionName, action);
}
}


**


*
*


Re: Interceptor in various struts.xml

2013-08-27 Thread Ken McWilliams
To be clear, the term submodule to me indicates some type of
encapsulation... you know that the includes only make one big XML file? If
this is a new project consider the struts2-conventions-plugin, if it is in
use I don't think your configuration should need to grow beyond more than
one xml file.


On Tue, Aug 27, 2013 at 8:00 AM, Dave Newton davelnew...@gmail.com wrote:

 Are the actions in the same package?

 You need to provide more information; we cannot see your project and
 without specifics, we have to guess.

 Dave



 On Tue, Aug 27, 2013 at 9:30 AM, Thomas Lionel SMETS (prof) 
 tsm...@a3-system.eu wrote:

   Typically, MdcLoggingUtility does this :
 
 @Override
  public String intercept(ActionInvocation invocation) throws Exception
  {
  /*
   * This code puts a unique Id to the Mapped Diagnostic
   * context. Since MDC is a static class, we can directly access
 it
   * with out creating a new object from it.
   */
  String uniqueId =
  UniqueIdGenerator.generateId(Constants.MAX_UNIQUE_ID_LENGTH);
  MDC.put(LoggingConstant.TRANSACTION_ID, uniqueId);
  if(LOG.isInfoEnabled())
  LOG.info(Putting a unique ID in the context :  + uniqueId);
  String invocationResponse = invocation.invoke();
  if(LOG.isInfoEnabled())
  LOG.info(Removing unique ID from the context :  +
  MDC.get(LoggingConstant.TRANSACTION_ID));
  MDC.remove(LoggingConstant.TRANSACTION_ID);
  return invocationResponse;
  }
 
  but it is not set in most Actions of module_1  module_2
 
  \T,
 
 
 
 
 
  On 27/08/13 13:55, Dave Newton wrote:
 
  What doesn't work?
 
  Dave
   On Aug 27, 2013 7:08 AM, Thomas Lionel SMETS (prof) 
 tsm...@a3-system.eu tsm...@a3-system.eu
  wrote:
 
 
   I created my interceptor stack in the top-level struts.xml, like this :
  !DOCTYPE struts PUBLIC
-//Apache Software Foundation//DTD Struts Configuration 2.3//EN
http://struts.apache.org/dtds/struts-2.3.dtd; 
 http://struts.apache.org/dtds/struts-2.3.dtd
 http://struts.apache.org/dtds/struts-2.3.dtd 
 http://struts.apache.org/dtds/struts-2.3.dtd
 
struts
 
  package name=default namespace=/ extends=struts-default
 
  interceptors
  interceptor name=logging
  class=com.mysite.common.MdcLoggingUtility/
  interceptor-stack name=MyStack
  interceptor-ref name=params
  param
 name=acceptParamNames^[a-zA-Z0-9_]+$/param
  param name=paramNameMaxLength40/param
  /interceptor-ref
  interceptor-ref name=timer 
  param name=logLevelinfo/param
  /interceptor-ref
  interceptor-ref name=defaultStack /
  /interceptor-stack
  /interceptors
 
  default-interceptor-ref name=MyStack /
 
  ...
 
  include file=module_1/struts.xml /
  include file=module_2/struts.xml /
  /struts
 
 
  I have tried different declaration in the submodules but thay all seems
 to
  not thoroughly work.
  So having the same declaration or the same declaration with different
 name
  for the interceptor or using MyStack in the extends ...
 
 
  Any idea would be appreaciated.
 
  Tx,
 
 
 
 
 
 
 
 
 
 
 
  --
  Thomas Lionel SMETS, CISSP (385434)
  *m :* +32 497 44 68 12
  *ph :* +32 2 852 3341
  *skype :* thomas.lionel.smets
 
  PGP = FDF0 8FB8 4F37 3F79 1011 05AB 0DCE 9BAB 5DD0 0E10
 
 
 
 
  --
  Thomas Lionel SMETS, CISSP (385434)
  *m :* +32 497 44 68 12
  *ph :* +32 2 852 3341
  *skype :* thomas.lionel.smets
 
  PGP = FDF0 8FB8 4F37 3F79 1011 05AB 0DCE 9BAB 5DD0 0E10
 



 --
 e: davelnew...@gmail.com
 m: 908-380-8699
 s: davelnewton_skype
 t: @dave_newton https://twitter.com/dave_newton
 b: Bucky Bits http://buckybits.blogspot.com/
 g: davelnewton https://github.com/davelnewton
 so: Dave Newton http://stackoverflow.com/users/438992/dave-newton



Re: Interceptor in various struts.xml

2013-08-27 Thread Ken McWilliams
Not looking that closely but both your packages extend struts-default if
you want the interceptors/results of package default to be available to
package M1 you should extend default on that package rather than
struts-default...


On Tue, Aug 27, 2013 at 5:04 PM, Thomas Lionel SMETS (prof) 
tsm...@a3-system.eu wrote:

  So, I found a solution to the issue.
 Defining the MDC-interceptor is done like this :
 ?xml version=1.0 encoding=UTF-8 ?

 !DOCTYPE struts PUBLIC
   -//Apache Software Foundation//DTD Struts Configuration 2.3//EN
   
 http://struts.apache.org/dtds/struts-2.3.dtd;http://struts.apache.org/dtds/struts-2.3.dtd
 
 struts
 package name=default namespace=/ extends=struts-default
 interceptors
 interceptor name=MDC
 class=be.a3-system.util.MdcLoggingUtility
 /interceptor

 interceptor-stack name=MyStack
 interceptor-ref name=MDC /interceptor-ref


 interceptor-ref name=params
 param name=acceptParamNames^[a-zA-Z0-9_]+$/param
 param name=paramNameMaxLength40/param
 /interceptor-ref

 interceptor-ref name=timer 
 param name=logLevelinfo/param
 /interceptor-ref

 interceptor-ref name=defaultStack /
 /interceptor-stack
 /interceptors

 default-interceptor-ref name=MyStack /

 action name=Hello class=be.a3-system.action.HelloAction
 result name=success/WEB-INF/Hello.jsp/result
 param name=scenarioDEFAULT/param
 /action

 action name=* class=be.a3-system.action.CatchAllAction
 result name=success/WEB-INF/CatchAll.jsp/result
 /action

 /package

 include file=m1/struts.xml /
 include file=m2/struts.xml /

 /struts

 But this interceptor is not propagated to the m1/struts.xml 
 m2/struts.xml.
 The interceptor needs to be added to the included files.
 With something like this :

 ?xml version=1.0 encoding=UTF-8 ?

 !DOCTYPE struts PUBLIC
   -//Apache Software Foundation//DTD Struts Configuration 2.3//EN
   
 http://struts.apache.org/dtds/struts-2.3.dtd;http://struts.apache.org/dtds/struts-2.3.dtd
 
 struts
 package name=M1 namespace=/m1 extends=struts-default

 interceptors
 interceptor name=MDC
 class=be.a3-system.util.MdcLoggingUtility
 /interceptor

 interceptor-stack name=MyM1Stack
 interceptor-ref name=MDC /interceptor-ref


 interceptor-ref name=params
 param name=acceptParamNames^[a-zA-Z0-9_]+$/param
 param name=paramNameMaxLength40/param
 /interceptor-ref

 interceptor-ref name=timer 
 param name=logLevelinfo/param
 /interceptor-ref

 interceptor-ref name=defaultStack /
 /interceptor-stack
 /interceptors

 default-interceptor-ref name=MyM1Stack /

 action name=Hello class=be.a3-system.action.HelloAction
 result name=success/WEB-INF/Hello.jsp/result
 param name=scenarioM1/param
 /action

 action name=* class=be.a3-system.action.CatchAllAction
 result name=success/WEB-INF/CatchAll.jsp/result
 /action

 /package

 /struts







 \T,



 On 27/08/13 13:55, Dave Newton wrote:

 What doesn't work?

 Dave
  On Aug 27, 2013 7:08 AM, Thomas Lionel SMETS (prof) tsm...@a3-system.eu 
 tsm...@a3-system.eu
 wrote:


  I created my interceptor stack in the top-level struts.xml, like this :
 !DOCTYPE struts PUBLIC
   -//Apache Software Foundation//DTD Struts Configuration 2.3//EN
   http://struts.apache.org/dtds/struts-2.3.dtd; 
 http://struts.apache.org/dtds/struts-2.3.dtdhttp://struts.apache.org/dtds/struts-2.3.dtd
  http://struts.apache.org/dtds/struts-2.3.dtd

   struts

 package name=default namespace=/ extends=struts-default

 interceptors
 interceptor name=logging
 class=com.mysite.common.MdcLoggingUtility/
 interceptor-stack name=MyStack
 interceptor-ref name=params
 param name=acceptParamNames^[a-zA-Z0-9_]+$/param
 param name=paramNameMaxLength40/param
 /interceptor-ref
 interceptor-ref name=timer 
 param name=logLevelinfo/param
 /interceptor-ref
 interceptor-ref name=defaultStack /
 /interceptor-stack
 /interceptors

 default-interceptor-ref name=MyStack /

 ...

 include file=module_1/struts.xml /
 include file=module_2/struts.xml /
 /struts


 I have tried different declaration in the submodules but thay all seems to
 not thoroughly work.
 So having the same declaration or the same declaration with different name
 for the interceptor or using MyStack in the extends ...


 Any idea would be 

Re: AJAX Jsp tags

2013-08-11 Thread Ken McWilliams
I have some experience creating custom struts2 tags, but for ajax I do not
advise this route at all.  XML is not meant as a replacement for a
programming language, it is meant for configuration. It might seem
intuitive without further investigation that there are a limited number of
HTML UI elements and their functionality quite straight forward and so it
would seem reasonable that a configuration only route could work in the
general case. This is wrong as evidenced by all efforts to define dynamic
UI elements using XML.

Even JavaFX tried to use xml and that was abandoned, they had the benefit
of designing the entire environment from the ground up, which is hardly the
case here.

Not sure if you are familiar with the popular Question and Answer site
Stack Overflow, however a great many questions regarding the struts2 ajax
tags go unanswered. If people could find solutions for their configuration
issues I wouldn't be so open with my negative view of ajax tags. Since it
is most often new users of Struts2 that attempt to use these tags and to
what appears to be dismal results I can't help but think that these tags
may actually be of harm to the struts2 image.

I've only experimented with the jquery ajax tags breifly and experienced
frustration. Also before that experimented with the now deprecated dojo
tags. I had used the dojo tags within their prescribed limits but it is
much more enjoyable to have freedom. They were just too cumbersome. As soon
as you use JavaScript everything is far easier.

Try to use Unobtrusive JavaScript:
http://en.wikipedia.org/wiki/Unobtrusive_JavaScript

This will make your html tag like while allowing you to use the
JavaScript APIs as intended.

It is worth noting that the tag libraries can be used as templates. I bring
this up because one natural objection to not using a tag library would be a
loss in terms of this particular use. There are a number of other solutions
in this area one of them is Apache Tiles. JSPs, Freemarker, and Velocity
are all view technologies and while they have facilities for templates it
isn't their first concern. Apache tiles and Sitemesh both address the issue
of reducing boiler plate head on. Tiles does not try to do what the
aforementioned view technologies do, instead think of it as a way to factor
commonality out of any of those view technologies. As such both Apache
Tiles is a meta-view technology.

What I advise:

1) Avoid ajax tag libraries and write JavaScript by hand - even if you
don't know JS, you will be able to understand the documentation of the
popular JS UI elements and achieve the same level of functionality as
provided by the ajax tags even if all you do is cut and paste programming.
2) Follow the Unobtrusive JavaScript practice.
3) When writing JS do not hard code URLs use the struts2 URL tag (It will
pick up changes to the context root that way).
4) When asking for help with the client side, no one needs to know what
server side technology is used. The is greatly improve your chances for
positive feedback.
5) Use the Struts2-JSON plugin to produce data for your ajax consuming UI
elements and also as a means of accepting JSON data into actions.
6) When asking for server side support, try to insulate the audience from
your particular JS. (Determine that the correct data is being sent to the
server, if it not the issue is a client side, if the correct data is being
sent only provide that data [the query string or the JSON string]).
7) Use firebug plugin fore Firefox, it is a huge help.

8) Should you feel the need for a stronger templates solution consider
tiles (or sitemesh), this link points to it in a rather current use of it:
http://tech.finn.no/2012/07/25/the-ultimate-view-tiles-3/

Hope the reasoning is clear enough. I sincerely want to save you and anyone
else with similar concern some time and sanity.





On Sat, Aug 10, 2013 at 3:05 AM, Alireza Fattahi afatt...@yahoo.com wrote:

 Thanks for your comment.
 Did you have any experience with struts jquery tag or other tags too?
 Or you complete suggest that we write our own tags !



 ~Regards,
 ~~Alireza Fattahi


 
  From: Ken McWilliams ken.mcwilli...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Friday, 9 August 2013, 8:22
 Subject: Re: AJAX Jsp tags


 Don't use a JSP AJAX tag library. The dojo JSP tags didn't work well not
 because of dojo or an fault of the tag authors, the technologies simply
 don't mesh. It's as sane to program Java via XML as it is to program
 JavaScript via XML.

 XML is used for configuration. At first glance you think you'll only need
 trivial behaviour but this is seldom ever the case,  JS UI components are
 much easier to work with and you will need to provide your own handlers,
 which are often required even in the simple cases. XML can not account for
 all these cases and does not provides the means to add custom handlers in a
 way that would be as simple as using

Re: AJAX Jsp tags

2013-08-08 Thread Ken McWilliams
Don't use a JSP AJAX tag library. The dojo JSP tags didn't work well not
because of dojo or an fault of the tag authors, the technologies simply
don't mesh. It's as sane to program Java via XML as it is to program
JavaScript via XML.

XML is used for configuration. At first glance you think you'll only need
trivial behaviour but this is seldom ever the case,  JS UI components are
much easier to work with and you will need to provide your own handlers,
which are often required even in the simple cases. XML can not account for
all these cases and does not provides the means to add custom handlers in a
way that would be as simple as using the underlying JS framework naturally.

Further the tag authors often lag behind the UI components that they wrap,
the documentation and features often fall behind too.

With even a trivial understanding of JS you should be able to produce the
same results as the Tags in the same time frame, as you gain experience
you'll quickly superseded the capabilities of any tag library.





On Thu, Aug 8, 2013 at 11:02 AM, Chris Pratt thechrispr...@gmail.comwrote:

 The dojo based tags are deprecated, the jQuery based tags are not.
   (*Chris*)


 On Thu, Aug 8, 2013 at 9:54 AM, Alireza Fattahi afatt...@yahoo.com
 wrote:

  Hi,
 
  I have confused with struts 2 ajax please correct me:
  1- The dojo plugin is deprecated (
  http://struts.apache.org/release/2.3.x/docs/ajax-tags.html)
  2- According to above we are not recommended to use dojo plugin in new
  projects.
   3- All tags that mentioned in above page like: a, autocompliter,bind ...
  shall not be used.
  4- According to page
 http://struts.apache.org/release/2.3.x/docs/ajax.html
  :
  First, you can use some type of JSP tag. Here, you don't have to
 know
  very much at all about Ajax or JavaScript. The taglib does all the work,
  and you just have to figure out how to use the taglib. The standard
  Struts 2 taglib includes several Ajax JSP tags,
  5- The Ajax JSP tags link above will redirect to
  http://struts.apache.org/release/2.3.x/docs/ajax-tags.html, which is
  deprecated!!
 
  I don't get it !
  Can we use AJAX Jsp tags or they are deprecated ?
 
 
  ~Regards,
  ~~Alireza Fattahi
 



Re: struts 2 ajax choice

2013-05-14 Thread Ken McWilliams
I don't suppose you would consider neither as a valid choice?

The short is the JS APIs are the intended intended to be used with JS not
XML. When you use these integrated tag libraries you end up with a brittle
solution. They can only factor in so much with XML. It makes about as much
sense as wrapping Java with XML tags.

So I'm certainly not saying don't use DOJO or jQuery I'm just skeptical of
the plugin benefits for either.


On Tue, May 14, 2013 at 3:56 AM, Martin Gainty mgai...@hotmail.com wrote:

 UI Controls:
 s2jquery will allow you to render a true grid control whose display
 parameters are fully configurable from cssClass
 and will populate from a configurable number of sources and process that
 query by a Struts Action
 http://struts.jgeppert.com/struts2-jquery-showcase/index.action

 Transmission Formats:
 Json is another way of sending data from the server and client based on
 name-value pairings OR ordered-list
 http://www.json.org/

 If the client is expecting JSON then you want to manipulate your response
 from the server to JSON format as you render the response

 Regardless of the control you are implementing you can render you response
 using JSONResult
 http://code.google.com/p/struts2-jquery/wiki/JsonResult

 does that answer your question?

 Martin Gainty
 __
 Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
 Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
 Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
 dient lediglich dem Austausch von Informationen und entfaltet keine
 rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
 E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
 Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
 destinataire prévu, nous te demandons avec bonté que pour satisfaire
 informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
 de ceci est interdite. Ce message sert à l'information seulement et n'aura
 pas n'importe quel effet légalement obligatoire. Étant donné que les email
 peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
 aucune responsabilité pour le contenu fourni.




  Date: Mon, 13 May 2013 15:07:01 -0700
  From: sh_thorn_b...@yahoo.com
  Subject: Re: struts 2 ajax choice
  To: davelnew...@gmail.com; user@struts.apache.org
 
  Dave,
 
  so, as your experience, which one u recommend to use?
 
  JSON or S2Jquery?
 
  thanks in advance
 
  john
 
 
 
  
  From: Dave Newton davelnew...@gmail.com
  To: Struts Users Mailing List user@struts.apache.org
  Cc: john lee sh_thorn_b...@yahoo.com
  Sent: Monday, May 13, 2013 5:03 PM
  Subject: Re: struts 2 ajax choice
 
 
 
 
 
 
 
 
  On Mon, May 13, 2013 at 5:56 PM, Mike Hao mike@gmail.com wrote:
 
  Will the S2 jQuery plugin provide the similar functions as S2 dojo
 plugin?
  
 
  The docs and examples are available on the site I linked to.
 
 
  Is S2 jQuery plugin maintained by Struts 2 team?
   The S2 jQuery plugin I linked to is an independent project that happens
 to have at least one S2 team member on it.
 
 
  It is *not* an official plugin, but it's quite a bit more recent, and
 better (IMO) than the deprecated Dojo plugin.
 
 
  Could anyone give me explanation why
  S2 Dojo plugin get deprecated?
  
 
  Because it used a very old version of Dojo and nobody had the interest
 in upgrading and maintaining it.
 
 
  Dave




Re: struts 2 / sitemesh/ s: problem

2013-05-09 Thread Ken McWilliams
I know very little about sitemesh integration and am away from my
development machine but I think the integration guides mention you need to
use the StrutsPrepareFilter followed by the
SiteMeshFilter filter followed by the StrutsExecute filter.

Guessing but the SiteMeshFilter might be a custom one designed for struts2
integration (if there is a struts2-sitemesh-plugin) I'd verify if this is
the case.


On Thu, May 9, 2013 at 12:33 PM, john lee sh_thorn_b...@yahoo.com wrote:



 alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat partsearchinput.jsp

 %@ taglib prefix=s uri=/struts-tags%

 s:actionerror/
 s:form action=partsearchinput
 s:textfield name=partid label=partid/
 s:submit value=search/
 /s:form

 the above code works, and verified by
 http://localhost/ecommerce/partsearchinput.jsp

 but, after i start to use sitemesh, it has the problem as the following

 The Struts dispatcher cannot be found.  This is usually caused by using
 Struts tags without the associated filter. Struts tags are only usable when
 the request has passed through its servlet filter, which initializes the
 Struts dispatcher needed for this tag. - [unknown location]

 SEVERE: Unhandled exception occurred whilst decorating page
 java.lang.RuntimeException: org.apache.jasper.JasperException: An
 exception occurred processing JSP page /partsearchinput.jsp at line 6
 3:
 4: %@ taglib prefix=s uri=/struts-tags%
 5:
 6: s:actionerror/
 7: s:form action=partsearchinput
 8: s:textfield name=partid label=partid/
 9: s:submit value=search/



 
 alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat web.xml

 filter
 filter-namestruts2/filter-name

 filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter/filter-class
 /filter
 filter
filter-namesitemesh/filter-name
   filter-classcom.opensymphony.sitemesh.webapp.SiteMeshFilter
/filter-class
 /filter
 filter-mapping
 filter-namesitemesh/filter-name
  url-pattern/*/url-pattern
  dispatcherFORWARD/dispatcher
  dispatcherREQUEST/dispatcher
 /filter-mapping
 **
 alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/decorators # cat
 basic-theme.jsp

  %@ taglib uri=http://www.opensymphony.com/sitemesh/decorator;
 prefix=decorator %

 %@ taglib uri=http://www.opensymphony.com/sitemesh/decorator;
 prefix=decorator%
 %@ taglib uri=http://www.opensymphony.com/sitemesh/page; prefix=page%

 %@ taglib prefix=s uri=/struts-tags%

 body
  table width=100% height=100%
tr td
  %@ include file=/partsearchinput.jsp%
/td/tr
tr td
decorator:body /hr /
/td/tr
tr td h2 pfont color=blueCopyright
 X/font/p  /h2 /td/tr
  /table
 /body

 ***
 alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat
 decorators.xml
 decorators defaultdir=/decorators

decorator name=basic-theme page=basic-theme.jsp
pattern/menu.jsp/pattern
/decorator
   /decorators

 **
 alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat partsearchinput.jsp

 %@ taglib prefix=s uri=/struts-tags%
 s:actionerror/
 s:form action=partsearchinput
 s:textfield name=partid label=partid/
 s:submit value=search/
 /s:form

 ***
 alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat menu.jsp

 body
  h1test/p
/body


Re: generating taglib using Ant and Java 6

2013-04-10 Thread Ken McWilliams
Has anyone here checked out the suitability of using the Tile auto tag
project for struts2?
http://tiles.apache.org/tiles-autotag/index.html



On Wed, Apr 10, 2013 at 8:37 AM, Steven Yang kenshin...@gmail.com wrote:

 I asked whether I should do it in a new package
 because the new Processor is no longer using the APT
 and therefore there wont be Factory and the Processor the extending the
 annotation Processor in Java 6


 On Wed, Apr 10, 2013 at 6:25 PM, Martin Gainty mgai...@hotmail.com
 wrote:

  Stephen
 
  your comment last nite said something about wrapping into APT package?
 
  I didnt see Factory, Processor, Environment or META-INF/services
 
  http://docs.oracle.com/javase/1.5.0/docs/guide/apt/GettingStarted.html
 
  ?
  Martin
  __
  Verzicht und Vertraulichkeitanmerkung
 
  Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
  Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
 unbefugte
  Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
  dient lediglich dem Austausch von Informationen und entfaltet keine
  rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
  E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
 
 
 
   From: lukaszlen...@apache.org
   Date: Wed, 10 Apr 2013 07:51:14 +0200
   Subject: Re: generating taglib using Ant and Java 6
   To: user@struts.apache.org
  
   2013/4/9 Steven Yang kenshin...@gmail.com:
submitted
please let me know if anything is wrong, first timer
   
https://issues.apache.org/jira/browse/WW-4040
  
   Thanks a lot! I will review it asap :-)
  
  
   Regards
   --
   Łukasz
   + 48 606 323 122 http://www.lenart.org.pl/
  
   -
   To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
   For additional commands, e-mail: user-h...@struts.apache.org
  
 
 



Complete list of framework bean keys

2013-04-04 Thread Ken McWilliams
Sometimes I want to override a default framework implementation and the
first place I look is in struts-default.xml but I don't think it contains
all possible bean keys.

Is such a list maintained?

For instance I want to provide a custom ConfigurationProvider but see no
reference to a configuration provider (StrutsXmlConfigurationProvider), so
am not sure what to provide in my struts.xml


Re: Complete list of framework bean keys

2013-04-04 Thread Ken McWilliams
Perfect.

As an asides: There not appear to be a unit test for
XmlConfigurationProvider, is it tested indirectly?

There was plans have Guice as a Struts2 Dependency? Is this still in
progress? Just asking after reading over and trying to wrap my head around
ContainerBuilder (a parameter of the register method, one of
ConfigurationProvider's interface methods...)


On Thu, Apr 4, 2013 at 11:18 PM, Lukasz Lenart lukaszlen...@apache.orgwrote:

 2013/4/5 Ken McWilliams ken.mcwilli...@gmail.com:
  Sometimes I want to override a default framework implementation and the
  first place I look is in struts-default.xml but I don't think it contains
  all possible bean keys.
 
  Is such a list maintained?


 http://struts.apache.org/development/2.x/docs/plugins.html#Plugins-ExtensionPoints

  For instance I want to provide a custom ConfigurationProvider but see no
  reference to a configuration provider (StrutsXmlConfigurationProvider),
 so
  am not sure what to provide in my struts.xml

 bean type=com.opensymphony.xwork2.config.PackageProvider
 class=com.demo.MyPackageProvider scope=singleton /


 Regards
 --
 Łukasz
 + 48 606 323 122 http://www.lenart.org.pl/

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Struts 1.1 and Tiles 2 compatability

2013-03-11 Thread Ken McWilliams
I don't know struts1 at all, but if you are afforded that ability to create
a custom result type then you should be able to manually invoke tiles (at
any version including version 3, which if you're going to put in the effort
should be your target). Here is how something similar was done with
Struts2, clearly not the same thing but the web.xml set up for tiles and
the dependencies for tiles would have the same starting point.


On Mon, Mar 11, 2013 at 2:34 PM, Sekar, Sowmya sse...@ucsd.edu wrote:

 Is any version of Struts 1 (example : Struts 1.4) compatible with Tiles
 2.2.2.?

 Thanks, Sowmya

 -Original Message-
 From: paulus.benedic...@gmail.com [mailto:paulus.benedic...@gmail.com] On
 Behalf Of Paul Benedict
 Sent: Monday, March 11, 2013 1:15 PM
 To: Struts Users Mailing List
 Subject: Re: Struts 1.1 and Tiles 2 compatability

 Tiles 2 is not compatible with Struts 1. You must use Tiles 1.

 Paul

 On Mon, Mar 11, 2013 at 3:01 PM, Sekar, Sowmya sse...@ucsd.edu wrote:

  Hi,
 
  I am in the process of upgrading from Tiles 1 to Tiles 2.2.2 combined
  with Struts 1.1.
 
  I have the following configuration in struts-config.xml
 
  controller
  processorClass=org.apache.struts.tiles.TilesRequestProcessor/
 
plug-in className=org.apache.struts.tiles.TilesPlugin 
  set-property property=definitions-config
  value=/WEB-INF/tiles.xml/
  set-property property=moduleAware value=true /
  set-property property=definitions-parser-validate value=true /
/plug-in
 
  Below is the dtd configured in tiles.xml
 
  !DOCTYPE tiles-definitions PUBLIC
 -//Apache Software Foundation//DTD Tiles Configuration 2.0//EN
 http://tiles.apache.org/dtds/tiles-config_2_0.dtd;
 
  I have the tiles2.2.2 related jars(tiles-jsp, tiles-servlet,
  tiles-template, tiles-api, tiles-core) in my classpath and I use maven
  to import jars in my project
 
  When I start tomcat and display my page, I get the following error,
 
  Mar 11, 2013 12:54:52 PM
  org.apache.catalina.core.ApplicationDispatcher
  invoke
  SEVERE: Servlet.service() for servlet jsp threw exception
  org.apache.tiles.template.NoSuchAttributeException: Attribute 'topmenu'
  not found.
 at
 
 org.apache.tiles.template.DefaultAttributeResolver.computeAttribute(DefaultAttributeResolver.java:49)
 at
 
 org.apache.tiles.template.InsertAttributeModel.resolveAttribute(InsertAttributeModel.java:187)
 at
  org.apache.tiles.template.InsertAttributeModel.start(InsertAttributeMo
  del.java:107)
 
  It is not able to find any of the attributes in tiles.xml
 
  Any thoughts?
 
  Thanks,
  Sowmya
  sse...@ucsd.edu
 
 

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Struts 1.1 and Tiles 2 compatability

2013-03-11 Thread Ken McWilliams
The link would be useful:
http://stackoverflow.com/questions/13337938/how-to-integrate-struts-2-with-tiles-3


On Mon, Mar 11, 2013 at 3:29 PM, Ken McWilliams ken.mcwilli...@gmail.comwrote:

 I don't know struts1 at all, but if you are afforded that ability to
 create a custom result type then you should be able to manually invoke
 tiles (at any version including version 3, which if you're going to put in
 the effort should be your target). Here is how something similar was done
 with Struts2, clearly not the same thing but the web.xml set up for tiles
 and the dependencies for tiles would have the same starting point.


 On Mon, Mar 11, 2013 at 2:34 PM, Sekar, Sowmya sse...@ucsd.edu wrote:

 Is any version of Struts 1 (example : Struts 1.4) compatible with Tiles
 2.2.2.?

 Thanks, Sowmya

 -Original Message-
 From: paulus.benedic...@gmail.com [mailto:paulus.benedic...@gmail.com]
 On Behalf Of Paul Benedict
 Sent: Monday, March 11, 2013 1:15 PM
 To: Struts Users Mailing List
 Subject: Re: Struts 1.1 and Tiles 2 compatability

 Tiles 2 is not compatible with Struts 1. You must use Tiles 1.

 Paul

 On Mon, Mar 11, 2013 at 3:01 PM, Sekar, Sowmya sse...@ucsd.edu wrote:

  Hi,
 
  I am in the process of upgrading from Tiles 1 to Tiles 2.2.2 combined
  with Struts 1.1.
 
  I have the following configuration in struts-config.xml
 
  controller
  processorClass=org.apache.struts.tiles.TilesRequestProcessor/
 
plug-in className=org.apache.struts.tiles.TilesPlugin 
  set-property property=definitions-config
  value=/WEB-INF/tiles.xml/
  set-property property=moduleAware value=true /
  set-property property=definitions-parser-validate value=true /
/plug-in
 
  Below is the dtd configured in tiles.xml
 
  !DOCTYPE tiles-definitions PUBLIC
 -//Apache Software Foundation//DTD Tiles Configuration 2.0//EN
 http://tiles.apache.org/dtds/tiles-config_2_0.dtd;
 
  I have the tiles2.2.2 related jars(tiles-jsp, tiles-servlet,
  tiles-template, tiles-api, tiles-core) in my classpath and I use maven
  to import jars in my project
 
  When I start tomcat and display my page, I get the following error,
 
  Mar 11, 2013 12:54:52 PM
  org.apache.catalina.core.ApplicationDispatcher
  invoke
  SEVERE: Servlet.service() for servlet jsp threw exception
  org.apache.tiles.template.NoSuchAttributeException: Attribute 'topmenu'
  not found.
 at
 
 org.apache.tiles.template.DefaultAttributeResolver.computeAttribute(DefaultAttributeResolver.java:49)
 at
 
 org.apache.tiles.template.InsertAttributeModel.resolveAttribute(InsertAttributeModel.java:187)
 at
  org.apache.tiles.template.InsertAttributeModel.start(InsertAttributeMo
  del.java:107)
 
  It is not able to find any of the attributes in tiles.xml
 
  Any thoughts?
 
  Thanks,
  Sowmya
  sse...@ucsd.edu
 
 

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org





Re: Not setting instance member value in destination action using action chaining?

2013-03-02 Thread Ken McWilliams
This was already addressed on SO:
http://stackoverflow.com/questions/15159827/not-setting-instance-member-value-in-destination-action-using-action-chaining
We explained that chain was a result and that the chaining interceptor did
not process additional parameters and so they would not be included, if you
want empMode to be true then have it as a property of the action and set
it's value to true before chaining and the comments also covered it is
generally best to avoid chain if possible.

What is unclear?


On Sat, Mar 2, 2013 at 1:45 AM, Mohit Gupta motgu...@gmail.com wrote:

 This is my struts 2 flow where i am using action chaining

 JSP---Action1---Action2---ResultJsp

 With action chaining , my understanding is that request is forwarded from
 action1 to action2.So if i pass some parameter from action1 to action 2
 it should be set in new action instance variable(/value stack created for
 new action).But its not happening

 Below is my code in action1


 @Result(name = displayEmployee,type = chain,
 params = {
 namespace, /employee,
 actionName, Employee-lookup!search,
 empMode, true

 })


 @Action(display-employee!displayEmployee)
   public String displayEmployee() {
 return displayEmployee;
   }

 Now in Action 2 i.e display-employee , i have boolean property with name
 empMode. But i get the value as false though i should get it true
 because i am passing it as attribute in result annotation. As my
 understanding in action chaining, all request paramaters are
 forwarded from action1 to action2. Basically new value stack is created for
 action2 which contains the variables which were present
 in action1. So why value true is not set for empMode property in action 2?



Re: Not setting instance member value in destination action using action chaining?

2013-03-02 Thread Ken McWilliams
Not sure what you mean.


On Sat, Mar 2, 2013 at 2:58 AM, Mohit Gupta motgu...@gmail.com wrote:

 Ken one more thing can we use action chaining to forward the request to
 action which is not struts 2. i know action chaining shoukld be discourged
 but just exploring the options.

 On Sat, Mar 2, 2013 at 3:01 PM, Ken McWilliams ken.mcwilli...@gmail.com
 wrote:

  This was already addressed on SO:
 
 
 http://stackoverflow.com/questions/15159827/not-setting-instance-member-value-in-destination-action-using-action-chaining
  We explained that chain was a result and that the chaining interceptor
 did
  not process additional parameters and so they would not be included, if
 you
  want empMode to be true then have it as a property of the action and set
  it's value to true before chaining and the comments also covered it is
  generally best to avoid chain if possible.
 
  What is unclear?
 
 
  On Sat, Mar 2, 2013 at 1:45 AM, Mohit Gupta motgu...@gmail.com wrote:
 
   This is my struts 2 flow where i am using action chaining
  
   JSP---Action1---Action2---ResultJsp
  
   With action chaining , my understanding is that request is forwarded
 from
   action1 to action2.So if i pass some parameter from action1 to action 2
   it should be set in new action instance variable(/value stack created
 for
   new action).But its not happening
  
   Below is my code in action1
  
  
   @Result(name = displayEmployee,type = chain,
   params = {
   namespace, /employee,
   actionName, Employee-lookup!search,
   empMode, true
  
   })
  
  
   @Action(display-employee!displayEmployee)
 public String displayEmployee() {
   return displayEmployee;
 }
  
   Now in Action 2 i.e display-employee , i have boolean property with
 name
   empMode. But i get the value as false though i should get it true
   because i am passing it as attribute in result annotation. As my
   understanding in action chaining, all request paramaters are
   forwarded from action1 to action2. Basically new value stack is created
  for
   action2 which contains the variables which were present
   in action1. So why value true is not set for empMode property in action
  2?
  
 



Re: struts2 and WebSphere dynacache

2013-02-13 Thread Ken McWilliams
Even then the solution is very limited. The OP probably wants to cache all
popular pages/reports, in many cases the same action will be responsible...
a singleton clearly can't address that.

It could be addressed with an object pool that was keyed to actions,
parameters and values and managed by an interceptor. I think it would be
tricky to implement, particularly the promotion of which resources to the
cache and which objects to dispose of.


On Wed, Feb 13, 2013 at 2:22 AM, Antonios Gkogkakis gkogk...@tcd.ie wrote:

 On 13 February 2013 07:35, Lukasz Lenart lukaszlen...@apache.org wrote:

  2013/2/12 Antonios Gkogkakis gkogk...@tcd.ie:
   Assuming that caching of Action objects makes sense in your
 application,
   you could change the struts default object factory,
   to guice or spring and declare the  action beans that you want to be
  cached
   as singletons. Alternatively you could write your own object factory
 and
   put some caching logic there.
 
  It isn't a good practise to declare actions as singleton, Struts 2
  wasn't designed in that way. You really must know what are you doing
  :-)
 
  I'm with you on that one Lukasz that's way I said assuming... :)
 

 Antonios



Re: struts2 conventions plugin - how to override result type

2012-12-05 Thread Ken McWilliams
The right thing to do was override the ConventionsUnknownHandler like you
suggested. Right now the code is pretty ugly, I need to add unit tests to
my TilesUnknownHandler and then I wouldn't mind contributing it.

When the struts2-tiles-plugin is upgraded to account for tiles3 it would be
nice if it would check to see if the conventions plugin is in the class
path and then use then use the tiles result type by default (or if not by
default then as at least as an option).

Currently either the TilesUnknownHandler or the TilesResultType produces a
location of (namespace + # + file) and feeds that string as a tiles
definition:

definition name=REGEXP:(.*)#(.*)  extends=/test
put-attribute name=body value=/WEB-INF/content{1}/{2}/
/definition

The thing now is to define a convention for locating templates that makes
sense. Someway of dynamically generating tiles definitions from the content
under /WEB-INF.


On Wed, Nov 28, 2012 at 4:33 PM, Ken McWilliams ken.mcwilli...@gmail.comwrote:

 Sorry I wrote that before really looking the UnknownHandler, it is the
 right path.

 I'll get back with the results, and later I hope to have some questions
 about run time configuration (something I want to try is swapping the order
 of interceptors in a named stack at runtime).


 On Wed, Nov 28, 2012 at 1:08 PM, Lukasz Lenart lukaszlen...@apache.orgwrote:

 2012/11/26 Ken McWilliams ken.mcwilli...@gmail.com:
  I've yet to try this but how do I tie this into conventions.

 Just add
 bean type=UnknownHandler class=MyUnknownHandler
 name=myUnknownHandler/

  My issue is that I am following conventions, there are JSPs located as
  views for the action (that is, located where conventions would expect to
  find view). My idea is to create a tiles plugin that keeps struts
  conventions as near as possible to the way they are. That is the body
  content is always assumed to be at
  /WEB-INF/content/{package}/{conventions-action-name}.{viewType}
 
  So conventions will still have a valid result, so the UnknownHandler
 isn't
  ideal because conventions will think there is a valid result, unless
 there
  is some way to update the configuration even if it is to intentionally
  break it...
 
  Is it possible to do something like that with a custom ActionProxy?

 I don't know, just try and share your code :-)


 Regards
 --
 Łukasz
 + 48 606 323 122 http://www.lenart.org.pl/

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org





Re: struts2 conventions plugin - how to override result type

2012-11-28 Thread Ken McWilliams
Sorry I wrote that before really looking the UnknownHandler, it is the
right path.

I'll get back with the results, and later I hope to have some questions
about run time configuration (something I want to try is swapping the order
of interceptors in a named stack at runtime).


On Wed, Nov 28, 2012 at 1:08 PM, Lukasz Lenart lukaszlen...@apache.orgwrote:

 2012/11/26 Ken McWilliams ken.mcwilli...@gmail.com:
  I've yet to try this but how do I tie this into conventions.

 Just add
 bean type=UnknownHandler class=MyUnknownHandler
 name=myUnknownHandler/

  My issue is that I am following conventions, there are JSPs located as
  views for the action (that is, located where conventions would expect to
  find view). My idea is to create a tiles plugin that keeps struts
  conventions as near as possible to the way they are. That is the body
  content is always assumed to be at
  /WEB-INF/content/{package}/{conventions-action-name}.{viewType}
 
  So conventions will still have a valid result, so the UnknownHandler
 isn't
  ideal because conventions will think there is a valid result, unless
 there
  is some way to update the configuration even if it is to intentionally
  break it...
 
  Is it possible to do something like that with a custom ActionProxy?

 I don't know, just try and share your code :-)


 Regards
 --
 Łukasz
 + 48 606 323 122 http://www.lenart.org.pl/

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Struts2 Rest Plugin

2012-11-28 Thread Ken McWilliams
Just a guess but I want conventions like configuration extended though to
tiles results, a lot of the work is done in ConventionUnknownHandler, it
looks a bit tricky to keep that functionality without just copying it and
adding changes within that code. I'm guessing that is what they did.


On Wed, Nov 28, 2012 at 2:04 PM, Davis, Chad chad.da...@emc.com wrote:

 Hi!

 The docs for the REST plugin talk about how it builds on the Convention
 plugin ( sometimes it says code behind ).  However, I don't see that
 using the REST plugin pulls in either of these plugins . . . in what sense
 does it build on them?

 Thanks,
 Chad



Re: struts2 conventions plugin - how to override result type

2012-11-26 Thread Ken McWilliams
I've yet to try this but how do I tie this into conventions.

My issue is that I am following conventions, there are JSPs located as
views for the action (that is, located where conventions would expect to
find view). My idea is to create a tiles plugin that keeps struts
conventions as near as possible to the way they are. That is the body
content is always assumed to be at
/WEB-INF/content/{package}/{conventions-action-name}.{viewType}

So conventions will still have a valid result, so the UnknownHandler isn't
ideal because conventions will think there is a valid result, unless there
is some way to update the configuration even if it is to intentionally
break it...

Is it possible to do something like that with a custom ActionProxy?

Maybe there is a way to create a preresult listener for all conventions,
that somehow does the job of a result handler and then aborts the real
result handler?


On Mon, Nov 26, 2012 at 1:20 PM, Lukasz Lenart lukaszlen...@apache.orgwrote:

 Hi,

 There is no easy way right now, you can try to implement
 UnknownHandler or at least extend ConventionUnknownHandler and
 override handleUnknownResult() method


 Regards
 --
 Łukasz
 + 48 606 323 122 http://www.lenart.org.pl/


 2012/11/24 Ken McWilliams ken.mcwilli...@gmail.com:
  Using struts2-convention-plugin-2.3.1.2 currently.
 
  I want conventions to still automatically find my actions, that is
  determine  struts2 packages from java package structure and Identify
 action
  names from Java Action classes, but I want it to stop there I want it to
  universally use my custom result type for all actions.
 
  So far I have tried the following:
 
  1) Explicitly setting the conventions parent package
  constant name=struts.convention.default.parent.package
  value=tiles-package/
 
  2) Configuring that package with my result as the default
 
  package  name=tiles-package extends=convention-default
  result-types
  result-type default=true name=tiles
  class=com.kenmcwilliams.tiles.result.TilesResult/
  /result-types
  /package
 
  So far I can only get my result to take effect if I override conventions
  with annotations.
 
  So far the following works:
 
  package com.kenmcwilliams.employmentsystem.action.test;
 
  import com.opensymphony.xwork2.ActionSupport;
  import org.apache.struts2.convention.annotation.Result;
 
  @Result(type=tiles)
  public class TilesAction extends ActionSupport{
 
  }
 
  The tiles result checks the location parameter which if not specified in
  the result annotation it will look up the namespace and action name, then
  using tiles regexp convention can be carried on through tiles.
 
  My current issue is dropping the need for '
  @Result(type=tiles)' on every class. Any advice?
 
  Further I've created my own ConventionsServiceImpl if that helps, all it
  currently does is print incoming parameters and return values to logs. I
  haven't really been able to figure out what I can use it for.

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Load Struts2 configuration from DB

2012-11-13 Thread Ken McWilliams
If struts fails to find the action configuration it will try to use an
instance of com.opensymphony.xwork2.UnknownHandlerManager to create a valid
configuration. So this seems like the extension point I need.


On Tue, Nov 13, 2012 at 12:38 AM, Ken McWilliams
ken.mcwilli...@gmail.comwrote:

 I thought it would be interesting if I could create an interceptor stack
 from already defined interceptors and store that definition in a database.
 I also wanted to store action mappings (packages, actionName, method) along
 with the name of the class which was to be associated with the action.

 Anyways I'm a bit stuck...

 First I thought I would create an DynamicInterceptorInterceptor which
 would maintain it's own configuration and call the interceptors in turn.
 But I think ActionProxy and ActionInvocation are supposed to be doing
 something when calling Interceptors so that probably isn't good, and all
 actions would target DynamicActionAction... this too I think has problems.

 Then I though well if ActionProxy manages all the calls to the interceptor
 and Action I could hide some configuration in there (by creating my own
 ActionProxyFactory). If the actionProxy signature (ActionInvocation inv,
 String namespace, String actionName, String methodName,
 boolean executeResult, boolean cleanupContext) matches one for
 my magic DB action then I'll simply trick all the calls to invoke what
 needs to be invoked using some special logic.

 I'm not that familiar with struts2 thinking but it seems like this
 solution would be quite ugly. What would be most ideal is to create a user
 defined ConfigurationProvider which augments the existing configuration
 with additional configuration.

 Any advice?

 For fun I was thinking if I could get that working I could make a web
 based UI to edit Struts2 configuration (just the interceptor stack for
 now), save that and reload the configuration. That would be pretty neat. If
 it could then write a proper struts.xml file that would be pretty cool too.

 Anyways this isn't for production, this is to better understand the
 framework and do something interesting.



Re: How to implement custom ActionProxyFactory

2012-11-12 Thread Ken McWilliams
Thank you Łukasz! Knew it should be obvious... embarrassingly obvious. I'll
start a new thread concerning what I'd like to do with it, to seek advice.


On Mon, Nov 12, 2012 at 1:14 AM, Łukasz Lenart lukasz.len...@gmail.comwrote:

 Hi,

 bean type=com.opensymphony.xwork2.ActionProxyFactory
 name=myProxyFactory
 class=org.apache.struts2.impl.MyActionProxyFactory/
 constant name=struts.actionProxyFactory value=myProxyFactory/

 http://struts.apache.org/2.x/docs/plugins.html#Plugins-ExtensionPoints


 Regards
 --
 Łukasz
 mobile +48 606 323 122 http://www.lenart.org.pl/
 Warszawa JUG conference - Confitura http://confitura.pl/

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Load Struts2 configuration from DB

2012-11-12 Thread Ken McWilliams
I thought it would be interesting if I could create an interceptor stack
from already defined interceptors and store that definition in a database.
I also wanted to store action mappings (packages, actionName, method) along
with the name of the class which was to be associated with the action.

Anyways I'm a bit stuck...

First I thought I would create an DynamicInterceptorInterceptor which would
maintain it's own configuration and call the interceptors in turn. But I
think ActionProxy and ActionInvocation are supposed to be doing something
when calling Interceptors so that probably isn't good, and all actions
would target DynamicActionAction... this too I think has problems.

Then I though well if ActionProxy manages all the calls to the interceptor
and Action I could hide some configuration in there (by creating my own
ActionProxyFactory). If the actionProxy signature (ActionInvocation inv,
String namespace, String actionName, String methodName,
boolean executeResult, boolean cleanupContext) matches one for
my magic DB action then I'll simply trick all the calls to invoke what
needs to be invoked using some special logic.

I'm not that familiar with struts2 thinking but it seems like this solution
would be quite ugly. What would be most ideal is to create a user defined
ConfigurationProvider which augments the existing configuration with
additional configuration.

Any advice?

For fun I was thinking if I could get that working I could make a web based
UI to edit Struts2 configuration (just the interceptor stack for now), save
that and reload the configuration. That would be pretty neat. If it could
then write a proper struts.xml file that would be pretty cool too.

Anyways this isn't for production, this is to better understand the
framework and do something interesting.


Re: [Struts2] SessionToken Interceptor used with json Result and Javascript Calls

2012-11-07 Thread Ken McWilliams
Can you share the interceptor stack configuration for your normal JSP's and
the stack configuration for the json actions?


On Wed, Nov 7, 2012 at 5:37 AM, Jan Fröhlich jan.froehl...@infomotion.dewrote:

 Hi...

 I try to secure one of my web applications with tokens.
 Everything works fine with basic jsp pages. But in one case, I call an
 action from javascript via jquery.ajax and return a json result.

 To do that, I added two properties to the json result object
 (documenTable) with token and tokenName and populate them in the action with
 documentTable.setTokenName(TokenHelper.getTokenName());
 documentTable.setToken(TokenHelper.getToken());

 The Javascript that gets the result object (data) looks like this:
 var submitData = {
 documentID : documentRow.documentID,
 showMessage : true
 };
 submitData[data.tokenName] = data.token;
 tdName.bind(click, function() {
 $.ajax({
 url : view,
 type: 'POST',
 data : submitData,
 success : function() {
 ...
 }
 });

 When the click event is fired, the parameters struts.token.name and
 struts.token are submitted with the request but the action returns
 invalid.token.

 Is that a way I can go? Is the TokenHelper the right thing to get a new
 valid token from?

 Any hints welcome!

 Regards
 Jan




Re: [Struts 2] How do I migrate an action with no result name to an annotation?

2012-11-02 Thread Ken McWilliams
Since you are using annotations I assume you are using the
struts2-conventions-plugin? If so, then the package structure after
struts2 or action is taken to be the namespace. If this is not the case
then you would need to override it.


On Fri, Nov 2, 2012 at 1:55 PM, John Boyer j...@rodaxsoft.com wrote:

 Hi Jeff:

 In the struts.xml, the namespace is / and the package is default.

 package name=default extends=struts-default namespace=/
 ...

 Do I need add this info as annotations to all my action classes?

 Thanks,

 John


 On Nov 2, 2012, at 12:11 PM, Jeff Black jeffrey.bl...@yahoo.com wrote:

  Double-check your namespace.  What is the class-name of your action and
 the package?
 
  Jeff
 
 
 
  
  From: John Boyer j...@rodaxsoft.com
  To: Struts Users Mailing List user@struts.apache.org
  Sent: Friday, November 2, 2012 10:53 AM
  Subject: [Struts 2] How do I migrate an action with no result name to an
 annotation?
 
  Hi:
 
  I'm trying to move all of my action configurations out of the struts.xml
 file into annotations. For the most part it's working fine. Yet, for my
 actions that have results with no 'name' parameter it doesn't work. For
 example, the following entry in my XML works perfectly.
 
action name=start
  result/WEB-INF/jsp/register.jsp/result
 /action
 
  However, when move this entry to my action class it doesn't work. I get
 an No result defined for action...and result input error. What am I doing
 wrong? I feel like I'm missing some fundamental concept here. My SUCCESS
 and INPUT results work as expected.
 
  @Action(value = start, results =
 @Result(location=/WEB-INF/jsp/register.jsp))
 
  Thank you,
 
  John Boyer
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: [Struts 2] How do I migrate an action with no result name to an annotation?

2012-11-02 Thread Ken McWilliams
I don't understand, your result always has a name. The default is success
and the type is by default dispatcher. So when you simply write
result/WEB-INF/jsp/myPage.
jsp/result those are implied.


On Fri, Nov 2, 2012 at 3:27 PM, John Boyer j...@rodaxsoft.com wrote:

 Hi Jeff:

 Yes, I'm using the plugin. Unfortunately, the documentation isn't really
 helping or I'm missing some fundamental concept. Again, all my other
 annotations work fine (INPUT, ERROR, SUCCESS) except for the action
 described in this reply.

 To clarify, what I'd love to see is a simple example of how to migrate
 myAction, which has a result with no name from the default package and
 namespace in the struts.xml into an annotation. Is this possible or does
 this always need to stay in the struts.xml? This is the crux of my problem.
 Thank you for your help.

 package name=default extends=struts-default namespace=/

 action name=myAction
  result/WEB-INF/jsp/myPage.jsp/result
 /action
 ...

 John

 On Nov 2, 2012, at 1:25 PM, Jeff Black jeffrey.bl...@yahoo.com wrote:

  Hey there John.
 
  Are you using the Convention plugin?
 
  What is the classname of your action (e.g.,
 org.blackj.common.action.TestAction.java)?
 
  Jeff
 
 
 
 
  
  From: John Boyer j...@rodaxsoft.com
  To: Struts Users Mailing List user@struts.apache.org; Jeff Black 
 jeffrey.bl...@yahoo.com
  Sent: Friday, November 2, 2012 2:55 PM
  Subject: Re: [Struts 2] How do I migrate an action with no result name
 to an annotation?
 
  Hi Jeff:
 
  In the struts.xml, the namespace is / and the package is default.
 
  package name=default extends=struts-default namespace=/
  ...
 
  Do I need add this info as annotations to all my action classes?
 
  Thanks,
 
  John
 
 
  On Nov 2, 2012, at 12:11 PM, Jeff Black jeffrey.bl...@yahoo.com wrote:
 
  Double-check your namespace.  What is the class-name of your action and
 the package?
 
  Jeff
 
 
 
  
  From: John Boyer j...@rodaxsoft.com
  To: Struts Users Mailing List user@struts.apache.org
  Sent: Friday, November 2, 2012 10:53 AM
  Subject: [Struts 2] How do I migrate an action with no result name to
 an annotation?
 
  Hi:
 
  I'm trying to move all of my action configurations out of the
 struts.xml file into annotations. For the most part it's working fine. Yet,
 for my actions that have results with no 'name' parameter it doesn't work.
 For example, the following entry in my XML works perfectly.
 
 action name=start
   result/WEB-INF/jsp/register.jsp/result
  /action
 
  However, when move this entry to my action class it doesn't work. I get
 an No result defined for action...and result input error. What am I doing
 wrong? I feel like I'm missing some fundamental concept here. My SUCCESS
 and INPUT results work as expected.
 
  @Action(value = start, results =
 @Result(location=/WEB-INF/jsp/register.jsp))
 
  Thank you,
 
  John Boyer
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: [Struts 2] How do I migrate an action with no result name to an annotation?

2012-11-02 Thread Ken McWilliams
Oh and please provide the full class name including package. You must have
your action in a package that _ends_ with action or struts2 (or struts
I think). Otherwise the package structure which follows that string will be
interpreted as part of the package structure.


On Fri, Nov 2, 2012 at 3:55 PM, Ken McWilliams ken.mcwilli...@gmail.comwrote:

 I don't understand, your result always has a name. The default is
 success and the type is by default dispatcher. So when you simply write
 result/WEB-INF/jsp/myPage.
 jsp/result those are implied.


 On Fri, Nov 2, 2012 at 3:27 PM, John Boyer j...@rodaxsoft.com wrote:

 Hi Jeff:

 Yes, I'm using the plugin. Unfortunately, the documentation isn't really
 helping or I'm missing some fundamental concept. Again, all my other
 annotations work fine (INPUT, ERROR, SUCCESS) except for the action
 described in this reply.

 To clarify, what I'd love to see is a simple example of how to migrate
 myAction, which has a result with no name from the default package and
 namespace in the struts.xml into an annotation. Is this possible or does
 this always need to stay in the struts.xml? This is the crux of my problem.
 Thank you for your help.

 package name=default extends=struts-default namespace=/

 action name=myAction
  result/WEB-INF/jsp/myPage.jsp/result
 /action
 ...

 John

 On Nov 2, 2012, at 1:25 PM, Jeff Black jeffrey.bl...@yahoo.com wrote:

  Hey there John.
 
  Are you using the Convention plugin?
 
  What is the classname of your action (e.g.,
 org.blackj.common.action.TestAction.java)?
 
  Jeff
 
 
 
 
  
  From: John Boyer j...@rodaxsoft.com
  To: Struts Users Mailing List user@struts.apache.org; Jeff Black 
 jeffrey.bl...@yahoo.com
  Sent: Friday, November 2, 2012 2:55 PM
  Subject: Re: [Struts 2] How do I migrate an action with no result name
 to an annotation?
 
  Hi Jeff:
 
  In the struts.xml, the namespace is / and the package is default.
 
  package name=default extends=struts-default namespace=/
  ...
 
  Do I need add this info as annotations to all my action classes?
 
  Thanks,
 
  John
 
 
  On Nov 2, 2012, at 12:11 PM, Jeff Black jeffrey.bl...@yahoo.com
 wrote:
 
  Double-check your namespace.  What is the class-name of your action
 and the package?
 
  Jeff
 
 
 
  
  From: John Boyer j...@rodaxsoft.com
  To: Struts Users Mailing List user@struts.apache.org
  Sent: Friday, November 2, 2012 10:53 AM
  Subject: [Struts 2] How do I migrate an action with no result name to
 an annotation?
 
  Hi:
 
  I'm trying to move all of my action configurations out of the
 struts.xml file into annotations. For the most part it's working fine. Yet,
 for my actions that have results with no 'name' parameter it doesn't work.
 For example, the following entry in my XML works perfectly.
 
 action name=start
   result/WEB-INF/jsp/register.jsp/result
  /action
 
  However, when move this entry to my action class it doesn't work. I
 get an No result defined for action...and result input error. What am I
 doing wrong? I feel like I'm missing some fundamental concept here. My
 SUCCESS and INPUT results work as expected.
 
  @Action(value = start, results =
 @Result(location=/WEB-INF/jsp/register.jsp))
 
  Thank you,
 
  John Boyer
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org





Re: [Struts 2] How do I migrate an action with no result name to an annotation?

2012-11-02 Thread Ken McWilliams
Oh! With conventions you don't write any annotations! Simply create
/WEB-INF/content/my-action.jsp then the action my-action will be found.
You should stick to actions with hyphens as that is what conventions
expects.

You can't replace all of struts.xml with annotations. What Jeff proposes
would work but, annotations work on code... in this case it does not makes
sense to create code. So stick with the conventions, or use struts.xml.


On Fri, Nov 2, 2012 at 4:03 PM, Jeff Black jeffrey.bl...@yahoo.com wrote:

 John -- My wife accuses me of being dense all the time so forgive me.


 I infer from your comments that you are using a pass-through action to
 your jsp -- correct?

 If that is true, this works for me just fine:

 @Action(value = start,
 results = @Result(location = /WEB-INF/testresult.jsp))
 public String dummy() {
 return SUCCESS;
 }

 A quote from the result-documentation[1]:

 * Likewise if the name attribute is not specified, the
 framework will give it the name success.
 [1] http://struts.apache.org/2.3.1/docs/result-configuration.html



 
  From: John Boyer j...@rodaxsoft.com
 To: Struts Users Mailing List user@struts.apache.org; Jeff Black 
 jeffrey.bl...@yahoo.com
 Sent: Friday, November 2, 2012 4:27 PM
 Subject: Re: [Struts 2] How do I migrate an action with no result name to
 an annotation?

 Hi Jeff:

 Yes, I'm using the plugin. Unfortunately, the documentation isn't really
 helping or I'm missing some fundamental concept. Again, all my other
 annotations work fine (INPUT, ERROR, SUCCESS) except for the action
 described in this reply.

 To clarify, what I'd love to see is a simple example of how to migrate
 myAction, which has a result with no name from the default package and
 namespace in the struts.xml into an annotation. Is this possible or does
 this always need to stay in the struts.xml? This is the crux of my problem.
 Thank you for your help.

 package name=default extends=struts-default namespace=/

 action name=myAction
  result/WEB-INF/jsp/myPage.jsp/result
 /action
 ...

 John

 On Nov 2, 2012, at 1:25 PM, Jeff Black jeffrey.bl...@yahoo.com wrote:

  Hey there John.
 
  Are you using the Convention plugin?
 
  What is the classname of your action (e.g.,
 org.blackj.common.action.TestAction.java)?
 
  Jeff
 
 
 
 
  
  From: John Boyer j...@rodaxsoft.com
  To: Struts Users Mailing List user@struts.apache.org; Jeff Black 
 jeffrey.bl...@yahoo.com
  Sent: Friday, November 2, 2012 2:55 PM
  Subject: Re: [Struts 2] How do I migrate an action with no result name
 to an annotation?
 
  Hi Jeff:
 
  In the struts.xml, the namespace is / and the package is default.
 
  package name=default extends=struts-default namespace=/
  ...
 
  Do I need add this info as annotations to all my action classes?
 
  Thanks,
 
  John
 
 
  On Nov 2, 2012, at 12:11 PM, Jeff Black jeffrey.bl...@yahoo.com wrote:
 
  Double-check your namespace.  What is the class-name of your action and
 the package?
 
  Jeff
 
 
 
  
  From: John Boyer j...@rodaxsoft.com
  To: Struts Users Mailing List user@struts.apache.org
  Sent: Friday, November 2, 2012 10:53 AM
  Subject: [Struts 2] How do I migrate an action with no result name to
 an annotation?
 
  Hi:
 
  I'm trying to move all of my action configurations out of the
 struts.xml file into annotations. For the most part it's working fine. Yet,
 for my actions that have results with no 'name' parameter it doesn't work.
 For example, the following entry in my XML works perfectly.
 
 action name=start
   result/WEB-INF/jsp/register.jsp/result
  /action
 
  However, when move this entry to my action class it doesn't work. I get
 an No result defined for action...and result input error. What am I doing
 wrong? I feel like I'm missing some fundamental concept here. My SUCCESS
 and INPUT results work as expected.
 
  @Action(value = start, results =
 @Result(location=/WEB-INF/jsp/register.jsp))
 
  Thank you,
 
  John Boyer
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org



RE: getText in error messages: resource bundle or bean value?

2012-10-19 Thread Hoying, Ken
I believe that your problem is that the field names are the same as your label 
names and with the validator both are in the stack. ${getText(user.password)} 
is first evaluating user.password and finding the field value 1234.  getText 
is then trying to locate an entry for 1234 and cannot find one so it is just 
return 1234.

It might work if you try ${getText('user.password')}.  Otherwise, you may need 
to rename it.

-Original Message-
From: J. Garcia [mailto:jogaco...@gmail.com] 
Sent: Friday, October 19, 2012 8:10 AM
To: Struts Users Mailing List
Subject: getText in error messages: resource bundle or bean value?

Hi,
I'm having a problem with getText().
I have the following xml validator:

field name=user.confirmPassword
field-validator type=requiredstring
message key=errors.required/
/field-validator
field-validator type=fieldexpression
param name=expression
(user.confirmPassword.equals(user.password))
/param
message key=errors.confirmPassSame/
/field-validator
/field

And the error message is defined in a bundle like this:
errors.confirmPassSame=The ${getText(user.confirmPassword)} field has to
have the same value as the ${getText(user.password)} field.
...
user.confirmPassword=Confirm Password
user.password=Password

I would expect a message like:
The Confirm Password field has to have the same value as the Password field.

However, when the error message is shown, instead of the text from the
resource bundle, what is shown are the actual values of the bean, like this:
The abcd field has to have the same value as the 1234 field.

Is this a bug in getText()?

Cheers,
J. Garcia

-
***Note:The information contained in this message may be privileged and 
confidential and protected from disclosure. If the reader of this message is 
not the intended recipient, or an employee or agent responsible for delivering 
this message to the intended recipient, you are hereby notified that any 
dissemination, distribution or copying of this communication is strictly 
prohibited.  If you have received this communication in error, please notify 
the Sender immediately by replying to the message and deleting it from your 
computer.  Thank you.  Premier Inc.



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: how to write json/xml output using struts 2 and rest + convention plugin

2012-10-04 Thread Ken McWilliams
I'm not familiar with this application but simply look at the
documentation for the struts2-json-plugin, you can specify a json
result and you can specify include and exclude parameters (so you just
return the part(s) of your Action you want). In this way you could
define a new map, put a key of results with a value of New order
created successfully and return it quite easily. If the struts2
document is insufficient there are plenty of examples also on
StackOverflow, so take a look there too (Including many annotation
based examples).

On Thu, Oct 4, 2012 at 4:21 PM, Jane Wayne jane.wayne2...@gmail.com wrote:
 i've downloaded the demo apps for struts 2 v2.3.5 SNAPSHOT for today.
 i am trying to understand and study the rest struts2-rest-showcase
 webapp.

 in the rest showcase, the OrdersController class has the following method.

 public String editNew() {
  model = new Order();
  return editNew;
 }

 the user is taken to orders-editNew.jsp. on this page, the form posts
 to: action=%{#request.contextPath}/orders. the action to handle this
 form is as follows.

 public HttpHeaders create() {
  ordersService.save(model);
  addActionMessage(New order created successfully);
  return new DefaultHttpHeaders(success).setLocationId(model.getId());
 }

 at this point, the user is taken to orders-index.jsp. however, i do
 not want to take the user to this page. i instead want to write a
 JSON/XML message back saying something (just like the action message)
 to indicate success/failure. how do i do this?

 i imagine my client application posting data to: /orders/new
 and then receiving some JSON message:
 { results : New order created successfully }

 any help is appreciated.

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Struts2 authentication, validation, and roles

2012-10-02 Thread Ken McWilliams
Asking for the consideration of a struts2 feature enhancement.

The roles interceptor depends on container based security, it is a bit
of a pain to set up and portability is complicated by needing to cover
more documentation steps (how to secure your application on Glassfish,
Weblogic, Tomcat...). This is container security and of course not
Struts2s issue but it would be nice it we could use the roles
interceptor by defining a
org.apache.struts2.interceptor.PrincipalProxy implementation and
specifying it with a struts2 constant:

constant name=struts.security.principalProxy
value=com.example.MyPrincipalProxyImpl/ //default would be
org.apache.struts2.servlet.interceptor.ServletPrincipalProxy

There is only a few place (that I know of) where the PrincipalProxy
interface aught to be used where currently the request is being used
(aught to be used if implementing this feature). That is in the
servletConfig interceptor when setting the PrincipalAware interface
of an action and in the roles interceptor.

It is not too much work to implement our own interceptors to
facilitate role based access but I think this would be helpful to many
and does not seem to require a radical change to S2 internals, so I
thought I would bring this up in the user forum to see what others
think.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Struts2 annotation with parameter when using json plugin

2012-09-13 Thread Ken McWilliams
Simply I want to evaluate a property of my action and use it's value
within an annotation. The following is exactly where I want to use it:

I want to define a excludeProperties parameter at run time.

Consider the following annotation which currently works on the action:
@Result(name = success, type = json, params = {root, model,
excludeProperties, myCollection})

There the actions model has a myCollection collection which I do not
want serialized.

However I would like to create an exclusion String (a string will do for now).

If I create a getter setter for exclusion, I would expect the
following annotation to work (which does not):

@Result(name = success, type = json, params = {root, model,
excludeProperties, ${exclusion}})

Any ideas?

I am using the named variable pattern matcher to extract values from
the namespace if that matters, I think it should just affect request
parameters.

I really want to dynamically set the exclude properties of the result.
I have not tried with XML yet, but shouldn't think it would be
different. Is is possible to directly create and set the methods of
the result type? Because that could be another option.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts 2 Initialization Plugin

2011-11-10 Thread Ken McWilliams
The better solution is dependency injection with Spring, use the
struts2-spring-plugin.

On Thu, 2011-11-10 at 15:09 -0500, Eric Reed wrote:
 You should have an initialization servlet run at startup that can create such 
 an object.
 
 
  Scott Smith ssm...@mainstreamdata.com 11/10/2011 3:06 PM 
 In struts 1, I used org.apache.struts.action.PlugIn as a way to create an 
 object at web app startup and put it into the application context so that all 
 sessions had access to it.  What's the equivalent method in Struts2?  That 
 is, how can I have an object created at web application startup.
 
 I guess the alternative is lazy initialization (first guy who tries to access 
 it and doesn't find it, creates it, and saves it into the app context; down 
 side is I might end up with several sessions trying to create it until one 
 finally makes it to the app context).
 
 Any better solutions?
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 





-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts 2 Initialization Plugin

2011-11-10 Thread Ken McWilliams
The better solution is dependency injection with Spring, use the
struts2-spring-plugin.

On Thu, 2011-11-10 at 15:09 -0500, Eric Reed wrote:
 You should have an initialization servlet run at startup that can create such 
 an object.
 
 
  Scott Smith ssm...@mainstreamdata.com 11/10/2011 3:06 PM 
 In struts 1, I used org.apache.struts.action.PlugIn as a way to create an 
 object at web app startup and put it into the application context so that all 
 sessions had access to it.  What's the equivalent method in Struts2?  That 
 is, how can I have an object created at web application startup.
 
 I guess the alternative is lazy initialization (first guy who tries to access 
 it and doesn't find it, creates it, and saves it into the app context; down 
 side is I might end up with several sessions trying to create it until one 
 finally makes it to the app context).
 
 Any better solutions?
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts2-json-plugin serialization issue with a Hibernate backed JPA entity

2011-09-07 Thread Ken McWilliams
Solved! I've seen a number of posts relating to this issue but none with
solutions...

In searching for how $JAVASSIST_READ_WRITE_HANDLER came into existence
we find:
http://www.docjar.com/html/api/org/hibernate/tool/instrument/javassist/FieldTransformer.java.html


There we can see the getter for $JAVASSIST_READ_WRITE_HANDLER is
actually getFieldHandler so the exclude parameter becomes:

@Action(value = list-clients, results = {
@Result(type = json, params = {
excludeProperties,
^list\\[.*\\]\\.fieldHandler\\..*
})
})

And it all works... 

Just tested the shorter .*\\.fieldHandler\\..* and it works too, which
is much better because now there is one solution for all such
instrumented entities!  
 
On Tue, 2011-09-06 at 22:20 -0600, Ken McWilliams wrote:
 I have a JPA entity, which hibernate is proxying.  
 
 The following action works as it explicitly states the properties to
 include, however what I would much rather do is use excludeProperties to
 remove the problematic property. The problem property when serialized
 causes a Positioned Update not supported exception.
 
 The interesting thing is, all the properties on the entity class are
 persisted correctly if explicitly included.
 
 Looking in the  the debugger shows there is a property called
 $JAVASSIST_READ_WRITE_HANDLER of type FieldInterceptorImpl which
 Hibernate/JPA adds to the entity. I'm pretty sure this is what is
 causing it to fail.
 
 
 I've tried the following: 
 @Action(value = list-clients, results = {
 @Result(type = json, params = {
 excludeProperties,
 list\\[.*\\]\\.\\$JAVASSIST_READ_WRITE_HANDLER.*
 })
 })
 
 but with no luck.  Following is my action and the entity class.
 
  
 
 Here is my action (In a _working_ state):
 /
 @ParentPackage(json-default)
 @Result(type = json)
 public class ListTable extends ActionSupport {
 
 @EJB
 private ClientService clientService;
 private List list;
 
 @Action(value = list-clients, results = {
 @Result(type = json, params = {
 includeProperties,
 list\\[.*\\]\\.name, list\\[.*\\]\\.id, list\\[.*\\]\
 \.timelogCollection\\..* 
 })
 })
 public String listClients() {
 list = clientService.list();
 return SUCCESS;
 }
 
 public List getList() {
 return list;
 }
 }
 /
 
 Here is the entity:
 /
 @Entity
 @Table(name = client)
 @XmlRootElement
 @NamedQueries({
 @NamedQuery(name = Client.findAll, query = SELECT c FROM Client
 c),
 @NamedQuery(name = Client.findById, query = SELECT c FROM Client
 c WHERE c.id = :id),
 @NamedQuery(name = Client.findByName, query = SELECT c FROM
 Client c WHERE c.name = :name)})
 public class Client implements Serializable {
 private static final long serialVersionUID = 1L;
 @Id
 @GeneratedValue(strategy = GenerationType.IDENTITY)
 @Basic(optional = false)
 @NotNull
 @Column(name = id)
 private Integer id;
 @Size(max = 45)
 @Column(name = name)
 private String name;
 @OneToMany(cascade = CascadeType.ALL, mappedBy = clientId)
 private CollectionTimelog timelogCollection;
 
 public Client() {
 }
 
 public Client(Integer id) {
 this.id = id;
 }
 
 public Integer getId() {
 return id;
 }
 
 public void setId(Integer id) {
 this.id = id;
 }
 
 public String getName() {
 return name;
 }
 
 public void setName(String name) {
 this.name = name;
 }
 
 @XmlTransient
 public CollectionTimelog getTimelogCollection() {
 return timelogCollection;
 }
 
 public void setTimelogCollection(CollectionTimelog
 timelogCollection) {
 this.timelogCollection = timelogCollection;
 }
 
 @Override
 public int hashCode() {
 int hash = 0;
 hash += (id != null ? id.hashCode() : 0);
 return hash;
 }
 
 @Override
 public boolean equals(Object object) {
 // TODO: Warning - this method won't work in the case the id
 fields are not set
 if (!(object instanceof Client)) {
 return false;
 }
 Client other = (Client) object;
 if ((this.id == null  other.id != null) || (this.id != null
  !this.id.equals(other.id))) {
 return false;
 }
 return true;
 }
 
 @Override
 public String toString() {
 return com.aerose.kentimekeeper.db.Client[ id= + id +  ];
 }
 
 }
 /
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 




-
To unsubscribe, e-mail: user-unsubscr

Re: Struts2-json-plugin serialization issue with a Hibernate backed JPA entity

2011-09-07 Thread Ken McWilliams
I need the root object to be list so this isn't going to help.

I'm pretty sure it is not trying to serialize the EJB service, the json
plugin will only try to serialize properties which have getters. 

According the debugger there seems to be a public property directly in
the entity called $JAVASSIST_READ_WRITE_HANDLER, I'm quite confident
that is in the attempt to serialize this object the issue occurs.

To be extra sure I set list as the root and the issue still occurs. 

On Wed, 2011-09-07 at 07:59 +0200, Maurizio Cucchiara wrote:
 You might take a look at [1], particoularly the section called root
 object.
 That's because I'm afraid that json plugin is trying to serialize your EJB
 service.
 HTH
 
 [1] struts.apache.org/2.2.3/docs/json-plugin.html
 
 Maurizio Cucchiara
 
 Il giorno 07/set/2011 07.43, Ken McWilliams ken.mcwilli...@gmail.com ha
 scritto:
  I have a JPA entity, which hibernate is proxying.
 
  The following action works as it explicitly states the properties to
  include, however what I would much rather do is use excludeProperties to
  remove the problematic property. The problem property when serialized
  causes a Positioned Update not supported exception.
 
  The interesting thing is, all the properties on the entity class are
  persisted correctly if explicitly included.
 
  Looking in the the debugger shows there is a property called
  $JAVASSIST_READ_WRITE_HANDLER of type FieldInterceptorImpl which
  Hibernate/JPA adds to the entity. I'm pretty sure this is what is
  causing it to fail.
 
 
  I've tried the following:
  @Action(value = list-clients, results = {
  @Result(type = json, params = {
  excludeProperties,
  list\\[.*\\]\\.\\$JAVASSIST_READ_WRITE_HANDLER.*
  })
  })
 
  but with no luck. Following is my action and the entity class.
 
 
 
  Here is my action (In a _working_ state):
  /
  @ParentPackage(json-default)
  @Result(type = json)
  public class ListTable extends ActionSupport {
 
  @EJB
  private ClientService clientService;
  private List list;
 
  @Action(value = list-clients, results = {
  @Result(type = json, params = {
  includeProperties,
  list\\[.*\\]\\.name, list\\[.*\\]\\.id, list\\[.*\\]\
  \.timelogCollection\\..*
  })
  })
  public String listClients() {
  list = clientService.list();
  return SUCCESS;
  }
 
  public List getList() {
  return list;
  }
  }
  /
 
  Here is the entity:
  /
  @Entity
  @Table(name = client)
  @XmlRootElement
  @NamedQueries({
  @NamedQuery(name = Client.findAll, query = SELECT c FROM Client
  c),
  @NamedQuery(name = Client.findById, query = SELECT c FROM Client
  c WHERE c.id = :id),
  @NamedQuery(name = Client.findByName, query = SELECT c FROM
  Client c WHERE c.name = :name)})
  public class Client implements Serializable {
  private static final long serialVersionUID = 1L;
  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Basic(optional = false)
  @NotNull
  @Column(name = id)
  private Integer id;
  @Size(max = 45)
  @Column(name = name)
  private String name;
  @OneToMany(cascade = CascadeType.ALL, mappedBy = clientId)
  private CollectionTimelog timelogCollection;
 
  public Client() {
  }
 
  public Client(Integer id) {
  this.id = id;
  }
 
  public Integer getId() {
  return id;
  }
 
  public void setId(Integer id) {
  this.id = id;
  }
 
  public String getName() {
  return name;
  }
 
  public void setName(String name) {
  this.name = name;
  }
 
  @XmlTransient
  public CollectionTimelog getTimelogCollection() {
  return timelogCollection;
  }
 
  public void setTimelogCollection(CollectionTimelog
  timelogCollection) {
  this.timelogCollection = timelogCollection;
  }
 
  @Override
  public int hashCode() {
  int hash = 0;
  hash += (id != null ? id.hashCode() : 0);
  return hash;
  }
 
  @Override
  public boolean equals(Object object) {
  // TODO: Warning - this method won't work in the case the id
  fields are not set
  if (!(object instanceof Client)) {
  return false;
  }
  Client other = (Client) object;
  if ((this.id == null  other.id != null) || (this.id != null
   !this.id.equals(other.id))) {
  return false;
  }
  return true;
  }
 
  @Override
  public String toString() {
  return com.aerose.kentimekeeper.db.Client[ id= + id +  ];
  }
 
  }
  /
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Struts2-json-plugin serialization issue with a Hibernate backed JPA entity

2011-09-06 Thread Ken McWilliams
I have a JPA entity, which hibernate is proxying.  

The following action works as it explicitly states the properties to
include, however what I would much rather do is use excludeProperties to
remove the problematic property. The problem property when serialized
causes a Positioned Update not supported exception.

The interesting thing is, all the properties on the entity class are
persisted correctly if explicitly included.

Looking in the  the debugger shows there is a property called
$JAVASSIST_READ_WRITE_HANDLER of type FieldInterceptorImpl which
Hibernate/JPA adds to the entity. I'm pretty sure this is what is
causing it to fail.


I've tried the following: 
@Action(value = list-clients, results = {
@Result(type = json, params = {
excludeProperties,
list\\[.*\\]\\.\\$JAVASSIST_READ_WRITE_HANDLER.*
})
})

but with no luck.  Following is my action and the entity class.

 

Here is my action (In a _working_ state):
/
@ParentPackage(json-default)
@Result(type = json)
public class ListTable extends ActionSupport {

@EJB
private ClientService clientService;
private List list;

@Action(value = list-clients, results = {
@Result(type = json, params = {
includeProperties,
list\\[.*\\]\\.name, list\\[.*\\]\\.id, list\\[.*\\]\
\.timelogCollection\\..* 
})
})
public String listClients() {
list = clientService.list();
return SUCCESS;
}

public List getList() {
return list;
}
}
/

Here is the entity:
/
@Entity
@Table(name = client)
@XmlRootElement
@NamedQueries({
@NamedQuery(name = Client.findAll, query = SELECT c FROM Client
c),
@NamedQuery(name = Client.findById, query = SELECT c FROM Client
c WHERE c.id = :id),
@NamedQuery(name = Client.findByName, query = SELECT c FROM
Client c WHERE c.name = :name)})
public class Client implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@NotNull
@Column(name = id)
private Integer id;
@Size(max = 45)
@Column(name = name)
private String name;
@OneToMany(cascade = CascadeType.ALL, mappedBy = clientId)
private CollectionTimelog timelogCollection;

public Client() {
}

public Client(Integer id) {
this.id = id;
}

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@XmlTransient
public CollectionTimelog getTimelogCollection() {
return timelogCollection;
}

public void setTimelogCollection(CollectionTimelog
timelogCollection) {
this.timelogCollection = timelogCollection;
}

@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}

@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id
fields are not set
if (!(object instanceof Client)) {
return false;
}
Client other = (Client) object;
if ((this.id == null  other.id != null) || (this.id != null
 !this.id.equals(other.id))) {
return false;
}
return true;
}

@Override
public String toString() {
return com.aerose.kentimekeeper.db.Client[ id= + id +  ];
}

}
/


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: sending the report directly to the printer

2011-02-28 Thread Ken McWilliams
This requirement would only make sense to me if this is in an intranet
where you have direct access to the printers. Then you could somehow get
your app to talk a print server.  It would be quite possible to make an
intelligent guess as to which printer in the company to send the
printout to based on the IP of the client.

On Sun, 2011-02-20 at 08:06 -0800, @rju wrote:
 sir please help me
 i ve already told my requirement as follows
 am using struts2-jasper plugin am calling my action through jquery.
 nw i need to print the report directly from printer when i ve pressed ok
 button.
 ok button will call the action.
 please help me ragarding this.Its very urgent for me and it is the main
 requirement for this project...
 
 
 
 Dave Newton-6 wrote:
  
  He's saying Hit Ctrl-P from inside a PDF reader.
  
  On Wednesday, February 16, 2011, @rju nagarjunabatt...@gmail.com wrote:
 
  if dont mind can you tell in detailed manner
  --
  View this message in context:
  http://old.nabble.com/Integrate-JasperReports-into-a-Struts2-web-application-tp23479814p30946620.html
  Sent from the Struts - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
  
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
  
  
  
 



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



struts2 property tag, how to dynamically set property name

2011-02-01 Thread Ken McWilliams
Hello I have a list of properties from a POJO as found using
introspection.

I want to iterate over a result set for each row, and iterate over a
list of property names for each cell in a table.

Something like:

s:iterator value = resultList
tr
s:iterator value=propertyNames //I want propertyNames to be
evaluated and the result used as the value for the iterator, not simply
interpreted as a normal list.
s:property/
/s:iterator
/tr
/s:iterator

If there is no way to do this then I'll create a BeanMap out of every
record in the result set (list of POJO's returned via JPA).


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: struts2 property tag, how to dynamically set property name

2011-02-01 Thread Ken McWilliams
It looks like I need to use a PropertyAccessor and
ognl.MapPropertyAccessor specifically.  Are there any demos in how to
use it, can one use it directly from the JSP? 

On Tue, 2011-02-01 at 15:35 -0700, Ken McWilliams wrote:
 Hello I have a list of properties from a POJO as found using
 introspection.
 
 I want to iterate over a result set for each row, and iterate over a
 list of property names for each cell in a table.
 
 Something like:
 
 s:iterator value = resultList
   tr
   s:iterator value=propertyNames //I want propertyNames to be
 evaluated and the result used as the value for the iterator, not simply
 interpreted as a normal list.
   s:property/
   /s:iterator
   /tr
 /s:iterator
 
 If there is no way to do this then I'll create a BeanMap out of every
 record in the result set (list of POJO's returned via JPA).
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: struts2 property tag, how to dynamically set property name

2011-02-01 Thread Ken McWilliams
Well I don't know if MapPropertyAccess would do what I want but found an
answer:

The following iterates over a list of POJO's and the properties are
determined for the particular POJO at run time and put in the
propertyValues list. The following is able to look up the property value
dynamically with OGNL. 

h1Print Table/h1
table border=1
s:iterator value=result var=record
tr
s:iterator value=propertyValues var=key
td
s:property value=%{#record[#key]} /
/td
/s:iterator
/tr
/s:iterator
/table


On Tue, 2011-02-01 at 15:53 -0700, Ken McWilliams wrote:
 It looks like I need to use a PropertyAccessor and
 ognl.MapPropertyAccessor specifically.  Are there any demos in how to
 use it, can one use it directly from the JSP? 
 
 On Tue, 2011-02-01 at 15:35 -0700, Ken McWilliams wrote:
  Hello I have a list of properties from a POJO as found using
  introspection.
  
  I want to iterate over a result set for each row, and iterate over a
  list of property names for each cell in a table.
  
  Something like:
  
  s:iterator value = resultList
  tr
  s:iterator value=propertyNames //I want propertyNames to be
  evaluated and the result used as the value for the iterator, not simply
  interpreted as a normal list.
  s:property/
  /s:iterator
  /tr
  /s:iterator
  
  If there is no way to do this then I'll create a BeanMap out of every
  record in the result set (list of POJO's returned via JPA).
  
  
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
  
 
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: struts2 property tag, how to dynamically set property name

2011-02-01 Thread Ken McWilliams
Thank you Dave, I just managed to resolve the issue in a slightly
earlier post.

Here is the action that backs the JSP. Now In my table I have a column
which prints out db.localhost.test.Groups[name=ADMIN] because the object
is db.localhost.test.Groups and it has a single property called name.
Another thing to fix.


package struts2.reflection;

import com.opensymphony.xwork2.ActionSupport;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Query;
import org.apache.commons.collections.BeanMap;

/**
 *
 * @author ken
 */
public class GetPropertyNames extends ActionSupport {

List result = null;
BeanMap propertyValues = null;

private EntityManagerFactory entityManagerFactory;

public void setEntityManagerFactory(EntityManagerFactory
entityManagerFactory) {
this.entityManagerFactory = entityManagerFactory;
}

@Override
public String execute() {
EntityManager entityManager =
entityManagerFactory.createEntityManager();
Query namedQuery =
entityManager.createNamedQuery(Customers.findAll);
result = namedQuery.getResultList();
if (result != null  result.size()  0){
propertyValues = new BeanMap( result.get(1) );
//has unwanted property class but there is no valid remove
method that will not throw an exception, so will take care of this in
getter
}
return SUCCESS;
}

public List getResult(){
return result;
}

public List getPropertyValues(){
//can now remove unwanted property class
ArrayList arrayList = new ArrayList(propertyValues.keySet());
arrayList.remove(class);
return arrayList;
}
}

On Tue, 2011-02-01 at 18:49 -0500, Dave Newton wrote:
 On Tue, 2011-02-01 at 15:35 -0700, Ken McWilliams wrote:
  s:iterator value = resultList
  s:iterator value=propertyNames
  ...
 
  I want propertyNames to be evaluated and the result used
  as the value for the iterator, not simply interpreted as a
  normal list.
 
 Evaluated in what context? As a list of named properties on the item
 being iterated over? Are you implementing this in Java, or different
 JVM language?
 
 I thought I remembered foo[propName] just working, but I couldn't
 tell you what I was backing the view *or* model with, which could make
 a huge difference :/
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: getRequestURL and action

2011-01-27 Thread Ken McWilliams
s:url/ gives you the current url.

s:url includeParams=get/ gives you the current url with the get
parameters. 

The s:a/ tag also shares the above properties but is also a link.

http://struts.apache.org/2.x/docs/tag-reference.html

On Thu, 2011-01-27 at 18:33 +0100, Doctor John Carter wrote:
 
   
   
   
   
   
   !--
   @page { margin: 2cm }
   P { margin-bottom: 0.21cm }
   A:link { so-language: zxx }
   --
   
 
 
 
 Struts
 version 2.1.8.1
 
 All
 my jsp pages include a header.jsp file.
 
 This
 header file is made for the choice of the languages.
 
 
 
 
 There
 are  3  links with the same action
 
 
 
 
 Th
 problem is that I don 't want to go back to the same page for  all
 the jsp file(home page for example). I want to go back to the origin
 pag after the user has choose his language
 
 
 
 
 
 
 So
 I would like to know how is it possible in the Struts 
 
 
 
 
 
 
 Thank
 you
 
 
 
 Florent 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: getRequestURL and action

2011-01-27 Thread Ken McWilliams
This question on Stack Overflow is very similar to your issue:
http://stackoverflow.com/questions/4773063/tiles2-struts-switch-locale

The parameter name for which the i18n interceptor determines the
language is configurable, I have not tried this but it may be possible
to specify a session_locale parameter for which it will determine the
correct language bundle. That is if you need the change to persist
across pages.  

Then you could configure an interceptor to capture any request_locale
parameters and setting session_locale to the same value.

On Thu, 2011-01-27 at 19:49 +0100, Doctor John Carter wrote:
 s:url id=localeEN namespace=/ action=locales:param 
 name=request_locale en/s:param/s:urls:url id=localenlBE 
 namespace=/ action=locales:param name=request_locale 
 nl_BE/s:param/s:urls:url id=localeFR namespace=/ action=locale   
  s:param name=request_locale fr/s:param/s:url
 ullis:a href=%{localeEN} English/s:a/lilis:a 
 href=%{localenlBE} Nederlands/s:a/lilis:a href=%{localeFR} 
 Français/s:a/li/ul
 
 action name=locale class=be.yp5.HK.action.LocaleAction  
  result name=SUCCESS type=redirect/matchDays.action/result
   /action
 
 
  Subject: Re: getRequestURL and action
  From: ken.mcwilli...@aerose.com
  To: user@struts.apache.org
  Date: Thu, 27 Jan 2011 11:42:24 -0700
 
   gives you the current url.
 
   gives you the current url with the get
  parameters.
 
  The  tag also shares the above properties but is also a link.
 
  http://struts.apache.org/2.x/docs/tag-reference.html
 
  On Thu, 2011-01-27 at 18:33 +0100, Doctor John Carter wrote:
  
  
  
  
  
  
   
  
  
  
  
   Struts
   version 2.1.8.1
  
   All
   my jsp pages include a header.jsp file.
  
   This
   header file is made for the choice of the languages.
  
  
  
  
   There
   are 3 links with the same action
  
  
  
  
   Th
   problem is that I don 't want to go back to the same page for all
   the jsp file(home page for example). I want to go back to the origin
   pag after the user has choose his language
  
  
  
  
  
  
   So
   I would like to know how is it possible in the Struts
  
  
  
  
  
  
   Thank
   you
  
  
  
   Florent
   -
   To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
   For additional commands, e-mail: user-h...@struts.apache.org
  
 
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: getRequestURL and action

2011-01-27 Thread Ken McWilliams
As mentioned earlier in the thread the s2 a tag and s2 url tag have many
very similar attributes.   

On Thu, 2011-01-27 at 17:36 -0500, Dave Newton wrote:
 On Thu, Jan 27, 2011 at 5:26 PM, Doctor John Carter wrote:
 
  The only little thing I Don't like...a href=s:url includeParams=get
 s:param name=request_localeen_US/s:param
   /s:url
   English
  /aIt's JSTL included in Html..

The following will work fine:

s:a includeParams=get
  s:param name=request_localeen_US/s:param
  English
/s:a

Don't bash HTML sometimes it is the far better path, although not in
this case ;)

  and not pure JSTLIs it possible to improve that?
 
 
 Maybe make the URL a variable and access it w/ JSP EL in the anchor tag?
 
 Dave



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Can Struts2 map params of the form a[]=2a[]=3a[]=4 to String[]

2011-01-21 Thread Ken McWilliams
Using jQuery, it is not a big deal to set $.ajaxSettings.traditional =
true;  such that jquery encodes in the form: a=2a=3a=4 but it is
enough of a nuisance for me to check if I can set something in
struts2.2.1 to avoid this.

 


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Dependancy Madness: Struts 2.2.1 spring 2.5 (preferably later ie: 3) and JPA2 backed with Hibernate

2010-12-21 Thread Ken McWilliams
I took your advice, there were to different versions of spring. Then did
the rest of the hacking needed to upgrade struts 2.0.6 with dojo to
2.2.1. 

Now on my list:
1) Change the demo to use jQuery + stuts2-json-plugin
2) Upgrade spring to 3+
3) Upgrade Hibernate and jpa to support JPA 2.
4) See if I can get the demo put back up on the struts wiki (saving
someone like me a lot of time!)

Again thank you so much!

On Tue, 2010-12-21 at 10:04 +0100, Maurizio Cucchiara wrote:
 It looks like there is a spring library conflict.
 Though at first glance would seem a spring issue, could you post the
 list of the lib directory (probably there will be more than one spring
 library version)
 
 2010/12/20 Ken McWilliams ken.mcwilli...@aerose.com:
  I'm experiencing issues upgrading the struts2-spring-2-jpa-ajax demo
  found here
  http://struts.apache.org/2.2.1/docs/struts-2-spring-2-jpa-ajax.html
 
  I've set up quite a few 2.2.1 projects I've just had a hard time
  understanding the spring/hibernate dependencies. I don't suppose anyone
  has an updated version of this demo (Struts 2.2.1, jpa 2, spring
  (anything that works) =)
 
  With the above project I followed:
  http://struts.apache.org/2.2.1/docs/create-struts-2-web-application-using-maven-to-manage-artifacts-and-to-build-the-application.html
 
  So I removed struts2-core and struts2-spring-plugin and added back the
  2.2.1 version of the struts2-spring-plugin (because it adds back
  struts2-core) and added javasssist (although there is still an older
  version because of the hibernate dependency) added log4j dependency and
  xml file and switched to using the
  org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
  filter.
 
  I'm getting at this moment:
 
  * HERE DOWN IS EXCEPTIONS **
 
  SEVERE: PWC1306: Startup of context /quickstart_upgrade-0.1-SNAPSHOT
  failed due to previous errors
  SEVERE: PWC1305: Exception during cleanup after start failed
  org.apache.catalina.LifecycleException: PWC2769: Manager has not yet
  been started
 at
  org.apache.catalina.session.StandardManager.stop(StandardManager.java:892)
 at
  org.apache.catalina.core.StandardContext.stop(StandardContext.java:5456)
 at com.sun.enterprise.web.WebModule.stop(WebModule.java:530)
 at
  org.apache.catalina.core.StandardContext.start(StandardContext.java:5284)
 at com.sun.enterprise.web.WebModule.start(WebModule.java:499)
 at
  org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:928)
 at
  org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912)
 at
  org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694)
 at
  com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1947)
 at
  com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1619)
 at
  com.sun.enterprise.web.WebApplication.start(WebApplication.java:90)
 at
  org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
 at
  org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
 at
  org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
 at
  com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339)
 at
  com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
 at
  org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
 at com.sun.enterprise.v3.admin.CommandRunnerImpl
  $1.execute(CommandRunnerImpl.java:305)
 at
  com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
 at
  com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
 at com.sun.enterprise.v3.admin.CommandRunnerImpl.access
  $900(CommandRunnerImpl.java:83)
 at com.sun.enterprise.v3.admin.CommandRunnerImpl
  $ExecutionContext.execute(CommandRunnerImpl.java:1235)
 at com.sun.enterprise.v3.admin.CommandRunnerImpl
  $ExecutionContext.execute(CommandRunnerImpl.java:1224)
 at
  com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
 at
  com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
 at
  com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
 at
  com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
 at
  com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
 at
  com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
 at
  com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
 at
  com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
 at
  com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170

  1   2   3   >