Re: how to use ejb 3.1/3.2 in struts2?

2016-03-08 Thread Mike Guo
after testing.  

that CDI plugin can work on Glassfish4.1.1 and wildly 10

so, I think it will be better to it


thanks everyone


Mike

> 在 2016年3月9日,上午10:50,Mike Guo <hongw...@163.com> 写道:
> 
> Hi, Martin.
> 
> 
> thanks for your example.
> 
> I guess it is not code in struts? is it spring code?
> 
> anyway, I check the original code.   but I feel I don’t have much knowledge 
> for spring. so, I have to take much time learn the more code for this.   but 
> finally, I gave up that part, but I think it is a way. through I didn’t do 
> test for it.
> 
> and I found another interesting thing is:
> 
> I used java EE (GlashFish4.1.1),  I guess it support Java EE version is 7.
> 
> so, I write a example for struts + struts-cdi-plugin.
> 
> I found I can use @EJB in action directly.
> 
> also,  both @Inject and @EJB work well for this. 
> 
> really thanks Martin and Paul.
> 
> 
> Mike
> 
> 
> 
>> 在 2016年3月9日,上午9:13,Martin Gainty <mgai...@hotmail.com> 写道:
>> 
>> 
>> 
>> 
>>> From: hongw...@163.com
>>> Subject: Re: how to use ejb 3.1/3.2 in struts2?
>>> Date: Wed, 9 Mar 2016 06:38:39 +0800
>>> To: user@struts.apache.org
>>> 
>>> Hi, Paul
>>> 
>>> Thanks your response, yes. I used ee 7, 
>>> would you share with me some examples?
>>> 
>>> Thanks
>>> 
>>> Mike
>> 
>> MG>suggest downloading and configuring Glassfish AppServer then download 
>> @EJB injection examples at
>> 
>> MG>https://glassfish.java.net/javaee5/ejb/examples/Sless.html
>> 
>> MG>look at spring @EJB examples inside 
>> struts-2.3.18/spring-bom-plugin/spring-framework/spring-context specifically:
>> .\src\main\java\org\springframework\context\annotation\CommonAnnotationBeanPostProcessor.java
>>  static {ClassLoader cl = 
>> CommonAnnotationBeanPostProcessor.class.getClassLoader();  try { 
>>   @SuppressWarnings("unchecked")  Class> extends Annotation> clazz = (Class) 
>> cl.loadClass("javax.xml.ws.WebServiceRef");   
>> webServiceRefClass = clazz; }   catch 
>> (ClassNotFoundException ex) { webServiceRefClass = null; 
>>  }   try {   
>> @SuppressWarnings("unchecked")  Class 
>> clazz = (Class) cl.loadClass("javax.ejb.EJB"); 
>>ejbRefClass = clazz;}   catch 
>> (ClassNotFoundException ex) { ejbRefClass = null;
>>  }   }
>> and the @EJB test:
>> 
>> .\src\test\java\org\springframework\context\annotation\CommonAnnotationBeanPostProcessorTests.java
>> public static class ExtendedEjbInjectionBean extends ResourceInjectionBean { 
>> @EJB(name="testBean4", beanInterface=TestBean.class)
>> protected ITestBean testBean3;
>> MG>
>>> 
>>> 
>>> Sent from my iPhone
>>> 
>>>> 在 2016年3月8日,23:50,Paul Benedict <pbened...@apache.org> 写道:
>>>> 
>>>> Are you using an EE 7 server? I believe 7 integrates CDI and EJB so you can
>>>> @Inject your remote bean interfaces. This may also be available in 6, but
>>>> you'd have to research that.
>>>> 
>>>> PS: @EJB is a specialized injection annotation that only deals with EJB.
>>>> Obviously, but just wanted to point that out.
>>>> 
>>>> Cheers,
>>>> Paul
>>>> 
>>>>> On Tue, Mar 8, 2016 at 9:44 AM, Mike Guo <hongw...@163.com> wrote:
>>>>> 
>>>>> Hello, everyone.
>>>>> 
>>>>> I suppose this is very old question to struts user list.
>>>>> 
>>>>> how to use EJB 3.1/3.2 in struts2?
>>>>> 
>>>>> I did some research on google.  but I totally no idea what’s the exactly
>>>>> solution for this.
>>>>> 
>>>>> some one said use cdi plugin. but if I use cdi plugin,  I guess it can be
>>>>> @inject a ebb into action class. but if I want to inject a remote EJB
>>>>> interface, I think it is not work.
>>>>> 
>>>>> also, some one said use JNDI lookup , I suppose it can get it done.  but I
>>>>> think it is very ugly way for it.
>>>>> 
>>>>> 
>>>>> is there any better solution for this?
>>>>> 
>>>>> any comments?
>>>>> 
>>>>> 
>>>>> Many many thanks
>>>>> 
>>>>> 
>>>>> Mike
>>>>> 
>>>>> 
>>>>> 
>>>>> -
>>>>> 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: how to use ejb 3.1/3.2 in struts2?

2016-03-08 Thread Mike Guo
Hi, Martin.


thanks for your example.

I guess it is not code in struts? is it spring code?

anyway, I check the original code.   but I feel I don’t have much knowledge for 
spring. so, I have to take much time learn the more code for this.   but 
finally, I gave up that part, but I think it is a way. through I didn’t do test 
for it.

and I found another interesting thing is:

I used java EE (GlashFish4.1.1),  I guess it support Java EE version is 7.

so, I write a example for struts + struts-cdi-plugin.

I found I can use @EJB in action directly.

also,  both @Inject and @EJB work well for this. 

really thanks Martin and Paul.


Mike



> 在 2016年3月9日,上午9:13,Martin Gainty <mgai...@hotmail.com> 写道:
> 
> 
> 
> 
>> From: hongw...@163.com
>> Subject: Re: how to use ejb 3.1/3.2 in struts2?
>> Date: Wed, 9 Mar 2016 06:38:39 +0800
>> To: user@struts.apache.org
>> 
>> Hi, Paul
>> 
>> Thanks your response, yes. I used ee 7, 
>> would you share with me some examples?
>> 
>> Thanks
>> 
>> Mike
> 
> MG>suggest downloading and configuring Glassfish AppServer then download @EJB 
> injection examples at
> 
> MG>https://glassfish.java.net/javaee5/ejb/examples/Sless.html
> 
> MG>look at spring @EJB examples inside 
> struts-2.3.18/spring-bom-plugin/spring-framework/spring-context specifically:
> .\src\main\java\org\springframework\context\annotation\CommonAnnotationBeanPostProcessor.java
>   static {ClassLoader cl = 
> CommonAnnotationBeanPostProcessor.class.getClassLoader();  try {  
>  @SuppressWarnings("unchecked")  Class extends Annotation> clazz = (Class) 
> cl.loadClass("javax.xml.ws.WebServiceRef");   
> webServiceRefClass = clazz; }   catch 
> (ClassNotFoundException ex) { webServiceRefClass = null;  
> }   try {   
> @SuppressWarnings("unchecked")  Class 
> clazz = (Class) cl.loadClass("javax.ejb.EJB");  
>   ejbRefClass = clazz;}   catch 
> (ClassNotFoundException ex) { ejbRefClass = null; 
> }   }
> and the @EJB test:
> 
> .\src\test\java\org\springframework\context\annotation\CommonAnnotationBeanPostProcessorTests.java
> public static class ExtendedEjbInjectionBean extends ResourceInjectionBean {  
> @EJB(name="testBean4", beanInterface=TestBean.class)
> protected ITestBean testBean3;
> MG>
>> 
>> 
>> Sent from my iPhone
>> 
>>> 在 2016年3月8日,23:50,Paul Benedict <pbened...@apache.org> 写道:
>>> 
>>> Are you using an EE 7 server? I believe 7 integrates CDI and EJB so you can
>>> @Inject your remote bean interfaces. This may also be available in 6, but
>>> you'd have to research that.
>>> 
>>> PS: @EJB is a specialized injection annotation that only deals with EJB.
>>> Obviously, but just wanted to point that out.
>>> 
>>> Cheers,
>>> Paul
>>> 
>>>> On Tue, Mar 8, 2016 at 9:44 AM, Mike Guo <hongw...@163.com> wrote:
>>>> 
>>>> Hello, everyone.
>>>> 
>>>> I suppose this is very old question to struts user list.
>>>> 
>>>> how to use EJB 3.1/3.2 in struts2?
>>>> 
>>>> I did some research on google.  but I totally no idea what’s the exactly
>>>> solution for this.
>>>> 
>>>> some one said use cdi plugin. but if I use cdi plugin,  I guess it can be
>>>> @inject a ebb into action class. but if I want to inject a remote EJB
>>>> interface, I think it is not work.
>>>> 
>>>> also, some one said use JNDI lookup , I suppose it can get it done.  but I
>>>> think it is very ugly way for it.
>>>> 
>>>> 
>>>> is there any better solution for this?
>>>> 
>>>> any comments?
>>>> 
>>>> 
>>>> Many many thanks
>>>> 
>>>> 
>>>> Mike
>>>> 
>>>> 
>>>> 
>>>> -
>>>> 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: how to use ejb 3.1/3.2 in struts2?

2016-03-08 Thread Mike Guo
Hi, Paul

Thanks your response, yes. I used ee 7, 
would you share with me some examples?

Thanks

Mike


Sent from my iPhone

> 在 2016年3月8日,23:50,Paul Benedict <pbened...@apache.org> 写道:
> 
> Are you using an EE 7 server? I believe 7 integrates CDI and EJB so you can
> @Inject your remote bean interfaces. This may also be available in 6, but
> you'd have to research that.
> 
> PS: @EJB is a specialized injection annotation that only deals with EJB.
> Obviously, but just wanted to point that out.
> 
> Cheers,
> Paul
> 
>> On Tue, Mar 8, 2016 at 9:44 AM, Mike Guo <hongw...@163.com> wrote:
>> 
>> Hello, everyone.
>> 
>> I suppose this is very old question to struts user list.
>> 
>> how to use EJB 3.1/3.2 in struts2?
>> 
>> I did some research on google.  but I totally no idea what’s the exactly
>> solution for this.
>> 
>> some one said use cdi plugin. but if I use cdi plugin,  I guess it can be
>> @inject a ebb into action class. but if I want to inject a remote EJB
>> interface, I think it is not work.
>> 
>> also, some one said use JNDI lookup , I suppose it can get it done.  but I
>> think it is very ugly way for it.
>> 
>> 
>> is there any better solution for this?
>> 
>> any comments?
>> 
>> 
>> Many many thanks
>> 
>> 
>> Mike
>> 
>> 
>> 
>> -
>> 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



how to use ejb 3.1/3.2 in struts2?

2016-03-08 Thread Mike Guo
Hello, everyone.

I suppose this is very old question to struts user list.

how to use EJB 3.1/3.2 in struts2?

I did some research on google.  but I totally no idea what’s the exactly 
solution for this.

some one said use cdi plugin. but if I use cdi plugin,  I guess it can be 
@inject a ebb into action class. but if I want to inject a remote EJB 
interface, I think it is not work.

also, some one said use JNDI lookup , I suppose it can get it done.  but I 
think it is very ugly way for it.


is there any better solution for this?

any comments?


Many many thanks


Mike



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



Re: Jodd/Madvoc MVC framework

2016-01-26 Thread Mike Guo


I saw your guys already have many emails about the result string, but I think 
it is ok, just a little curious, any issue when we use string result?

Thanks

Mike







> 在 2016年1月26日,22:44,Lukasz Lenart <lukaszlen...@apache.org> 写道:
> 
> Such functionality is already supported, you can return an instance of
> the Result class instead of a String and Struts2 will handle it.
> Though, it isn't documented ;-)
> 
> 2016-01-26 15:26 GMT+01:00 CRANFORD, CHRIS <chris.cranf...@setech.com>:
>> This is one of the aspects of Spring MVC that I prefer over that of Struts2. 
>>  The return types from action handler methods vary and influences what the 
>> servlet handler is to do after the action handler has completed.
>> 
>> The framework could be tweaked to examine the action method's return type 
>> and based upon it branch and do various new features, allowing the result 
>> type invocation to be handled in a more declarative way via code rather than 
>> XML configuration or annotations.
>> 
>> What Christoph presents here very closely aligns with the View based 
>> implementations that Spring MVC expose.
>> 
>> I also think we're reaching a point that some of the struts2 plugins to 
>> support various result type implementations such as JSON and REST should be 
>> considered for merging into the struts2 core.  These result types have 
>> become a major way to exchange data in the past several years with 
>> microservices, web services, and AJAX support that they should be first 
>> class denizens in the codebase.
>> 
>> Chris
>> 
>> -Original Message-
>> From: Christoph Nenning [mailto:christoph.nenn...@lex-com.net]
>> Sent: Tuesday, January 26, 2016 3:27 AM
>> To: Struts Users Mailing List <user@struts.apache.org>
>> Subject: Re: Jodd/Madvoc MVC framework
>> 
>> return new InstantDispatcherResult("foo.jsp");
>> return new InstantActionRedirectResult("fooAction");
>> 
>> 
>> -
>> 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: Jodd/Madvoc MVC framework

2016-01-26 Thread Mike Guo
That's true.;)

发自我的 iPhone

> 在 2016年1月27日,10:47,Dave Newton <davelnew...@gmail.com> 写道:
> 
> No issue in the sense of it working or not.
> 
> *My* issue with strings is that it completely ignores the type system, such
> as it is, that Java gives us.
> 
>> On Tue, Jan 26, 2016 at 9:42 PM, Mike Guo <hongw...@163.com> wrote:
>> 
>> 
>> 
>> I saw your guys already have many emails about the result string, but I
>> think it is ok, just a little curious, any issue when we use string result?
>> 
>> Thanks
>> 
>> Mike
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> 在 2016年1月26日,22:44,Lukasz Lenart <lukaszlen...@apache.org> 写道:
>>> 
>>> Such functionality is already supported, you can return an instance of
>>> the Result class instead of a String and Struts2 will handle it.
>>> Though, it isn't documented ;-)
>>> 
>>> 2016-01-26 15:26 GMT+01:00 CRANFORD, CHRIS <chris.cranf...@setech.com>:
>>>> This is one of the aspects of Spring MVC that I prefer over that of
>> Struts2.  The return types from action handler methods vary and influences
>> what the servlet handler is to do after the action handler has completed.
>>>> 
>>>> The framework could be tweaked to examine the action method's return
>> type and based upon it branch and do various new features, allowing the
>> result type invocation to be handled in a more declarative way via code
>> rather than XML configuration or annotations.
>>>> 
>>>> What Christoph presents here very closely aligns with the View based
>> implementations that Spring MVC expose.
>>>> 
>>>> I also think we're reaching a point that some of the struts2 plugins to
>> support various result type implementations such as JSON and REST should be
>> considered for merging into the struts2 core.  These result types have
>> become a major way to exchange data in the past several years with
>> microservices, web services, and AJAX support that they should be first
>> class denizens in the codebase.
>>>> 
>>>> Chris
>>>> 
>>>> -Original Message-
>>>> From: Christoph Nenning [mailto:christoph.nenn...@lex-com.net]
>>>> Sent: Tuesday, January 26, 2016 3:27 AM
>>>> To: Struts Users Mailing List <user@struts.apache.org>
>>>> Subject: Re: Jodd/Madvoc MVC framework
>>>> 
>>>> return new InstantDispatcherResult("foo.jsp");
>>>> return new InstantActionRedirectResult("fooAction");
>>>> 
>>>> 
>>>> -
>>>> 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
> 
> 
> -- 
> 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: what's the Bootstrap when I use "stream" result type for a picture output

2015-09-24 Thread Mike Guo
hi, thanks for your response. 

I got this solved . here’s the article  I searched, it can explain why and how 
about this thing.

http://www.oracle.com/technetwork/articles/javase/headless-136834.html 



thanks again


Mike.G


> 在 2015年9月24日,15:37,Christoph Nenning  写道:
> 
>> Hi. all.
>> 
>> I got a very strange issues.
>> 
>> I tried to generate dynamic check code by struts2.  so, I used 
>> buffered image and javax.imageio for a byteinputstream in my Action.
>> 
>> look like the function work fine. but strange thing is:  every time 
>> when I access that dynamic check code action. system will be start a
>> java application “Bootstrap”
>> 
>> please check the picture. also, when quit this Bootstrap java 
>> application, and my tomcat is stop running too.
>> 
>> would you please share with me what’s this? and why it running by 
> automatic?
>> 
>> [Image removed] 
>> 
>> thanks so much
>> 
>> Mike.G
> 
> 
> well, this question was cross-posted on tomcat-user list and there were 
> some responses on that list.
> 
> 
> This Email was scanned by Sophos Anti Virus



what's the Bootstrap when I use "stream" result type for a picture output

2015-09-23 Thread Mike Guo
Hi. all.

I got a very strange issues.

I tried to generate dynamic check code by struts2.  so, I used buffered image 
and javax.imageio for a byteinputstream in my Action.

look like the function work fine. but strange thing is:  every time when I 
access that dynamic check code action. system will be start a java application 
“Bootstrap”

please check the picture. also, when quit this Bootstrap java application, and 
my tomcat is stop running too.



would you please share with me what’s this? and why it running by automatic?





thanks so much


Mike.G



Re: what's the Bootstrap when I use "stream" result type for a picture output

2015-09-23 Thread Mike Guo
Anyone? Please.  


发自我的 iPhone

> 在 2015年9月24日,02:15,Mike Guo <hongw...@163.com> 写道:
> 
> Hi. all.
> 
> I got a very strange issues.
> 
> I tried to generate dynamic check code by struts2.  so, I used buffered image 
> and javax.imageio for a byteinputstream in my Action.
> 
> look like the function work fine. but strange thing is:  every time when I 
> access that dynamic check code action. system will be start a java 
> application “Bootstrap”
> 
> please check the picture. also, when quit this Bootstrap java application, 
> and my tomcat is stop running too.
> 
> 
> 
> would you please share with me what’s this? and why it running by automatic?
> 
> <屏幕快照 2015-09-24 02.13.46.png>
> 
> 
> 
> thanks so much
> 
> 
> Mike.G
> 


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



Re: what's the Bootstrap when I use "stream" result type for a picture output

2015-09-23 Thread Mike Guo
ok, I just found it is not related with tomcat or struts.

I just use this code:


import java.util.Arrays;
  
import javax.imageio.ImageIO;
  
public class ListImageFormatters {
  
public static void main(String[] args) {
String[] readerFormatNames = ImageIO.getReaderFormatNames();
//[BMP, bmp, jpg, JPG, wbmp, jpeg, png, PNG, JPEG, WBMP, GIF, gif]
System.out.println(Arrays.toString(readerFormatNames));
  
//[jpg, BMP, bmp, JPG, jpeg, wbmp, png, JPEG, PNG, WBMP, GIF, gif]
String[] writerFormatNames = ImageIO.getWriterFormatNames();
System.out.println(Arrays.toString(writerFormatNames));
}
  
}

and it will start the Bootstrap too.


so, look like it is belong to JDK part. 

but I don’t understand it still. is there anyone can share some tips to me?


thanks so much


Mike.G




> 在 2015年9月24日,11:32,Mike Guo <hongw...@163.com> 写道:
> 
> Anyone? Please.  
> 
> 
> 发自我的 iPhone
> 
>> 在 2015年9月24日,02:15,Mike Guo <hongw...@163.com> 写道:
>> 
>> Hi. all.
>> 
>> I got a very strange issues.
>> 
>> I tried to generate dynamic check code by struts2.  so, I used buffered 
>> image and javax.imageio for a byteinputstream in my Action.
>> 
>> look like the function work fine. but strange thing is:  every time when I 
>> access that dynamic check code action. system will be start a java 
>> application “Bootstrap”
>> 
>> please check the picture. also, when quit this Bootstrap java application, 
>> and my tomcat is stop running too.
>> 
>> 
>> 
>> would you please share with me what’s this? and why it running by automatic?
>> 
>> <屏幕快照 2015-09-24 02.13.46.png>
>> 
>> 
>> 
>> thanks so much
>> 
>> 
>> Mike.G
>> 
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 



Re: what's the Bootstrap when I use "stream" result type for a picture output

2015-09-23 Thread Mike Guo
ok, finally, I got the solution for this one.  although I don’t know why.

I just add one java param in here:
java -Djava.awt.headless=true then it will be gone.



thanks 


Mike.G


> 在 2015年9月24日,12:02,Mike Guo <hongw...@163.com> 写道:
> 
> ok, I just found it is not related with tomcat or struts.
> 
> I just use this code:
> 
> 
> import java.util.Arrays;
> 
> import javax.imageio.ImageIO;
> 
> public class ListImageFormatters {
> 
>public static void main(String[] args) {
>String[] readerFormatNames = ImageIO.getReaderFormatNames();
>//[BMP, bmp, jpg, JPG, wbmp, jpeg, png, PNG, JPEG, WBMP, GIF, gif]
>System.out.println(Arrays.toString(readerFormatNames));
> 
>//[jpg, BMP, bmp, JPG, jpeg, wbmp, png, JPEG, PNG, WBMP, GIF, gif]
>String[] writerFormatNames = ImageIO.getWriterFormatNames();
>System.out.println(Arrays.toString(writerFormatNames));
>}
> 
> }
> 
> and it will start the Bootstrap too.
> 
> 
> so, look like it is belong to JDK part. 
> 
> but I don’t understand it still. is there anyone can share some tips to me?
> 
> 
> thanks so much
> 
> 
> Mike.G
> 
> 
> 
> 
>> 在 2015年9月24日,11:32,Mike Guo <hongw...@163.com> 写道:
>> 
>> Anyone? Please.  
>> 
>> 
>> 发自我的 iPhone
>> 
>>> 在 2015年9月24日,02:15,Mike Guo <hongw...@163.com> 写道:
>>> 
>>> Hi. all.
>>> 
>>> I got a very strange issues.
>>> 
>>> I tried to generate dynamic check code by struts2.  so, I used buffered 
>>> image and javax.imageio for a byteinputstream in my Action.
>>> 
>>> look like the function work fine. but strange thing is:  every time when I 
>>> access that dynamic check code action. system will be start a java 
>>> application “Bootstrap”
>>> 
>>> please check the picture. also, when quit this Bootstrap java application, 
>>> and my tomcat is stop running too.
>>> 
>>> 
>>> 
>>> would you please share with me what’s this? and why it running by automatic?
>>> 
>>> <屏幕快照 2015-09-24 02.13.46.png>
>>> 
>>> 
>>> 
>>> thanks so much
>>> 
>>> 
>>> Mike.G
>>> 
>> 
>> 
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>> 
> 



Re: what's the Bootstrap when I use "stream" result type for a picture output

2015-09-23 Thread Mike Guo
and I think the finally answer is here:

http://www.oracle.com/technetwork/articles/javase/headless-136834.html 
<http://www.oracle.com/technetwork/articles/javase/headless-136834.html>



just for record.

Mike.G


> 在 2015年9月24日,12:05,Mike Guo <hongw...@163.com> 写道:
> 
> ok, finally, I got the solution for this one.  although I don’t know why.
> 
> I just add one java param in here:
> java -Djava.awt.headless=true then it will be gone.
> 
> 
> 
> thanks 
> 
> 
> Mike.G
> 
> 
>> 在 2015年9月24日,12:02,Mike Guo <hongw...@163.com> 写道:
>> 
>> ok, I just found it is not related with tomcat or struts.
>> 
>> I just use this code:
>> 
>> 
>> import java.util.Arrays;
>> 
>> import javax.imageio.ImageIO;
>> 
>> public class ListImageFormatters {
>> 
>>   public static void main(String[] args) {
>>   String[] readerFormatNames = ImageIO.getReaderFormatNames();
>>   //[BMP, bmp, jpg, JPG, wbmp, jpeg, png, PNG, JPEG, WBMP, GIF, gif]
>>   System.out.println(Arrays.toString(readerFormatNames));
>> 
>>   //[jpg, BMP, bmp, JPG, jpeg, wbmp, png, JPEG, PNG, WBMP, GIF, gif]
>>   String[] writerFormatNames = ImageIO.getWriterFormatNames();
>>   System.out.println(Arrays.toString(writerFormatNames));
>>   }
>> 
>> }
>> 
>> and it will start the Bootstrap too.
>> 
>> 
>> so, look like it is belong to JDK part. 
>> 
>> but I don’t understand it still. is there anyone can share some tips to me?
>> 
>> 
>> thanks so much
>> 
>> 
>> Mike.G
>> 
>> 
>> 
>> 
>>> 在 2015年9月24日,11:32,Mike Guo <hongw...@163.com> 写道:
>>> 
>>> Anyone? Please.  
>>> 
>>> 
>>> 发自我的 iPhone
>>> 
>>>> 在 2015年9月24日,02:15,Mike Guo <hongw...@163.com> 写道:
>>>> 
>>>> Hi. all.
>>>> 
>>>> I got a very strange issues.
>>>> 
>>>> I tried to generate dynamic check code by struts2.  so, I used buffered 
>>>> image and javax.imageio for a byteinputstream in my Action.
>>>> 
>>>> look like the function work fine. but strange thing is:  every time when I 
>>>> access that dynamic check code action. system will be start a java 
>>>> application “Bootstrap”
>>>> 
>>>> please check the picture. also, when quit this Bootstrap java application, 
>>>> and my tomcat is stop running too.
>>>> 
>>>> 
>>>> 
>>>> would you please share with me what’s this? and why it running by 
>>>> automatic?
>>>> 
>>>> <屏幕快照 2015-09-24 02.13.46.png>
>>>> 
>>>> 
>>>> 
>>>> thanks so much
>>>> 
>>>> 
>>>> Mike.G
>>>> 
>>> 
>>> 
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>> 
>> 
> 



Re: How do configure struts convention plugin with struts-spring plugin with Action class mapped with annotations

2015-03-03 Thread bavon mike
The actual problem was that struts 2.3.20 has some logging issues with
wildfly(doesnt log anything at runtime)..i just downgraded it to 2.3.16.3
and i was able to trace the error

On Mon, Mar 2, 2015 at 12:53 PM, Lukasz Lenart lukaszlen...@apache.org
wrote:

 2015-03-02 10:44 GMT+01:00 bavon mike bavom...@gmail.com:
  Even on disabling CDI and using Spring, Ajax cant locate the action
 class.
 
  Mapping the action class in struts.xml and bean in applicationContext.xml
  works fine, problems comes when i want to use annotation( convention
  plugin) for my action  class rather than using xml.

 Do you define actions in Spring context? Maybe you have excluded them
 via config-scan


 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: How do configure struts convention plugin with struts-spring plugin with Action class mapped with annotations

2015-03-02 Thread bavon mike
Even on disabling CDI and using Spring, Ajax cant locate the action class.

Mapping the action class in struts.xml and bean in applicationContext.xml
works fine, problems comes when i want to use annotation( convention
plugin) for my action  class rather than using xml.


On Mon, Mar 2, 2015 at 12:05 PM, Lukasz Lenart lukaszlen...@apache.org
wrote:

 You are mixing CDI and Spring - you should use just one DI

 2015-03-02 7:32 GMT+01:00 bavon mike bavom...@gmail.com:
  I am trying to configure spring plugin with strut 2 application, which is
  already running with convention plugin, so am using annotations. Am using
  ExtJs for my form submission which was initially working well until i
  introduced the spring plugin, now the the ajax request cannot locate the
  actions and its even not showing any response in firebug. I have tried
  searching the net, but i cant find solution of how to successfully
  configure strut2 convention plugin using annotation with struts-spring
  plugin. Currently this is what i have
 
  *pom.xml*
 
  !-- struts 2 dependencies --
  dependency
  groupIdorg.apache.struts/groupId
  artifactIdstruts2-core/artifactId
  version${struts2.version}/version
  /dependency
 
  dependency
  groupIdorg.apache.struts/groupId
  artifactIdstruts2-convention-plugin/artifactId
  version${struts2.version}/version
  /dependency
 
  dependency
  groupIdorg.apache.struts/groupId
  artifactIdstruts2-json-plugin/artifactId
  version${struts2.version}/version
  /dependency
 
  dependency
  groupIdorg.apache.struts/groupId
  artifactIdstruts2-spring-plugin/artifactId
  version${struts2.version}/version
  /dependency
 
  !-- Import the CDI API --
  dependency
  groupIdorg.apache.struts/groupId
  artifactIdstruts2-cdi-plugin/artifactId
  version${struts2.version}/version
  /dependency
  dependency
  groupIdjavax.enterprise/groupId
  artifactIdcdi-api/artifactId
  version1.0-SP1/version!--$NO-MVN-MAN-VER$--
  scopeprovided/scope
  /dependency
 
  !-- Spring framework --
  dependency
  groupIdorg.springframework/groupId
  artifactIdspring-core/artifactId
  version${spring.version}/version
  /dependency
  dependency
  groupIdorg.springframework/groupId
  artifactIdspring-context/artifactId
  version${spring.version}/version
  /dependency
  dependency
  groupIdorg.springframework/groupId
  artifactIdspring-web/artifactId
  version${spring.version}/version
  /dependency
  dependency
  groupIdorg.springframework/groupId
  artifactIdspring-beans/artifactId
  version${spring.version}/version
  /dependency
 
  *struts.xml*
 
  ?xml version=1.0 encoding=UTF-8 ?
  !DOCTYPE struts PUBLIC
  -//Apache Software Foundation//DTD Struts Configuration 2.0//EN
  http://struts.apache.org/dtds/struts-2.0.dtd;
 
  struts
  constant name=struts.custom.i18n.resources
  value=ApplicationResources /
  constant name=struts.devMode value=true /
  constant name=struts.convention.result.path value=/content /
  constant name=struts.multipart.saveDir value=/tmp /
  constant name=struts.multipart.maxSize value=4194304 /
  constant name=struts.action.excludePattern value=/api/.*? /
 
  /struts
 
  *web.xml*
 
  display-nameApplication/display-name
  welcome-file-list
welcome-fileindex.html/welcome-file
  /welcome-file-list
 
  filter
  filter-namestruts2/filter-name
 
 
 filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter/filter-class
  /filter
 
  filter-mapping
  filter-namestruts2/filter-name
  url-pattern/*/url-pattern
  /filter-mapping
 
  listener
 
 
 listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
 
  /listener
 
  servlet
servlet-nameResteasy/servlet-name
 
 
 servlet-classorg.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher/servlet-class
  /servlet
  servlet-mapping
servlet-nameResteasy/servlet-name
url-pattern/api/*/url-pattern
  /servlet-mapping
  context-param
  param-nameresteasy.scan/param-name
  param-valuetrue/param-value
  /context-param
  context-param
param-nameresteasy.servlet.mapping.prefix/param-name
param-value/api/param-value
  /context-param
  listener
 
 
 listener-classorg.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap/listener-class
  /listener
 
  *applicationContext.xml*
 
  ?xml version=1.0 encoding=UTF-8?
  beans xmlns=http://www.springframework.org/schema/beans;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:aop=
  http://www.springframework.org/schema/aop;
 xmlns:tx=http://www.springframework.org/schema/tx;
 xsi:schemaLocation=
http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd;
  /beans
 
  *Action Class*
  @Namespace(/units)
  @Result(
  type = stream,
  params = {
  inputName, stream
  }
  )
  public class PropertyTypeAction

Re: How do configure struts convention plugin with struts-spring plugin with Action class mapped with annotations

2015-03-02 Thread bavon mike
i have tried constant name=struts.objectFactory value=spring / but no
result.

On Mon, Mar 2, 2015 at 10:29 AM, Johannes Geppert jo...@apache.org wrote:

 According to the spring plugin documentation [1] you need to setup
 following constant in your struts config.

 constant name=struts.objectFactory value=spring /


 Best Regards

 Johannes

 [1] https://cwiki.apache.org/confluence/display/WW/Spring+Plugin


 #
 web: http://www.jgeppert.com
 twitter: http://twitter.com/jogep


 2015-03-02 7:32 GMT+01:00 bavon mike bavom...@gmail.com:

  I am trying to configure spring plugin with strut 2 application, which is
  already running with convention plugin, so am using annotations. Am using
  ExtJs for my form submission which was initially working well until i
  introduced the spring plugin, now the the ajax request cannot locate the
  actions and its even not showing any response in firebug. I have tried
  searching the net, but i cant find solution of how to successfully
  configure strut2 convention plugin using annotation with struts-spring
  plugin. Currently this is what i have
 
  *pom.xml*
 
  !-- struts 2 dependencies --
  dependency
  groupIdorg.apache.struts/groupId
  artifactIdstruts2-core/artifactId
  version${struts2.version}/version
  /dependency
 
  dependency
  groupIdorg.apache.struts/groupId
  artifactIdstruts2-convention-plugin/artifactId
  version${struts2.version}/version
  /dependency
 
  dependency
  groupIdorg.apache.struts/groupId
  artifactIdstruts2-json-plugin/artifactId
  version${struts2.version}/version
  /dependency
 
  dependency
  groupIdorg.apache.struts/groupId
  artifactIdstruts2-spring-plugin/artifactId
  version${struts2.version}/version
  /dependency
 
  !-- Import the CDI API --
  dependency
  groupIdorg.apache.struts/groupId
  artifactIdstruts2-cdi-plugin/artifactId
  version${struts2.version}/version
  /dependency
  dependency
  groupIdjavax.enterprise/groupId
  artifactIdcdi-api/artifactId
  version1.0-SP1/version!--$NO-MVN-MAN-VER$--
  scopeprovided/scope
  /dependency
 
  !-- Spring framework --
  dependency
  groupIdorg.springframework/groupId
  artifactIdspring-core/artifactId
  version${spring.version}/version
  /dependency
  dependency
  groupIdorg.springframework/groupId
  artifactIdspring-context/artifactId
  version${spring.version}/version
  /dependency
  dependency
  groupIdorg.springframework/groupId
  artifactIdspring-web/artifactId
  version${spring.version}/version
  /dependency
  dependency
  groupIdorg.springframework/groupId
  artifactIdspring-beans/artifactId
  version${spring.version}/version
  /dependency
 
  *struts.xml*
 
  ?xml version=1.0 encoding=UTF-8 ?
  !DOCTYPE struts PUBLIC
  -//Apache Software Foundation//DTD Struts Configuration 2.0//EN
  http://struts.apache.org/dtds/struts-2.0.dtd;
 
  struts
  constant name=struts.custom.i18n.resources
  value=ApplicationResources /
  constant name=struts.devMode value=true /
  constant name=struts.convention.result.path value=/content /
  constant name=struts.multipart.saveDir value=/tmp /
  constant name=struts.multipart.maxSize value=4194304 /
  constant name=struts.action.excludePattern value=/api/.*? /
 
  /struts
 
  *web.xml*
 
  display-nameApplication/display-name
  welcome-file-list
welcome-fileindex.html/welcome-file
  /welcome-file-list
 
  filter
  filter-namestruts2/filter-name
 
 
 
 filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter/filter-class
  /filter
 
  filter-mapping
  filter-namestruts2/filter-name
  url-pattern/*/url-pattern
  /filter-mapping
 
  listener
 
 
 
 listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
 
  /listener
 
  servlet
servlet-nameResteasy/servlet-name
 
 
 
 servlet-classorg.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher/servlet-class
  /servlet
  servlet-mapping
servlet-nameResteasy/servlet-name
url-pattern/api/*/url-pattern
  /servlet-mapping
  context-param
  param-nameresteasy.scan/param-name
  param-valuetrue/param-value
  /context-param
  context-param
param-nameresteasy.servlet.mapping.prefix/param-name
param-value/api/param-value
  /context-param
  listener
 
 
 
 listener-classorg.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap/listener-class
  /listener
 
  *applicationContext.xml*
 
  ?xml version=1.0 encoding=UTF-8?
  beans xmlns=http://www.springframework.org/schema/beans;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:aop=
  http://www.springframework.org/schema/aop;
 xmlns:tx=http://www.springframework.org/schema/tx;
 xsi:schemaLocation=
http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd;
  /beans
 
  *Action Class*
  @Namespace

How do configure struts convention plugin with struts-spring plugin with Action class mapped with annotations

2015-03-01 Thread bavon mike
I am trying to configure spring plugin with strut 2 application, which is
already running with convention plugin, so am using annotations. Am using
ExtJs for my form submission which was initially working well until i
introduced the spring plugin, now the the ajax request cannot locate the
actions and its even not showing any response in firebug. I have tried
searching the net, but i cant find solution of how to successfully
configure strut2 convention plugin using annotation with struts-spring
plugin. Currently this is what i have

*pom.xml*

!-- struts 2 dependencies --
dependency
groupIdorg.apache.struts/groupId
artifactIdstruts2-core/artifactId
version${struts2.version}/version
/dependency

dependency
groupIdorg.apache.struts/groupId
artifactIdstruts2-convention-plugin/artifactId
version${struts2.version}/version
/dependency

dependency
groupIdorg.apache.struts/groupId
artifactIdstruts2-json-plugin/artifactId
version${struts2.version}/version
/dependency

dependency
groupIdorg.apache.struts/groupId
artifactIdstruts2-spring-plugin/artifactId
version${struts2.version}/version
/dependency

!-- Import the CDI API --
dependency
groupIdorg.apache.struts/groupId
artifactIdstruts2-cdi-plugin/artifactId
version${struts2.version}/version
/dependency
dependency
groupIdjavax.enterprise/groupId
artifactIdcdi-api/artifactId
version1.0-SP1/version!--$NO-MVN-MAN-VER$--
scopeprovided/scope
/dependency

!-- Spring framework --
dependency
groupIdorg.springframework/groupId
artifactIdspring-core/artifactId
version${spring.version}/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdspring-context/artifactId
version${spring.version}/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdspring-web/artifactId
version${spring.version}/version
/dependency
dependency
groupIdorg.springframework/groupId
artifactIdspring-beans/artifactId
version${spring.version}/version
/dependency

*struts.xml*

?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE struts PUBLIC
-//Apache Software Foundation//DTD Struts Configuration 2.0//EN
http://struts.apache.org/dtds/struts-2.0.dtd;

struts
constant name=struts.custom.i18n.resources
value=ApplicationResources /
constant name=struts.devMode value=true /
constant name=struts.convention.result.path value=/content /
constant name=struts.multipart.saveDir value=/tmp /
constant name=struts.multipart.maxSize value=4194304 /
constant name=struts.action.excludePattern value=/api/.*? /

/struts

*web.xml*

display-nameApplication/display-name
welcome-file-list
  welcome-fileindex.html/welcome-file
/welcome-file-list

filter
filter-namestruts2/filter-name

filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter/filter-class
/filter

filter-mapping
filter-namestruts2/filter-name
url-pattern/*/url-pattern
/filter-mapping

listener

listener-classorg.springframework.web.context.ContextLoaderListener/listener-class

/listener

servlet
  servlet-nameResteasy/servlet-name

servlet-classorg.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher/servlet-class
/servlet
servlet-mapping
  servlet-nameResteasy/servlet-name
  url-pattern/api/*/url-pattern
/servlet-mapping
context-param
param-nameresteasy.scan/param-name
param-valuetrue/param-value
/context-param
context-param
  param-nameresteasy.servlet.mapping.prefix/param-name
  param-value/api/param-value
/context-param
listener

listener-classorg.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap/listener-class
/listener

*applicationContext.xml*

?xml version=1.0 encoding=UTF-8?
beans xmlns=http://www.springframework.org/schema/beans;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:aop=
http://www.springframework.org/schema/aop;
   xmlns:tx=http://www.springframework.org/schema/tx;
   xsi:schemaLocation=
  http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd;
/beans

*Action Class*
@Namespace(/units)
@Result(
type = stream,
params = {
inputName, stream
}
)
public class PropertyTypeAction extends BaseAction implements ActionImpl{

@PersistenceUnit
private EntityManagerFactory emf;

@Action(value=add)
public String add() {
...

}
}

*Ajax Request firebug report, XML tab*
XML Parsing Error: no element found Location:
moz-nullprincipal:{7fc640bd-f293-4956-8cf2-178765cec735} Line Number 1,
Column 1:

My request is how can i configure struts-spring plugin to work with struts
convention plugin with the annotations.


How do i prevent Struts 2 json plugin from escaping already formated json?

2015-02-18 Thread bavon mike
I already have a json string like:

{name: Simple name, description: simple description}

When using Struts 2 json plugin, it returns escaped string like:

{\name\: \Simple name\, \description\: \simple description\}

How do i configure struts 2 plugin to avoid this escaping?

Regards
Mike


Re: Struts 2 jQuery autocompleter and dynamic list

2013-05-29 Thread Mike Hao
Hi Antonios,

Thank you so much for your response. I was actually keep reading the wiki
these days, but I am still not able to get what I expected.


For sj:autocompleter, can these two attribute list and href used
together?

Thanks,
Mike


On Wed, May 29, 2013 at 4:13 AM, Antonios Gkogkakis gkogk...@tcd.ie wrote:

 Hi Mike,

 have a look at the following link
 https://code.google.com/p/struts2-jquery/wiki/AutocompleterTag

 Antonios



 On 29 May 2013 01:50, Mike Hao mike@gmail.com wrote:

  I am trying to implement an auto complete feature using Struts 2 jQuery
  plugin - sj:autocompleter. The suggestion list need to be dynamically
  retrieved from backend based on the characters user entered. Is it
 possible
  to implement this behaviour using S2 jQuery plugin? Does anyone has a
 good
  example?
 
  I could not find such an example in showcase.
 
  Thanks,
  Mike
 



Re: Struts 2 jQuery autocompleter and dynamic list

2013-05-29 Thread Mike Hao
Hi Antonios and Dave,

Thanks again for your responses. I actually downloaded the whole showcase
project, and trying debugging on my local machine, trying to figure out
what's the trick of it. At here, I think if the wiki pages provides more
detail instructions on how to set some critical attributes, that would be a
great help to users. I think I am not only one get confused. Like the
variable term declared in the Autocompleter.java class. Nowhere tells
users what's this guy, how to use it. Now, I finally figured out that this
term is used to catch the characters user typed in.

I actually tried this several months ago, and could not get it working. So,
I gave it up. Now, I came back again, since I have to.

Regards,
Mike



On Wed, May 29, 2013 at 2:39 PM, Dave Newton davelnew...@gmail.com wrote:

 I'd just try it; seems like `list` would be for immediate data (e.g., on
 first page load) and then it would be replaced by data from
 `href`--although I'm not sure what the point of using both would be.

 Dave


 On Wed, May 29, 2013 at 2:25 PM, Antonios Gkogkakis gkogk...@tcd.ie
 wrote:

  I haven't used the sj:autocompleter (I'm using the jQuery
  autocompletedirectly), but from what I'm reading in the documentation
  if you use the href that points to a location that is returning json data
  you don't have to use the list attribute.
 
  Have you tried setting up the  example in the documentation?
 
 
 
 
 
  On 29 May 2013 18:57, Mike Hao mike@gmail.com wrote:
 
   Hi Antonios,
  
   Thank you so much for your response. I was actually keep reading the
 wiki
   these days, but I am still not able to get what I expected.
  
  
   For sj:autocompleter, can these two attribute list and href used
   together?
  
   Thanks,
   Mike
  
  
   On Wed, May 29, 2013 at 4:13 AM, Antonios Gkogkakis gkogk...@tcd.ie
   wrote:
  
Hi Mike,
   
have a look at the following link
https://code.google.com/p/struts2-jquery/wiki/AutocompleterTag
   
Antonios
   
   
   
On 29 May 2013 01:50, Mike Hao mike@gmail.com wrote:
   
 I am trying to implement an auto complete feature using Struts 2
  jQuery
 plugin - sj:autocompleter. The suggestion list need to be
  dynamically
 retrieved from backend based on the characters user entered. Is it
possible
 to implement this behaviour using S2 jQuery plugin? Does anyone
 has a
good
 example?

 I could not find such an example in showcase.

 Thanks,
 Mike

   
  
 



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



Struts 2 jQuery autocompleter and dynamic list

2013-05-28 Thread Mike Hao
I am trying to implement an auto complete feature using Struts 2 jQuery
plugin - sj:autocompleter. The suggestion list need to be dynamically
retrieved from backend based on the characters user entered. Is it possible
to implement this behaviour using S2 jQuery plugin? Does anyone has a good
example?

I could not find such an example in showcase.

Thanks,
Mike


Re: struts 2 ajax choice

2013-05-13 Thread Mike Hao
Will the S2 jQuery plugin provide the similar functions as S2 dojo plugin?
Is S2 jQuery plugin maintained by Struts 2 team? I am using Dojo plugin
right now, and it works pretty well. Could anyone give me explanation why
S2 Dojo plugin get deprecated?

Thanks,
Mike


On Mon, May 13, 2013 at 5:48 PM, Dave Newton davelnew...@gmail.com wrote:

 They're not even close to being the same thing.

 The JSON plugin provides JSON de/serialization. The Dojo plugin was a
 complete client-side tag library.

 There's the S2 jQuery plugin [1] which would be the non-official equivalent
 of the old Dojo taglib.

 Dave

 [1] http://code.google.com/p/struts2-jquery/



 On Mon, May 13, 2013 at 5:47 PM, john lee sh_thorn_b...@yahoo.com wrote:

 
 
  So, JSON is the only choice ?
 
  thanks
 
  john
 
 
 
  
   From: Paul Benedict pbened...@apache.org
  To: Struts Users Mailing List user@struts.apache.org; john lee 
  sh_thorn_b...@yahoo.com
  Sent: Monday, May 13, 2013 4:43 PM
  Subject: Re: struts 2 ajax choice
 
 
  Please note the Dojo plugin is deprecated.
 
 
  On Mon, May 13, 2013 at 4:42 PM, john lee sh_thorn_b...@yahoo.com
 wrote:
 
  
  
   from the document,
  
  
   Struts 2 support both DoJo plugin and JSON plugin,
  
  
   which one is easy to plugin and use?
  
  
   which one is more powerful?
  
   thanks in advance
  
   john
 



 --
 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: struts 2 ajax choice

2013-05-13 Thread Mike Hao
Hi Dave,

Thank you so much for your quick response and your explanations.

Regards,
Mike


On Mon, May 13, 2013 at 6:03 PM, Dave Newton davelnew...@gmail.com wrote:

 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



Problem with struts 2.3.4.1 struts2-rest-showcase on Tomcat

2012-08-13 Thread Mike Esler
Hello all,

I'm having problems running the struts2-rest-showcase WAR that is
packaged with Struts 2.3.4.1 (2.3.4 as well).  Both Tomcat and Struts
should be stock configurations.  The other struts showcases seem to
work fine. Should this showcase work on a stock Tomcat build for
win64?

I've tried on Tomcat 6 and 7, both on JDK 1.6.0_33 on Win7 64-bit.
Here is the message I get on the default /orders request:

  There is no Action mapped for namespace / and action name orders.

If anyone could point me in the right direction, I would be most grateful.


Regards,
Mike



Request logs for http://localhost:8080/struts2-rest-showcase/orders

WARNING: Could not find action or result
There is no Action mapped for namespace / and action name orders. -
[unknown location]
at 
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
at 
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:70)
at 
org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:51)
at 
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:501)
at 
org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at 
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)

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



RE: Any way to load resources in java.util.ResourceBundle

2010-07-16 Thread Mike Fotiou
Greg,

  I implemented this by creating my own ResourceBundle implementation 
(DataResourceBundle).  This handles all of the database access and returns 
the appropriate string to Struts by key when asked.

It is enabled by adding the following constant in struts.xml:

constant name=struts.custom.i18n.resources 
value=xxx.utils.content.DataResourceBundle/ 

Finally, in the view, you must wrap an i18n tag for the text-based tags to work 
properly:

@s.i18n name=.utils.content.DataResourceBundle

I'm not sure if this is the best way, but it also allows me to control the 
caching aspect of the bundle, as Struts 2 and even Java will cache a resource 
bundle on their own.  During development, I wanted to be able to reload the 
language tables easily.

Note that for other languages you must make shell bundles like 
DataResourceBundle_fr which simply extends DataResourceBundle and sets the 
getLocale() method appropriately.

Mike

-Original Message-
From: Greg Akins [mailto:angryg...@gmail.com] 
Sent: Friday, July 16, 2010 7:58 AM
To: user@struts.apache.org
Subject: Re: Any way to load resources in java.util.ResourceBundle

I'm resurrecting this message because I have the same need.

I'm converting some code to Struts2, from a JSP/Servlet application.
Currently we create bundles from a database, that have keys per customer and 
language for most of the text in our application.

A simple solution to this would be to override 
LocalizedTextUtil.findDefaultText and add a call to our classes that load the 
text into a ResourceBundle.

However it doesn't look like there is anyway, in Struts 2.1.8.1 to use my own 
version of LocalizedTextUtil.

Does anyone have any thoughts on how I might do this?

On Wed, Jan 27, 2010 at 12:43 PM, Bhaarat Sharma bhaara...@xwrote:

 We have seen situations where sometimes the global resource bundles 
 are lost intermittently for some sessions. We are in a 
 clustered/shared environment where multiple apps are deployed onto a 
 GlassFishV2 server.
 Multiple apps share the struts2 core jars.

 We have some pages where we have written a custom Resource loader and 
 everything looks fine on these pages. Problem is on pages that utilize 
 s:text name=my.label.name/. Our properties files reside globally 
 in WEB-INF/lib

 Our custom resource loader works as follows in a JSP

 %CustomMessageResrouce cusResource = new 
 CustomMessageResource(Resource)%
 %= cusResource.getMessage(my.label.name)%

 Java code for it looks like:
 import java.util.ResourceBundle;
 ResourceBundle resource = ResourceBundle.getBundle(baseName);


 So we know that loading properties into resourcebundles and using them 
 as shown above works.

 My question is..can we do the same for struts2. Can we forcefully load 
 the resourcebundles inside java.util.ResourceBundle and then have them 
 be used in s:text tag?

--
Greg Akins

http://insomnia-consulting.org
http://www.pghcodingdojo.org
http://pittjug.dev.java.net
http://twitter.com/akinsgre
http://www.linkedin.com/in/akinsgre

-
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: Any way to load resources in java.util.ResourceBundle

2010-07-16 Thread Mike Fotiou
Yes, kind of.  I'm using Freemarker.  There is a master template that all other 
pages extend, if you will, so the i18n tag encompasses the entire content page 
and only has to be defined once.  Anything included within that tag will use 
the specified resource bundle.

Mike 

-Original Message-
From: Greg Akins [mailto:angryg...@gmail.com] 
Sent: Friday, July 16, 2010 9:34 AM
To: Mike Fotiou
Cc: user@struts.apache.org
Subject: Re: Any way to load resources in java.util.ResourceBundle

Thanks Mike

On Fri, Jul 16, 2010 at 8:21 AM, Mike Fotiou mike.fot...@tpsgc-pwgsc.gc.ca 
wrote:
  I implemented this by creating my own ResourceBundle implementation 
 (DataResourceBundle).  This handles all of the database access and returns 
 the appropriate string to Struts by key when asked.


We already have a DataResourceBundle.. and I was hoping I could use that.  So 
this is good news.

 Finally, in the view, you must wrap an i18n tag for the text-based tags to 
 work properly:

 @s.i18n name=.utils.content.DataResourceBundle

I'm new to Struts, so this might be a stupid question.. is there anyway to 
define that globally?  I'm using SiteMesh, so maybe defining it in a decorator 
might be good enough?


 -Original Message-
 From: Greg Akins [mailto:angryg...@gmail.com]
 Sent: Friday, July 16, 2010 7:58 AM
 To: user@struts.apache.org
 Subject: Re: Any way to load resources in java.util.ResourceBundle

 I'm resurrecting this message because I have the same need.

 I'm converting some code to Struts2, from a JSP/Servlet application.
 Currently we create bundles from a database, that have keys per customer and 
 language for most of the text in our application.

 A simple solution to this would be to override 
 LocalizedTextUtil.findDefaultText and add a call to our classes that load the 
 text into a ResourceBundle.

 However it doesn't look like there is anyway, in Struts 2.1.8.1 to use my own 
 version of LocalizedTextUtil.

 Does anyone have any thoughts on how I might do this?

 On Wed, Jan 27, 2010 at 12:43 PM, Bhaarat Sharma bhaara...@xwrote:

 We have seen situations where sometimes the global resource bundles 
 are lost intermittently for some sessions. We are in a 
 clustered/shared environment where multiple apps are deployed onto a 
 GlassFishV2 server.
 Multiple apps share the struts2 core jars.

 We have some pages where we have written a custom Resource loader and 
 everything looks fine on these pages. Problem is on pages that 
 utilize s:text name=my.label.name/. Our properties files reside 
 globally in WEB-INF/lib

 Our custom resource loader works as follows in a JSP

 %CustomMessageResrouce cusResource = new 
 CustomMessageResource(Resource)%
 %= cusResource.getMessage(my.label.name)%

 Java code for it looks like:
 import java.util.ResourceBundle;
 ResourceBundle resource = ResourceBundle.getBundle(baseName);


 So we know that loading properties into resourcebundles and using 
 them as shown above works.

 My question is..can we do the same for struts2. Can we forcefully 
 load the resourcebundles inside java.util.ResourceBundle and then 
 have them be used in s:text tag?

 --
 Greg Akins

 http://insomnia-consulting.org
 http://www.pghcodingdojo.org
 http://pittjug.dev.java.net
 http://twitter.com/akinsgre
 http://www.linkedin.com/in/akinsgre

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





--
Greg Akins

http://insomnia-consulting.org
http://www.pghcodingdojo.org
http://pittjug.dev.java.net
http://twitter.com/akinsgre
http://www.linkedin.com/in/akinsgre

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



S Mike Pradaxay/0A/Caterpillar is out of the office.

2009-12-17 Thread S Mike Pradaxay

I will be out of the office starting  12/17/2009 and will not return until
01/04/2010.

I'll respond to your message upon my return.  Thanks!


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



RE: Inline downloading of file with Struts 1.2

2009-11-03 Thread Mike Baranski


-Original Message-
From: Daniele Development-ML [mailto:daniele@googlemail.com]
Sent: Tuesday, November 03, 2009 8:58 AM
To: Struts Users Mailing List
Subject: Re: Inline downloading of file with Struts 1.2

Hello,

I was wondering if any of the more experience people have suggestion
about
this issue. The problem is that Firefox 3.5 - differently from Firefox 2
-
does not process automatically XUL files zipped in jar files, if the jar
file is requested to be downloaded as attachment rather than inline
within
the browser window.

Any suggestion/help, much appreciated!

Dan

On Fri, Oct 30, 2009 at 7:25 PM, Daniele Development-ML 
daniele@googlemail.com wrote:

 Hello,

 I'm coding a Struts 1.2 action to download file available on the
server. I
 need to send back the file as inline so that the browser will process
it
 within the same window.

 the relevant code is :

 response.setContentType(application/java-archive);
 response.setHeader(Content-disposition, inline;
filename=file.jar);

 However, when I try accessing the URL the Apache http client give the
 following response:

 HTTP/1.1 200 OK
 Response content length: -1
 Content-Type = application/java-archive

 With length -1.

 Any suggestion on how could I do this? It's essential that the jar
file is
 processed within the browser window, as the file incorporates an XUL
(XML
 file) that needs automatically be processed by Firefox.

 Many thanks,

 Dan


Here are 2 examples, the first displays inline, and the second forces a
download, both using the same action.

action name=personImage class=StreamImageAction
result name=success type=stream
param name=contentTypeimage/jpeg/param
param name=inputNameinputStream/param
param
name=contentDispositionfilename=image.jpg/param
param name=bufferSize1024/param
/result
/action

action name=saveImage class=StreamImageAction
result name=success type=stream
param name=contentTypeimage/jpeg/param
param name=inputNameinputStream/param
param name=contentDispositionattachment;
filename=image.jpg/param
param name=bufferSize1024/param
/result
/action


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



RE: Adding Json to existing action

2009-10-27 Thread Mike Baranski
I do this to pass parameters, using prototype js:

s:set name=foo value=%{'door' + door.id}/
s:set name=form_name value=%{'form_door' + door.id}/

s:set name=door_description value=getText(#foo)/
s:if test=door.state == 1
s:url id=door_url action=unlocks:param name=door.id
value=door.id//s:url
s:form method=POST action=unlock id=%{#form_name}
onsubmit=return false;
s:hidden name=door.id/
s:hidden name=door.state/
s:url var=locked_image
value=/pages/door-control/images/locked.png /
s:submit type=image alt=Locked
src=%{locked_image} onclick=%{'new Ajax.Updater(\\'' + #foo +'\\', \\'' +
#door_url + '\\', {evalScripts: true}); return false;'}/
/s:form

/s:if

-Original Message-
From: Struts Two [mailto:struts...@yahoo.ca]
Sent: Tuesday, October 27, 2009 9:24 AM
To: Struts Users Mailing List
Subject: Re: Adding Json to existing action

You can either use Json plugin or write your own customized result type
that return JSON.

--- On Tue, 10/27/09, Michael Varlik m.var...@gmx.de wrote:

 From: Michael Varlik m.var...@gmx.de
 Subject: Adding Json to existing action
 To: user@struts.apache.org
 Received: Tuesday, October 27, 2009, 1:07 PM
 Hi,

 I need to call an existing struts action within my
 application from a
 JavaScript function. I thought it might be possible to
 create an additional entry in the struts mapping file like
 this:

 action name=getDataJson
 class=com.mypackage.MyAction method=getData
 result type=json /
 /action

 and then call the action with getDataJson.action.
 Unfortunately, when I try this a NullPointerException
 occurs in the action code. It seems, some parameters are not
 properly initialized.

 What I'd like to know is: what is the recommendet way of
 calling an existing action to get JSON results? Is it a good
 idea to do this at all?

 Cheers,
 Markus
 --
 Neu: GMX DSL bis 50.000 kBit/s und 200,- Euro
 Startguthaben!
 http://portal.gmx.net/de/go/dsl02

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




  __
Looking for the perfect gift? Give the gift of Flickr!

http://www.flickr.com/gift/

-
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: Show jsps from different directories based on theme

2009-10-21 Thread Mike Baranski
  If you're using S2, you could always return the 'theme1' or 'theme2'
result in
 your action class and have the mapping for it.

 That's absolutely a disgusting idea, think about 10 themes, and add to
 that user installable themes...

 A switch() at end of each of the action methods... no way.


I totally agree with you.  However, I'm just giving Brian options to
assess his situation: number of themes, whether to implement another set
of library (more possible bugs, more memory usage, bigger code base,
dependency issues, etc), potential growth of his project, etc...
Personally, I don't prefer the selection of separate theme pages.  I
only use 1 page for the and change the CSS and layout within that page
via include.  Thus, no need for Tiles.  Example, for a full layout:
header, left side bar, content in the middle, right side bar, footer.  I
could then choose dynamically to whether include the left, right, or
both side bar(s) for the other variations.  Using this approach may
require themes in DB backend.  But it will give you the best flexibility
since there's no need to redeploy your web app just because your
client/customer want to have another theme layout with same content :)
When I look at redeployment, I see downtime.  Perhaps Brian
 could also look into JSP Tags too.  I haven't finished my in depth look
in it but it looks very promising.


Well, my theme is basically different users that have systems with user
defined fields, and different stuff stored in them.  i.e. user1 at customer
x may be sensitive data that they don't want displayed, so it needs to not
be shown, while user y may have something they want displayed by the app.
It's not really about layout, but about what is shown or not shown for
different installations.



  Or you could just use Tiles?

 Hopefully it helps, although I don't know how. I have only used Struts
 1.2.x and Tiles for it, and never did themes..

 --
 http://www.iki.fi/jarif/

 Life is to you a dashing and bold adventure.


-
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



Show jsps from different directories based on theme

2009-10-20 Thread Mike Baranski
So, I want to ship 2 versions (or more) of my views.

The will be in 
/pages/jsps/theme1/x.jsp
and
/pages/jsps/theme2/x.jsp

I want the user to be allowed to set the theme, and my result tag in the xml
be something like:

/pages/jsps/{selected_theme}/x.jsp

Can I do that?


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



RE: How to get value of tag attribute from OGNL?

2009-10-13 Thread Mike Baranski
Why not use this?
http://struts.apache.org/2.1.6/docs/set.html

-Original Message-
From: Alex Siman [mailto:aleksandr.si...@gmail.com]
Sent: Tuesday, October 13, 2009 9:25 AM
To: user@struts.apache.org
Subject: Re: How to get value of tag attribute from OGNL?


OK, I figured out how to get value of tag attribute in JSP:

   %= jspContext.getAttribute(fieldName, PageContext.PAGE_SCOPE)
%

Now I need to put this value into some OGNL variable, say
'#ognlFieldName',
to get access to this value from Struts2 tags.

So, how to get access to jspContext from OGNL or at least Java code?
--
View this message in context: http://www.nabble.com/How-to-get-value-of-
tag-attribute-from-OGNL--tp25862967p25872856.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



RE: Do something based on existence of action error - How?

2009-10-09 Thread Mike Baranski
I put the following in a DIV at the top of every page:

%@ taglib prefix=s uri=/struts-tags %
s:include value=/pages/common/jsps/header.jsp /
body
div id='top_div'
h1s:text name=co_title//h1
s:include value=/pages/common/jsps/menu.jsp /
/div
div id=body_div
s:if test=hasErrors()
h1 class=errors:property
value='getText(co_error)'//h1
ul
s:if test=hasActionErrors()
s:iterator
value=actionErrors
li
class=errors:property//li
/s:iterator
/s:if
s:if test=hasFieldErrors()
s:iterator
value=fieldErrors
s:iterator
value=value
li
class=errors:property//li
/s:iterator
/s:iterator
/s:if
/ul
/div
/s:if
s:include value=/pages/common/jsps/footer.jsp /


-Original Message-
From: james billa [mailto:jambi...@gmail.com]
Sent: Friday, October 09, 2009 12:25 PM
To: user@struts.apache.org
Subject: Do something based on existence of action error - How?

Hi ,

I am using Struts 2.1.6. I want to show the content  a tr only if
action
error exists. If not I don't want to show the content of my tr. How do
I
check whether action error exists or not in my page? The action error is
set
by my action class if there is an error.

I have done to coding (CSS) to show or hide the tr. But not sure how
to
implement it by checking the action error. Thanks.

Thanks
JB


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



Custom Property Tag

2009-10-06 Thread Mike Baranski
I need to show certain fields to certain users based on permissions
(per-user).  I was going to create a custom s:property tag, which would
access an IUser object on the value stack.  In the tag, it will do:

If (getUser().canAccess('property_name'))
Then
Render the tag/value
Else
Render nothing

I cannot figure out how exactly to get the user object on the value stack,
and which file contains the property tag implementation.  Could someone
suggest where to start?

Thanks,
Mike.



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



RE: Custom Property Tag

2009-10-06 Thread Mike Baranski
Thanks Wes!  That's exactly what I needed to get started.

M.

-Original Message-
From: Wes Wannemacher [mailto:w...@wantii.com]
Sent: Tuesday, October 06, 2009 11:33 AM
To: Struts Users Mailing List
Subject: Re: Custom Property Tag

I did something similar, but I used s:if as an example. Rather than
show or not show in a s:property tag-like setup, i felt like s:if did
the job much better. If you want an example, check out

core/src/main/java/org/apache/struts2/views/jsp/IfTag.java
core/src/main/java/org/apache/struts2/views/freemarker/tags/IfModel.java
core/src/main/java/org/apache/struts2/components/If.java

Then, check out the pom.xml file for a clue how to use the annotations
you'll see in there to generate a TLD file for the tag. Also, the
views/freemarker thing isn't necessary, but if you plan to use
Freemarker, you'll have to create a freemarker template manager (which
is pretty simple, check the source of the bean that the
struts-default.xml defines for an example).

-Wes

On Tue, Oct 6, 2009 at 10:36 AM, Mike Baranski
list-subscripti...@secmgmt.com wrote:
 I need to show certain fields to certain users based on permissions
 (per-user).  I was going to create a custom s:property tag, which
would
 access an IUser object on the value stack.  In the tag, it will do:

 If (getUser().canAccess('property_name'))
 Then
 Render the tag/value
 Else
 Render nothing

 I cannot figure out how exactly to get the user object on the value
stack,
 and which file contains the property tag implementation.  Could
someone
 suggest where to start?

 Thanks,
 Mike.



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





--
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

-
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: Create new theme in struts Tutorial

2009-10-01 Thread Mike Baranski
This should get you started, it took me forever to figure it all out...

http://mikeski.net/site/node/16

-Original Message-
From: Eduard Neuwirt [mailto:eduard.neuw...@googlemail.com]
Sent: Wednesday, September 30, 2009 3:33 PM
To: Struts Users Mailing List
Subject: Re: Create new theme in struts Tutorial

Hi Martin,

I have two kinds of forms. Table view and Entity View for different
entities and tables. The look-and-feel shall be the same, only the
content and columns differ.
I don't use any template library.
CSS is planned.

Eduard Neuwirt

Martin Gainty schrieb:
 i would have to agree with patrick in saying its easier to wrap the
simple theme than creating from scratch
 http://struts.apache.org/2.0.14/docs/extending-themes.html

 a few questions:
 what is the purpose of this theme?
 which Template Libraries would you be using?
 will you be using CSS?

 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: Wed, 30 Sep 2009 21:03:27 +0200
 From: eduard.neuw...@googlemail.com
 To: user@struts.apache.org
 Subject: Create new theme in struts Tutorial

 Hello,

 I am trying to create my own Struts theme. The topic seems to be
rather
 rarely. I am looking for an tutorial or how to guide describing this.
 Does a tutorial exist ? Is it useful to create a won theme ?

 Regards
 Eduard



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



 _
 Insert movie times and more without leaving Hotmail®.

http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tu
torial_QuickAdd_062009



-
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: Interceptor IOC with Spring

2009-09-24 Thread Mike Baranski
OK, I'm stuck.

applicationContext.xml (snipped):
bean id=sMCBaseAction class=com.secmgmt.struts2.base.SMCBaseAction
/bean

struts.xml (snipped):
constant name=struts.objectFactory
value=org.apache.struts2.spring.StrutsSpringObjectFactory /

interceptor-stack name=validationWorkflowStack
interceptor-ref name=redirectMessage/
interceptor-ref name=prepare/
interceptor-ref name=basicStack/
interceptor-ref name=validation/
interceptor-ref name=operatorHistory/
interceptor-ref name=passwordExpired/
interceptor-ref name=workflow/
/interceptor-stack
default-interceptor-ref name=validationWorkflowStack /

PasswordExpiredInterceptor method:
public void setSMCBaseAction(SMCBaseAction b) throws Exception
{
this.action = b;
l.debug(Calling setSMCBaseAction with:  + b);
this.initMe();
}

Actions (and my operatorHistory) interceptor have *other* beans injected
just fine.  Can someone point out where I'm going wrong (I'm sure it's
something stupid).

Thanks!

-Original Message-
From: Mike Baranski [mailto:list-subscripti...@secmgmt.com]
Sent: Wednesday, September 23, 2009 2:17 PM
To: 'Struts Users Mailing List'
Subject: RE: Interceptor IOC with Spring

Doh!  Sorry for the goose chase, I'll review my code and post it if I'm
still stuck...

-Original Message-
From: Musachy Barroso [mailto:musa...@gmail.com]
Sent: Wednesday, September 23, 2009 1:59 PM
To: Struts Users Mailing List
Subject: Re: Interceptor IOC with Spring

Meh, it all works. Autorired with/without annotations and @Resource
also works (in interceptors). @OP, something is wrong in your
configuration, show us the code :)

musachy

On Wed, Sep 23, 2009 at 10:51 AM, Musachy Barroso musa...@gmail.com
wrote:
 Chris, if autowiring works then using @Autowire with @Qualifier
 (equivalent to @Resource) should also work, I have to try that.

 musachy

 On Wed, Sep 23, 2009 at 9:18 AM, Chris Pratt
thechrispr...@gmail.com
wrote:
 In my struts.xml I have:

  constant name=struts.objectFactory value=spring/

 And at the top of my applicationContext.xml I have:

 beans default-autowire=autodetect xmlns=...

 And my Interceptors are getting injected just fine.  On another
project, I
 have autowiring turned off, but then you have to define each
interceptor as
 a bean in the applicationContext.xml and specifically define the
objects
 that get injected into it.
  (*Chris*)

 On Wed, Sep 23, 2009 at 7:21 AM, Mike Baranski 
 list-subscripti...@secmgmt.com wrote:

 Correct me if I'm wrong, please, but if I have an interceptor, it
should
 get
 injected by spring.

 I have a bean I'm expecting, the set method written, and the bean
defined
 in
 applicationContext.

 My main struts.xml has:

 constant name=struts.objectFactory
 value=org.apache.struts2.spring.StrutsSpringObjectFactory /

 My setter is not getting called, is there anything else I need to
do?


 M.


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






 --
 Hey you! Would you help me to carry the stone? Pink Floyd




--
Hey you! Would you help me to carry the stone? Pink Floyd

-
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: Interceptor IOC with Spring

2009-09-24 Thread Mike Baranski
beans xmlns=http://www.springframework.org/schema/beans;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xmlns:util=http://www.springframework.org/schema/util;
   xsi:schemaLocation=http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-2.0.xsd;
default-autowire=byName

-Original Message-
From: Chris Pratt [mailto:thechrispr...@gmail.com]
Sent: Thursday, September 24, 2009 11:29 AM
To: Struts Users Mailing List
Subject: Re: Interceptor IOC with Spring

What do you have default-autowire set to in your applicationContext.xml?
  (*Chris*)

On Thu, Sep 24, 2009 at 8:08 AM, Mike Baranski 
list-subscripti...@secmgmt.com wrote:

 OK, I'm stuck.

 applicationContext.xml (snipped):
 bean id=sMCBaseAction
class=com.secmgmt.struts2.base.SMCBaseAction
 /bean

 struts.xml (snipped):
 constant name=struts.objectFactory
 value=org.apache.struts2.spring.StrutsSpringObjectFactory /

 interceptor-stack name=validationWorkflowStack
interceptor-ref
name=redirectMessage/
interceptor-ref name=prepare/
interceptor-ref name=basicStack/
interceptor-ref name=validation/
interceptor-ref
name=operatorHistory/
interceptor-ref
name=passwordExpired/
interceptor-ref name=workflow/
 /interceptor-stack
 default-interceptor-ref name=validationWorkflowStack /

 PasswordExpiredInterceptor method:
 public void setSMCBaseAction(SMCBaseAction b) throws Exception
{
this.action = b;
l.debug(Calling setSMCBaseAction with:  + b);
this.initMe();
}

 Actions (and my operatorHistory) interceptor have *other* beans
injected
 just fine.  Can someone point out where I'm going wrong (I'm sure it's
 something stupid).

 Thanks!

 -Original Message-
 From: Mike Baranski [mailto:list-subscripti...@secmgmt.com]
 Sent: Wednesday, September 23, 2009 2:17 PM
 To: 'Struts Users Mailing List'
 Subject: RE: Interceptor IOC with Spring
 
 Doh!  Sorry for the goose chase, I'll review my code and post it if
I'm
 still stuck...
 
 -Original Message-
 From: Musachy Barroso [mailto:musa...@gmail.com]
 Sent: Wednesday, September 23, 2009 1:59 PM
 To: Struts Users Mailing List
 Subject: Re: Interceptor IOC with Spring
 
 Meh, it all works. Autorired with/without annotations and @Resource
 also works (in interceptors). @OP, something is wrong in your
 configuration, show us the code :)
 
 musachy
 
 On Wed, Sep 23, 2009 at 10:51 AM, Musachy Barroso
musa...@gmail.com
 wrote:
  Chris, if autowiring works then using @Autowire with @Qualifier
  (equivalent to @Resource) should also work, I have to try that.
 
  musachy
 
  On Wed, Sep 23, 2009 at 9:18 AM, Chris Pratt
 thechrispr...@gmail.com
 wrote:
  In my struts.xml I have:
 
   constant name=struts.objectFactory value=spring/
 
  And at the top of my applicationContext.xml I have:
 
  beans default-autowire=autodetect xmlns=...
 
  And my Interceptors are getting injected just fine.  On another
 project, I
  have autowiring turned off, but then you have to define each
 interceptor as
  a bean in the applicationContext.xml and specifically define the
 objects
  that get injected into it.
   (*Chris*)
 
  On Wed, Sep 23, 2009 at 7:21 AM, Mike Baranski 
  list-subscripti...@secmgmt.com wrote:
 
  Correct me if I'm wrong, please, but if I have an interceptor,
it
 should
  get
  injected by spring.
 
  I have a bean I'm expecting, the set method written, and the
bean
 defined
  in
  applicationContext.
 
  My main struts.xml has:
 
  constant name=struts.objectFactory
  value=org.apache.struts2.spring.StrutsSpringObjectFactory /
 
  My setter is not getting called, is there anything else I need
to
 do?
 
 
  M.
 
 
  
---
 -
 -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 
 
 
  --
  Hey you! Would you help me to carry the stone? Pink Floyd
 
 
 
 
 --
 Hey you! Would you help me to carry the stone? Pink Floyd
 
 
-
 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: Interceptor IOC with Spring

2009-09-24 Thread Mike Baranski
Yes, and my other interceptor has my data source injected, and it's setup
the same way...

-Original Message-
From: Chris Pratt [mailto:thechrispr...@gmail.com]
Sent: Thursday, September 24, 2009 11:51 AM
To: Struts Users Mailing List
Subject: Re: Interceptor IOC with Spring

The only other difference I can see between my (working) example and
yours
is that I used the shortcut

constant name=struts.objectFactory value=spring /

I don't know if there's a difference under the covers or not.

Also, is the intercept method of your interceptor being called?
  (*Chris*)

On Thu, Sep 24, 2009 at 8:45 AM, Mike Baranski 
list-subscripti...@secmgmt.com wrote:

 beans xmlns=http://www.springframework.org/schema/beans;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xmlns:util=http://www.springframework.org/schema/util;
   xsi:schemaLocation=http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
 http://www.springframework.org/schema/util
 http://www.springframework.org/schema/util/spring-util-2.0.xsd;
 default-autowire=byName

 -Original Message-
 From: Chris Pratt [mailto:thechrispr...@gmail.com]
 Sent: Thursday, September 24, 2009 11:29 AM
 To: Struts Users Mailing List
 Subject: Re: Interceptor IOC with Spring
 
 What do you have default-autowire set to in your
applicationContext.xml?
   (*Chris*)
 
 On Thu, Sep 24, 2009 at 8:08 AM, Mike Baranski 
 list-subscripti...@secmgmt.com wrote:
 
  OK, I'm stuck.
 
  applicationContext.xml (snipped):
  bean id=sMCBaseAction
 class=com.secmgmt.struts2.base.SMCBaseAction
  /bean
 
  struts.xml (snipped):
  constant name=struts.objectFactory
  value=org.apache.struts2.spring.StrutsSpringObjectFactory /
 
  interceptor-stack name=validationWorkflowStack
 interceptor-ref
 name=redirectMessage/
 interceptor-ref name=prepare/
 interceptor-ref name=basicStack/
 interceptor-ref name=validation/
 interceptor-ref
 name=operatorHistory/
 interceptor-ref
 name=passwordExpired/
 interceptor-ref name=workflow/
  /interceptor-stack
  default-interceptor-ref name=validationWorkflowStack /
 
  PasswordExpiredInterceptor method:
  public void setSMCBaseAction(SMCBaseAction b) throws Exception
 {
 this.action = b;
 l.debug(Calling setSMCBaseAction with:  + b);
 this.initMe();
 }
 
  Actions (and my operatorHistory) interceptor have *other* beans
 injected
  just fine.  Can someone point out where I'm going wrong (I'm sure
it's
  something stupid).
 
  Thanks!
 
  -Original Message-
  From: Mike Baranski [mailto:list-subscripti...@secmgmt.com]
  Sent: Wednesday, September 23, 2009 2:17 PM
  To: 'Struts Users Mailing List'
  Subject: RE: Interceptor IOC with Spring
  
  Doh!  Sorry for the goose chase, I'll review my code and post it
if
 I'm
  still stuck...
  
  -Original Message-
  From: Musachy Barroso [mailto:musa...@gmail.com]
  Sent: Wednesday, September 23, 2009 1:59 PM
  To: Struts Users Mailing List
  Subject: Re: Interceptor IOC with Spring
  
  Meh, it all works. Autorired with/without annotations and
@Resource
  also works (in interceptors). @OP, something is wrong in your
  configuration, show us the code :)
  
  musachy
  
  On Wed, Sep 23, 2009 at 10:51 AM, Musachy Barroso
 musa...@gmail.com
  wrote:
   Chris, if autowiring works then using @Autowire with @Qualifier
   (equivalent to @Resource) should also work, I have to try that.
  
   musachy
  
   On Wed, Sep 23, 2009 at 9:18 AM, Chris Pratt
  thechrispr...@gmail.com
  wrote:
   In my struts.xml I have:
  
constant name=struts.objectFactory value=spring/
  
   And at the top of my applicationContext.xml I have:
  
   beans default-autowire=autodetect xmlns=...
  
   And my Interceptors are getting injected just fine.  On
another
  project, I
   have autowiring turned off, but then you have to define each
  interceptor as
   a bean in the applicationContext.xml and specifically define
the
  objects
   that get injected into it.
(*Chris*)
  
   On Wed, Sep 23, 2009 at 7:21 AM, Mike Baranski 
   list-subscripti...@secmgmt.com wrote:
  
   Correct me if I'm wrong, please, but if I have an
interceptor,
 it
  should
   get
   injected by spring.
  
   I have a bean I'm expecting, the set method written, and the
 bean
  defined
   in
   applicationContext.
  
   My main struts.xml has:
  
   constant name=struts.objectFactory
   value=org.apache.struts2.spring.StrutsSpringObjectFactory
/
  
   My setter is not getting called, is there anything else I
need
 to
  do?
  
  
   M.
  
  
   -
---
 ---
  -
  -
   To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
   For additional

RE: Interceptor IOC with Spring

2009-09-24 Thread Mike Baranski
Wow, thanks Chris, you're right.  Changing to baseAction as the bean name
and setBaseAction as the method name fixed it...

Strange, as I have other beans like that with funky names...

-Original Message-
From: Chris Pratt [mailto:thechrispr...@gmail.com]
Sent: Thursday, September 24, 2009 12:19 PM
To: Struts Users Mailing List
Subject: Re: Interceptor IOC with Spring

If you have working examples in the same application, there must be
something different about this instance.

Could it be the bean name?  I've been occasionally baffled by what you
have
to do with strangely cased bean names.  I've particularly had trouble
when
one of the automatically cased characters butts up against an uppercase
character (like ID, should it be iD, ID, id... depends on the system).

As a test, I'd define a second bean with a more typical name, referring
to
the same class and add a mutator for it to your interceptor.  See if
that
one gets injected, but not the original.
  (*Chris*)

On Thu, Sep 24, 2009 at 8:54 AM, Mike Baranski 
list-subscripti...@secmgmt.com wrote:

 Yes, and my other interceptor has my data source injected, and it's
setup
 the same way...

 -Original Message-
 From: Chris Pratt [mailto:thechrispr...@gmail.com]
 Sent: Thursday, September 24, 2009 11:51 AM
 To: Struts Users Mailing List
 Subject: Re: Interceptor IOC with Spring
 
 The only other difference I can see between my (working) example and
 yours
 is that I used the shortcut
 
 constant name=struts.objectFactory value=spring /
 
 I don't know if there's a difference under the covers or not.
 
 Also, is the intercept method of your interceptor being called?
   (*Chris*)
 
 On Thu, Sep 24, 2009 at 8:45 AM, Mike Baranski 
 list-subscripti...@secmgmt.com wrote:
 
  beans xmlns=http://www.springframework.org/schema/beans;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:util=http://www.springframework.org/schema/util;
 
xsi:schemaLocation=http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://www.springframework.org/schema/util
  http://www.springframework.org/schema/util/spring-util-2.0.xsd;
  default-autowire=byName
 
  -Original Message-
  From: Chris Pratt [mailto:thechrispr...@gmail.com]
  Sent: Thursday, September 24, 2009 11:29 AM
  To: Struts Users Mailing List
  Subject: Re: Interceptor IOC with Spring
  
  What do you have default-autowire set to in your
 applicationContext.xml?
(*Chris*)
  
  On Thu, Sep 24, 2009 at 8:08 AM, Mike Baranski 
  list-subscripti...@secmgmt.com wrote:
  
   OK, I'm stuck.
  
   applicationContext.xml (snipped):
   bean id=sMCBaseAction
  class=com.secmgmt.struts2.base.SMCBaseAction
   /bean
  
   struts.xml (snipped):
   constant name=struts.objectFactory
   value=org.apache.struts2.spring.StrutsSpringObjectFactory /
  
   interceptor-stack name=validationWorkflowStack
  interceptor-ref
  name=redirectMessage/
  interceptor-ref name=prepare/
  interceptor-ref
name=basicStack/
  interceptor-ref
name=validation/
  interceptor-ref
  name=operatorHistory/
  interceptor-ref
  name=passwordExpired/
  interceptor-ref
name=workflow/
   /interceptor-stack
   default-interceptor-ref name=validationWorkflowStack /
  
   PasswordExpiredInterceptor method:
   public void setSMCBaseAction(SMCBaseAction b) throws Exception
  {
  this.action = b;
  l.debug(Calling setSMCBaseAction with:  + b);
  this.initMe();
  }
  
   Actions (and my operatorHistory) interceptor have *other* beans
  injected
   just fine.  Can someone point out where I'm going wrong (I'm
sure
 it's
   something stupid).
  
   Thanks!
  
   -Original Message-
   From: Mike Baranski [mailto:list-subscripti...@secmgmt.com]
   Sent: Wednesday, September 23, 2009 2:17 PM
   To: 'Struts Users Mailing List'
   Subject: RE: Interceptor IOC with Spring
   
   Doh!  Sorry for the goose chase, I'll review my code and post
it
 if
  I'm
   still stuck...
   
   -Original Message-
   From: Musachy Barroso [mailto:musa...@gmail.com]
   Sent: Wednesday, September 23, 2009 1:59 PM
   To: Struts Users Mailing List
   Subject: Re: Interceptor IOC with Spring
   
   Meh, it all works. Autorired with/without annotations and
 @Resource
   also works (in interceptors). @OP, something is wrong in your
   configuration, show us the code :)
   
   musachy
   
   On Wed, Sep 23, 2009 at 10:51 AM, Musachy Barroso
  musa...@gmail.com
   wrote:
Chris, if autowiring works then using @Autowire with
@Qualifier
(equivalent to @Resource) should also work, I have to try
that.
   
musachy
   
On Wed, Sep 23, 2009 at 9:18 AM, Chris Pratt
   thechrispr...@gmail.com
   wrote

Interceptor IOC with Spring

2009-09-23 Thread Mike Baranski
Correct me if I'm wrong, please, but if I have an interceptor, it should get
injected by spring.

I have a bean I'm expecting, the set method written, and the bean defined in
applicationContext.

My main struts.xml has:

constant name=struts.objectFactory
value=org.apache.struts2.spring.StrutsSpringObjectFactory /

My setter is not getting called, is there anything else I need to do?


M.


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



RE: Interceptor IOC with Spring

2009-09-23 Thread Mike Baranski
OK, thanks, is there a JIRA for this?  I'll be happy to request it as an
enhancement...

-Original Message-
From: Musachy Barroso [mailto:musa...@gmail.com]
Sent: Wednesday, September 23, 2009 11:23 AM
To: Struts Users Mailing List
Subject: Re: Interceptor IOC with Spring

interceptors and  results do net get dependencies injected. If you
implement BeanFactoryAware, or ApplicationContextAware it will pass
you the bean factory or the context. I will take a look at this, as it
has been bothering me for a while.

musachy

On Wed, Sep 23, 2009 at 7:21 AM, Mike Baranski
list-subscripti...@secmgmt.com wrote:
 Correct me if I'm wrong, please, but if I have an interceptor, it
should get
 injected by spring.

 I have a bean I'm expecting, the set method written, and the bean
defined in
 applicationContext.

 My main struts.xml has:

 constant name=struts.objectFactory
 value=org.apache.struts2.spring.StrutsSpringObjectFactory /

 My setter is not getting called, is there anything else I need to do?


 M.


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





--
Hey you! Would you help me to carry the stone? Pink Floyd

-
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: Interceptor IOC with Spring

2009-09-23 Thread Mike Baranski
Doh!  Sorry for the goose chase, I'll review my code and post it if I'm
still stuck...

-Original Message-
From: Musachy Barroso [mailto:musa...@gmail.com]
Sent: Wednesday, September 23, 2009 1:59 PM
To: Struts Users Mailing List
Subject: Re: Interceptor IOC with Spring

Meh, it all works. Autorired with/without annotations and @Resource
also works (in interceptors). @OP, something is wrong in your
configuration, show us the code :)

musachy

On Wed, Sep 23, 2009 at 10:51 AM, Musachy Barroso musa...@gmail.com
wrote:
 Chris, if autowiring works then using @Autowire with @Qualifier
 (equivalent to @Resource) should also work, I have to try that.

 musachy

 On Wed, Sep 23, 2009 at 9:18 AM, Chris Pratt thechrispr...@gmail.com
wrote:
 In my struts.xml I have:

  constant name=struts.objectFactory value=spring/

 And at the top of my applicationContext.xml I have:

 beans default-autowire=autodetect xmlns=...

 And my Interceptors are getting injected just fine.  On another
project, I
 have autowiring turned off, but then you have to define each
interceptor as
 a bean in the applicationContext.xml and specifically define the
objects
 that get injected into it.
  (*Chris*)

 On Wed, Sep 23, 2009 at 7:21 AM, Mike Baranski 
 list-subscripti...@secmgmt.com wrote:

 Correct me if I'm wrong, please, but if I have an interceptor, it
should
 get
 injected by spring.

 I have a bean I'm expecting, the set method written, and the bean
defined
 in
 applicationContext.

 My main struts.xml has:

 constant name=struts.objectFactory
 value=org.apache.struts2.spring.StrutsSpringObjectFactory /

 My setter is not getting called, is there anything else I need to
do?


 M.


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






 --
 Hey you! Would you help me to carry the stone? Pink Floyd




--
Hey you! Would you help me to carry the stone? Pink Floyd

-
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: Calling an init method on an interceptor

2009-09-17 Thread Mike Baranski
Right, that sounds reasonable, and does not sound too sketchy to me, I just
need to do a DB query for a config value, and don't want it to happen for
every action.

M.

-Original Message-
From: Dale Newfield [mailto:d...@newfield.org]
Sent: Wednesday, September 16, 2009 4:12 PM
To: Struts Users Mailing List
Subject: Re: Calling an init method on an interceptor

Mike Baranski wrote:
 I'm using Spring IOC, and need struts to call an init() method on an
 interceptor *after* spring does its injection.

If you can detect in code when all the injections are done (all
associated private members are non-null), then you could add a
conditional call to your init method to the end of each DI setter, which
should result in it getting called once as the last injection
completes...  (kind of a hack, but it should work)

-Dale


-
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: Calling an init method on an interceptor

2009-09-17 Thread Mike Baranski
-Original Message-
From: Marty Milligan [mailto:milligansisl...@gmail.com]
Sent: Thursday, September 17, 2009 11:43 AM
To: Struts Users Mailing List
Subject: Re: Calling an init method on an interceptor

On Thu, Sep 17, 2009 at 10:19 AM, Mike Baranski
list-subscripti...@secmgmt.com wrote:
 Right, that sounds reasonable, and does not sound too sketchy to me, I
just
 need to do a DB query for a config value, and don't want it to happen
for
 every action.

Does it have to happen in Struts? There is a hook for this in Spring.

See init-method and destroy-method bean attributes.

I did see that, but I need spring to inject into the instantiated instance
from struts.xml, not the injected one from applicationContext.xml.  They
seem to be 2 different ones if I have it in both.

Maybe I can tell spring to grab the bean from struts, but I don't know how.


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




RE: Calling an init method on an interceptor

2009-09-17 Thread Mike Baranski

-Original Message-
From: Marty Milligan [mailto:milligansisl...@gmail.com]
Sent: Thursday, September 17, 2009 2:16 PM
To: Struts Users Mailing List
Subject: Re: Calling an init method on an interceptor

On Thu, Sep 17, 2009 at 1:03 PM, Mike Baranski
list-subscripti...@secmgmt.com wrote:
 I did see that, but I need spring to inject into the instantiated
instance
 from struts.xml, not the injected one from applicationContext.xml.
 They
 seem to be 2 different ones if I have it in both.

 Maybe I can tell spring to grab the bean from struts, but I don't know
how.

You can do it the other way round fairly easily.  Just use a Spring
object factory.  Just make sure the setters on the Spring side do
everything you need done before the init.

--


Thanks, I think I just didn't know what the spring object factory was
called so I couldn't search for it.  That should do it.



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



Calling an init method on an interceptor

2009-09-16 Thread Mike Baranski
I'm using Spring IOC, and need struts to call an init() method on an
interceptor *after* spring does its injection.

Can someone help, I'm stumped...




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



RE: [S2] Accessing objects in the Spring context?

2009-09-09 Thread Mike Baranski
Why not have a base action that has the setters and getters (which extends
ActionSupport), put the methods in there, and have all your actions extend
that instead of ActionSupport.

Mike.

-Original Message-
From: Musachy Barroso [mailto:musa...@gmail.com]
Sent: Tuesday, September 08, 2009 10:11 PM
To: Struts Users Mailing List
Subject: Re: [S2] Accessing objects in the Spring context?

I stand corrected. For some (unknown) reason I always thought that
interceptors and results where created by Class.forName(...)

musachy

On Tue, Sep 8, 2009 at 6:37 PM, Musachy Barrosomusa...@gmail.com
wrote:
 nope.

 On Tue, Sep 8, 2009 at 6:32 PM, James Carrjames.r.c...@gmail.com
wrote:
 Couldn't I just make it ApplicationContextAware?

 On Tue, Sep 8, 2009 at 8:27 PM, Musachy Barrosomusa...@gmail.com
wrote:

WebApplicationContextUtils.getRequiredWebApplicationContext(ServletActio
nContext.getServletContext());

 On Tue, Sep 8, 2009 at 6:12 PM, James Carrjames.r.c...@gmail.com
wrote:
 I can try it out... how can I make the bean factory available to my
interceptor?

 Thanks,
 James

 On Tue, Sep 8, 2009 at 6:12 PM, Wes Wannemacherw...@wantii.com
wrote:
 I guess I sort of misunderstood your problem. Another approach
would
 be to retrieve the beans in an interceptor and push them onto the
 value stack. As long as you give them a name they should be
available
 from the view. This approach will keep you from changing any of
the
 action code. If you want to get really tricky you could try to
figure
 out a declarative way to indicate which beans you want, per action
 invocation. I would whip up a quick example but I'm on my phone,
maybe
 later tonight if no one else steps to the challenge.

 On 9/8/09, James Carr james.r.c...@gmail.com wrote:
 Yeah, I was looking for a way around it... these are simple hash
maps
 that are used to display select options. I wound up with an
action
 with 5 Maps in it :(

 Thanks,
 James

 On Tue, Sep 8, 2009 at 4:26 PM, Wes Wannemacherw...@wantii.com
wrote:
 You could use the @Autowire annotation directly on a property...
But I
 don't really see how that is better than using setter-based
injection.
 Just because the beans are singletons doesn't mean anything
special,
 you still need a reference to them in your struts action.

 -Wes

 On Tue, Sep 8, 2009 at 5:13 PM, James
Carrjames.r.c...@gmail.com wrote:
 I have several singleton based beans defined in my
 applicationContext.xml and I'd like to just use these rather
than
 being forced to set them on my action. is there any way to
accomplish
 this?

 Thanks,
 James

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





 --
 Wes Wannemacher

 Head Engineer, WanTii, Inc.
 Need Training? Struts, Spring, Maven, Tomcat...
 Ask me for a quote!

 
-
 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




 --
 Wes Wannemacher

 Head Engineer, WanTii, Inc.
 Need Training? Struts, Spring, Maven, Tomcat...
 Ask me for a quote!

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





 --
 Hey you! Would you help me to carry the stone? Pink Floyd

 
-
 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





 --
 Hey you! Would you help me to carry the stone? Pink Floyd




--
Hey you! Would you help me to carry the stone? Pink Floyd

-
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



Interceptor question

2009-09-09 Thread Mike Baranski
I have a question about an interceptor.

If I run an interceptor on an action, then redirect, is the same interceptor
run on the redirected-to action?

I'm redirecting to a change password page if a password is over x days old,
so do I need to specify a different interceptor stack for the change
password action to prevent an infinite loop of redirection?

Thanks,
Mike.




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



RE: Session variables in s:radio buttons - preselection and formatting?

2009-09-02 Thread Mike Baranski
For #1, I don't know.

For #2, I did exactly that, see here:

http://mikeski.net/site/node/16

Mike.


-Original Message-
From: Dave Belfer-Shevett [mailto:d...@homeport.org]
Sent: Wednesday, September 02, 2009 4:34 PM
To: Struts Users Mailing List
Subject: Session variables in s:radio buttons - preselection and
formatting?

I have a twofold question.

The first is I have a session variable called 'sendto' which contains a
string ('registrant','none', or 'everyone').  When the page with the
radio buttons is rendered, I want to preselect based on whatever the
value in the session hash for 'sendto' is set to.

Code:
   div style=float: right; width: 150px;
   bNotifications/bhr
   Send email to:br
   s:radio
   list=#{'none':'None','registrant':'This
Registrant','everyone':'Everyone on this invoice'}
   value=#{sendto} name=sendto /
   /div

I woudl have thought the value=#{sendto} would have done that, but it
doesn't.  I've checked and the session key 'sendto' does have the value
'registrant' in it.

Secondly - These render on a straight line, one right after another.
I'd like line breaks br between each radio button.  Is this possible?

Thanks!

   -dbs

-
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: ResourceBundle with DB backend

2009-08-31 Thread Mike Baranski
Tommy,

Here you go, this is what I did.  I don't know if it's the best way, but
it works:

http://mikeski.net/site/node/37

Mike.

-Original Message-
From: Tommy Pham [mailto:tommy...@yahoo.com]
Sent: Friday, August 28, 2009 12:44 PM
To: Struts Users Mailing List
Subject: Re: ResourceBundle with DB backend

- Original Message 
 From: Mike Baranski list-subscripti...@secmgmt.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Friday, August 28, 2009 9:22:06 AM
 Subject: RE: ResourceBundle with DB backend

 I've done it, you just implement the proper classes and tell your
 application to use them instead.  I use a derby back-end.  I can post
a
 tutorial later if you'd like.

 -Original Message-
 From: Tommy Pham [mailto:tommy...@yahoo.com]
 Sent: Friday, August 28, 2009 12:17 PM
 To: user@struts.apache.org
 Subject: ResourceBundle with DB backend
 
 
 Hi,
 
 After reading through Localization and Formatting Date and Numbers,
I'm
 unable to find any information regarding using DB backend for
 ResourceBundle (by Struts specifically).  Suppose I have the proper
DB
 structure to provide the proper format  results as needed, how would
I
 go about getting Struts 2.1.6 to use it instead of checking the
 properties files through out the directory/folder hierarchy?  If I'm
 using Servlets+JSP, a custom class wouldn't be a problem.  I know
it's
 possible on ASP.NET since I've read about it on MSDN.
 
 TIA,
 Tommy
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org

Hi Mike,

Thanks for the reply.  Yes, please post the tutorial when you're
available.  I was thinking about that too which should work fine for
normal texts.  But how do you overcome the validation when the texts are
in external class-validation.xml?  I was hoping to implement something
that would tell struts to use my custom class instead of the default
ResourceBundle.  So later if I decide not implement the database
backend, there's no need to rewrite all those getTexts :D

Thanks,
Tommy


-
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: Next GA release?

2009-08-28 Thread Mike Baranski
Try this thread:

http://www.nabble.com/2.1.8--to25119398.html

-Original Message-
From: Robert Graf-Waczenski [mailto:r...@lsoft.com]
Sent: Friday, August 28, 2009 7:46 AM
To: Struts Users Mailing List
Subject: Next GA release?

Hi,

some time ago there was a release of Struts V 2.1.7 in the making. IIRC,
this release was cancelled because there was a class missing, so the
release was postponed and we are now waiting for V 2.1.8. Now, do those
of you who have deeper insight into the development roadmap have any
information as to when we can expect the next GA release (2.1.8 or
newer)? I know that i could probably walk through the dev@ archives, but
i'm a lazy person ;-)

The issue that currently bugs us most is the inability to have OGNL
runtime errors be thrown out to the VM instead of being silently handled
or logged by the framework. One of you fine people mentioned that V
2.1.7 would fix this, hence the question about the next GA release.

Robert


-
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: ResourceBundle with DB backend

2009-08-28 Thread Mike Baranski
I've done it, you just implement the proper classes and tell your
application to use them instead.  I use a derby back-end.  I can post a
tutorial later if you'd like.

-Original Message-
From: Tommy Pham [mailto:tommy...@yahoo.com]
Sent: Friday, August 28, 2009 12:17 PM
To: user@struts.apache.org
Subject: ResourceBundle with DB backend


Hi,

After reading through Localization and Formatting Date and Numbers, I'm
unable to find any information regarding using DB backend for
ResourceBundle (by Struts specifically).  Suppose I have the proper DB
structure to provide the proper format  results as needed, how would I
go about getting Struts 2.1.6 to use it instead of checking the
properties files through out the directory/folder hierarchy?  If I'm
using Servlets+JSP, a custom class wouldn't be a problem.  I know it's
possible on ASP.NET since I've read about it on MSDN.

TIA,
Tommy


-
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: ResourceBundle with DB backend

2009-08-28 Thread Mike Baranski

-Original Message-
From: Tommy Pham [mailto:tommy...@yahoo.com]
Sent: Friday, August 28, 2009 12:44 PM
To: Struts Users Mailing List
Subject: Re: ResourceBundle with DB backend

- Original Message 
 From: Mike Baranski list-subscripti...@secmgmt.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Friday, August 28, 2009 9:22:06 AM
 Subject: RE: ResourceBundle with DB backend

 I've done it, you just implement the proper classes and tell your
 application to use them instead.  I use a derby back-end.  I can post
a
 tutorial later if you'd like.

 -Original Message-
 From: Tommy Pham [mailto:tommy...@yahoo.com]
 Sent: Friday, August 28, 2009 12:17 PM
 To: user@struts.apache.org
 Subject: ResourceBundle with DB backend
 
 
 Hi,
 
 After reading through Localization and Formatting Date and Numbers,
I'm
 unable to find any information regarding using DB backend for
 ResourceBundle (by Struts specifically).  Suppose I have the proper
DB
 structure to provide the proper format  results as needed, how would
I
 go about getting Struts 2.1.6 to use it instead of checking the
 properties files through out the directory/folder hierarchy?  If I'm
 using Servlets+JSP, a custom class wouldn't be a problem.  I know
it's
 possible on ASP.NET since I've read about it on MSDN.
 
 TIA,
 Tommy
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org

Hi Mike,

Thanks for the reply.  Yes, please post the tutorial when you're
available.  I was thinking about that too which should work fine for
normal texts.  But how do you overcome the validation when the texts are
in external class-validation.xml?  I was hoping to implement something
that would tell struts to use my custom class instead of the default
ResourceBundle.  So later if I decide not implement the database
backend, there's no need to rewrite all those getTexts :D

Thanks,
Tommy

Tommy, here's the gist of what I did:

*Implement a custom ResourceBundle that loads text from derby (or whatever
database)
*Implement a base class that extends ActionSupport, that all my actions
extend
*In the constructor, get the custom ResourceBundle
*Override the getText(...) methods from my base class, and use the custom
ResourceBundle.

Hope that helps, I can post the code somewhere, too, if needed.


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



Redirect NullPointerException

2009-08-26 Thread Mike Baranski
action name=savePassword
class=com.secmgmt.struts2.actions.auth.SavePassword
result name=success type=redirect
param name=actionNameindex/param
param name=namespace/default/param
/result
result
name=input/pages/user-administration/jsps/change-password.jsp/result
/action

Any idea why I get the NullPointerException for that?




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



RE: Redirect NullPointerException

2009-08-26 Thread Mike Baranski
OK, the form submits, the user's password is changed, and the result is
SUCCESS.  Here's the stack trace:

Struts Problem Report

Struts has detected an unhandled exception:
Messages:   
File:   org/apache/struts2/dispatcher/ServletRedirectResult.java
Line number:190
Stacktraces
java.lang.NullPointerException

 
org.apache.struts2.dispatcher.ServletRedirectResult.isPathUrl(ServletRedirec
tResult.java:190)
 
org.apache.struts2.dispatcher.ServletRedirectResult.doExecute(ServletRedirec
tResult.java:135)
 
org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSuppor
t.java:186)
 
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionI
nvocation.java:361)
 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:265)
 
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(D
efaultWorkflowInterceptor.java:163)
 
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:87)
 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
 
com.secmgmt.struts2.interceptors.OperatorHistoryInterceptor.intercept(Operat
orHistoryInterceptor.java:157)
 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
 
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(Validati
onInterceptor.java:249)
 
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.do
Intercept(AnnotationValidationInterceptor.java:68)
 
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(Method
FilterInterceptor.java:87)
 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
 
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(Con
versionErrorInterceptor.java:122)
 
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocati
on.java:236)
 
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(Parame
tersInterceptor.java:195)


-Original Message-
From: Greg Lindholm [mailto:greg.lindh...@gmail.com]
Sent: Wednesday, August 26, 2009 10:18 AM
To: Struts Users Mailing List
Subject: Re: Redirect NullPointerException

A stack trace and some context might help you get an answer.

On Wed, Aug 26, 2009 at 10:16 AM, Mike Baranski 
list-subscripti...@secmgmt.com wrote:

action name=savePassword
 class=com.secmgmt.struts2.actions.auth.SavePassword
result name=success type=redirect
param name=actionNameindex/param
param
name=namespace/default/param
/result
result
 name=input/pages/user-administration/jsps/change-
password.jsp/result
/action

 Any idea why I get the NullPointerException for that?




 -
 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: Redirect NullPointerException

2009-08-26 Thread Mike Baranski
Thanks, that worked.

-Original Message-
From: Lukasz Lenart [mailto:lukasz.len...@googlemail.com]
Sent: Wednesday, August 26, 2009 10:33 AM
To: Struts Users Mailing List
Subject: Re: Redirect NullPointerException

2009/8/26 Mike Baranski list-subscripti...@secmgmt.com:
 OK, the form submits, the user's password is changed, and the result
is
 SUCCESS.  Here's the stack trace:

You should use redirectAction instead redirect - it's just for ordinary
URLs ;-)


Regards
--
Lukasz
http://www.lenart.org.pl/
http://dailylog.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



Re: RequestProcessor and contentType response header

2009-06-21 Thread Mike Dave

 Sounds counter-intuitive. Why should the RequestProcessor overwrite?

I am in agreement with you, Avlesh. This behaviour is erratic.
I would recomend upgrading to a later version of struts assuming that the
behaviour has been fixed.

-m-

On Sun, Jun 21, 2009 at 8:46 PM, Avlesh Singh avl...@gmail.com wrote:

 It's also the weekend.

 I truly respect that.

 It's not a bug, that's just how it works.

 Sounds counter-intuitive. Why should the RequestProcessor overwrite?

 Overriding the request processor is the normal way to add behavior to apps
 running that version of Struts.

 Thanks for approving the solution.

 Thanks again, Dave.

 Cheers
 Avlesh


 On Sun, Jun 21, 2009 at 5:59 PM, Dave Newton newton.d...@yahoo.comwrote:

 Avlesh Singh wrote:

 Did not get a response yet :(


 It's also the weekend.

  Is this a dev list question


 No.

1. Shouldn't this method also check if the response already has a
   contentType header applied or not? Is this a known bug, or am I
 missing
   something?


 It's not a bug, that's just how it works.

2. I subclassed the RequestProcessor and defined a controller in my
   struts config as controller
 processorClass=com.me.MyRequestProcessor/.
   The class merely overrides the processContent method to check for an
   existing contentType. Am I doing it correctly, or is there some other
 way to
   achieve the desired behavour in my case.


 Overriding the request processor is the normal way to add behavior to
 apps running that version of Struts.

 Dave

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






Re: boundle message in s:select

2009-05-18 Thread Mike Altieri

It should be something like:

s:select headerValue=%{getText('myproject.myboundle.item')} 

Take a look at:
http://struts.apache.org/2.1.6/docs/localizing-output.html
and
http://struts.apache.org/2.1.6/docs/localization.html

Cheers,
Mike


- Original Message 
 From: Gianluca Musella gianluca.muse...@bsc.it
 To: user@struts.apache.org
 Sent: Monday, May 18, 2009 10:13:55 AM
 Subject: boundle message in s:select
 
 Hi all,
 
 
 
 In tag:
 
 
 
 
 
 
 
 How to read the headerValue value from the resources boundle?
 
 Something like:
 
 
 
 
 
 
 
 Thank you,
 
 
 
 Gianluca


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



Re: Struts newbie - Advice on file downloading

2009-05-13 Thread Mike Altieri

Hi Steve, 

I haven't implemented this in struts before; but have in the past built other 
java web-apps w/ the downloading of files...
the save-as dialog box is browser dependent (as Richard mentioned) and if a 
user has mucked w/ their mime-type settings you may not be able to force the 
regular save-as dialog...
(with the types you mentioned pdf, csv, etc this is very likely; also if you 
have to support different browsers this may work differently or even be set 
differently between them)

If you are in control of your end-user's environment (say a corporate env.) 
then this may not be a big deal; 
however if you aren't and you really need the save-as dialog in a rigid 
fashion; then perhaps putting in an applet is the way to go [this would even 
allow you to default to a certain directory regardless of the browser settings 
[in a req i have worked on in the past that was very important to my client 
since they're users weren't good at remember what directory they save things 
in] 

the user would have some extra work to accept the signed/self-signed applet on 
their first visit; but subsequent visits would be smooth and relatively 
consistent

Good luck!
-Mike



- Original Message 
 From: Richard Sayre richardsa...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Wednesday, May 13, 2009 7:41:01 AM
 Subject: Re: Struts newbie - Advice on file downloading
 
 Hi,
 
 I have the following defined:
 
 
 method=generateReport
 
 application/pdf
 fileStream
 filename=Report.pdf
 1024
 
 
 My action lookks like this
 
 public String generateReport() {
 
 //use api to build PDF
 //the api takes an output stream
 //so at the end of my method i have an output stream containg the file...
 
 //bout is my output stream
 //file stream is a member of my Action (referenced in the  
 name=inputNamefileStream param)
 //fileStream is an InputStream
 fileStream = new ByteArrayInputStream(bout.toByteArray());
 
 return SUCCESS;
 }
 
 You will have to parameterize the XML to handle multiple file types:
 
 ${mimeType}
 
 Which you will set in your action.  Same goes for the other parameters.
 
 I'm not sure how to get the browser to display a save dialog, I think
 it has to do with the mime type.  I think application/octet-stream
 will work.
 
 -Rich
 
 On Wed, May 13, 2009 at 8:55 AM, Steve wrote:
  Hi,
 
 
 
  I'm a Struts 2 newbie and I need to write some code to download dynamically
  created files in various formats (csv, txt and xml). I want the user to be
  presented with a Save As dialog regardless of file type.
 
 
 
  Does anyone have any advice / URL's for example code? I have found the
  Result Stream documentation on the Struts site and various code snippets.
  But I can't find any good complete examples.
 
 
 
  Many Thanks,
 
 
 
  Steve
 
  Steve Higham
 
 
 
 
 
 
 
 -
 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



Password Input

2009-03-06 Thread Mike Baranski
s:password label=Password name=password1 value=%{''} size=10
maxLength='15' /

That, for some reason, is calling getPassword...  can someone tell me why it
is not blank with the value explicitly set?

-
Mike Baranski
O: 919 788 9200
F: 919 510 0037
M: 919 395 0620

m...@secmgmt.com

CVI Authorized User Number: CVI-20080925-1020950
-

Warning: 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, 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 original sender
immediately by replying to this message and then delete it from your
computer. All e-mail sent to this address will be received by the SMC
corporate e-mail system and are subject to archiving and review by someone
other than the recipient.




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



RE: Struts 2 sample: Hello World (Maven Ant)

2009-03-02 Thread Mike Finney
http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/struts/struts2-blank/2.1.6/
 

(struts2=blank) may be just the thing to use for writing a struts2 hello world.

Is this David Newton's contribution?

Thanks.

-Original Message-
From: Lukasz Lenart [mailto:lukasz.len...@googlemail.com] 
Sent: Monday, March 02, 2009 6:00 AM
To: Struts Users Mailing List
Subject: Re: Struts 2 sample: Hello World (Maven  Ant)

I think it will be even better to start from scratch with Struts2 archetype [1]

[1] http://struts.apache.org/2.1.6/docs/struts-maven-archetypes.html


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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




HttpServletResponse Transfer-Encoding header

2009-02-27 Thread Mike Finney
Hi,

 

1)

What's a great way to manipulate HttpServletResponse existing headers
using struts2?  

I tried changing Transfer-Encoding to Chunked using an interceptor
(AbstractInterceptor) before and after the actionInvocation.invoke();.
I also tried again as a PreResultListener. I verified everything is
hooked up and running via System.out.putlines.

However, neither approach always affected the Transfer-Encoding value.
I can add new headers using HttpServletResponse.addHeader(), but
Transfer-Encoding seems different.

 

2)

I also need a way to remove content-length if I can guarantee
Transfer-Encoding is set to Chunked. Can I just set it to 0 and that
counts?

 

I looked at : http://www.w3.org/Protocols/rfc2616/rfc2616.html and
http://en.wikipedia.org/wiki/Chunked_transfer_encoding 

 

Thanks,

Mike Finney

 



Problem passing interface implementing object to an action from a jsp

2009-02-04 Thread Mike Baranski
Here's my delima:

I have an interface to represent a Door, called IDoor
I have an interface to represent a DoorProvider, called IDoorProvider.

I use Spring to inject the DoorProvider implementation for the particular
application to get lists of doors.

I have an UnlockDoorAction that will unlock an IDoor implementing Door (that
comes from a provider)

Here is my UnlockDoorAction code that is relevant:

public String execute() throws Exception
{
this.getDoor().unlockDoor(-1);
return SUCCESS;
}

 public IDoor getDoor()
{
return this.door;
}

 public void setDoor(IDoor cd)
{
this.door = cd;
}

Here is the JSP code that causes this action to be executed:

s:url var=unlock_url action=unlock namespace=/door_controls:param
name=door value=[0]//s:url
s:a href=%{unlock_url}centerimg alt=Locked src=s:url
value=/images/locked.png/ border=none//center/s:a

Now, the value=[0] is an iterator value of an object that implements the
IDoor interface.

The Action returns input, which (I think) is because it can't figure out
how to set the parameter on the UnlockDoorAction.  How do I make the thing
recognize that setDoor(IDoor cd) will take that parameter?

Thanks,
Mike.

 -
Mike Baranski
O: 919 788 9200
F: 919 510 0037
M: 919 395 0620

m...@secmgmt.com

CVI Authorized User Number: CVI-20080925-1020950
-

Warning: 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, 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 original sender
immediately by replying to this message and then delete it from your
computer. All e-mail sent to this address will be received by the SMC
corporate e-mail system and are subject to archiving and review by someone
other than the recipient.




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



RE: Problem passing interface implementing object to an action from a jsp

2009-02-04 Thread Mike Baranski
All I meant was that the value=[0] evaluates to a Door object, which 
implements an IDoor, which I want to use for the setter method.

The documentation for type conversions says:

The framework cannot instantiate an object if it can't determine an 
appropriate implementation. It recognizes well-known collection interfaces 
(List, Set, Map, etc) but cannot instantiate MyCustomInterface when all it sees 
is the interface. In this case, instantiate the target implementation first 
(eg. in a prepare method) or substitute in an implementation.

I'm not smart enough to understand what that means...


-Original Message-
From: Adam Hardy [mailto:ahardy.str...@cyberspaceroad.com] 
Sent: Wednesday, February 04, 2009 11:41 AM
To: Struts Users Mailing List
Subject: Re: Problem passing interface implementing object to an action from a 
jsp

Hi Mike,

I can't quite figure out what you're doing wrong. Don't know what you mean 
exactly about the iterator value - but I guess the problem lies with the 
config for your type conversions.

Do you have an xwork-conversions or an action-conversion.properties? That's 
where you tell the xwork engine which converter to use for that class and 
setter.

Mike Baranski on 04/02/09 16:28, wrote:
 Here's my delima:
 
 I have an interface to represent a Door, called IDoor
 I have an interface to represent a DoorProvider, called IDoorProvider.
 
 I use Spring to inject the DoorProvider implementation for the particular
 application to get lists of doors.
 
 I have an UnlockDoorAction that will unlock an IDoor implementing Door (that
 comes from a provider)
 
 Here is my UnlockDoorAction code that is relevant:
 
   public String execute() throws Exception
 {
 this.getDoor().unlockDoor(-1);
 return SUCCESS;
 }
 
  public IDoor getDoor()
 {
 return this.door;
 }
 
  public void setDoor(IDoor cd)
 {
 this.door = cd;
 }
 
 Here is the JSP code that causes this action to be executed:
 
 s:url var=unlock_url action=unlock namespace=/door_controls:param
 name=door value=[0]//s:url
 s:a href=%{unlock_url}centerimg alt=Locked src=s:url
 value=/images/locked.png/ border=none//center/s:a
 
 Now, the value=[0] is an iterator value of an object that implements the
 IDoor interface.
 
 The Action returns input, which (I think) is because it can't figure out
 how to set the parameter on the UnlockDoorAction.  How do I make the thing
 recognize that setDoor(IDoor cd) will take that parameter?


-
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: Problem passing interface implementing object to an action from a jsp

2009-02-04 Thread Mike Baranski
Yeah, I've created a LoginInterceptor to detect a session value if someone's 
logged in.  The main reason I did it was to understand the concept.

I will look into the prepare stuff, and just handle setting it myself.  What I 
did to make it work was change the Provider to have a lockDoor(doorId) method, 
and just passed the ID into the action from the jsp.

Thanks for the help.
Mike.

-
Mike Baranski
O: 919 788 9200
F: 919 510 0037
M: 919 395 0620

m...@secmgmt.com

CVI Authorized User Number: CVI-20080925-1020950
-

Warning: 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, 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 original sender 
immediately by replying to this message and then delete it from your computer. 
All e-mail sent to this address will be received by the SMC corporate e-mail 
system and are subject to archiving and review by someone other than the 
recipient.


-Original Message-
From: Adam Hardy [mailto:ahardy.str...@cyberspaceroad.com] 
Sent: Wednesday, February 04, 2009 12:39 PM
To: Struts Users Mailing List
Subject: Re: Problem passing interface implementing object to an action from a 
jsp

Technically you don't actually have to be that /smart/ to work it out, you just 
need to read the right documentation :)

I only do type conversion and instantiation of my model objects in one 
particular way and haven't a good overview of the other ways, such as via a 
prepare method.

It would help if someone who's more familiar with the out-of-the-box method 
would step in here to give you the lowdown rather than the vague stuff I can 
tell you.

Do you know what the interceptor stack is? If you're using the default, struts 
will call the prepare interceptor. Have you configured struts.xml to use any 
other interceptor stack? So that struts can do the prepare, you implement a 
prepare method from the prepare interface on your action which instantiates the 
entity beans and populates your action so that the xwork engine has got some 
bones to add the meat to. (It'll call the getDoor() to access your IDoor 
pre-instantiated objects).



Mike Baranski on 04/02/09 16:56, wrote:
 All I meant was that the value=[0] evaluates to a Door object, which
 implements an IDoor, which I want to use for the setter method.
 
 The documentation for type conversions says:
 
 The framework cannot instantiate an object if it can't determine an
 appropriate implementation. It recognizes well-known collection interfaces
 (List, Set, Map, etc) but cannot instantiate MyCustomInterface when all it
 sees is the interface. In this case, instantiate the target implementation
 first (eg. in a prepare method) or substitute in an implementation.
 
 I'm not smart enough to understand what that means...
 
 
 -Original Message- From: Adam Hardy
 [mailto:ahardy.str...@cyberspaceroad.com] Sent: Wednesday, February 04, 2009
 11:41 AM To: Struts Users Mailing List Subject: Re: Problem passing interface
 implementing object to an action from a jsp
 
 Hi Mike,
 
 I can't quite figure out what you're doing wrong. Don't know what you mean 
 exactly about the iterator value - but I guess the problem lies with the 
 config for your type conversions.
 
 Do you have an xwork-conversions or an action-conversion.properties? That's 
 where you tell the xwork engine which converter to use for that class and
 setter.
 
 Mike Baranski on 04/02/09 16:28, wrote:
 Here's my delima:
 
 I have an interface to represent a Door, called IDoor I have an interface
 to represent a DoorProvider, called IDoorProvider.
 
 I use Spring to inject the DoorProvider implementation for the particular 
 application to get lists of doors.
 
 I have an UnlockDoorAction that will unlock an IDoor implementing Door
 (that comes from a provider)
 
 Here is my UnlockDoorAction code that is relevant:
 
 public String execute() throws Exception { this.getDoor().unlockDoor(-1); 
 return SUCCESS; }
 
 public IDoor getDoor() { return this.door; }
 
 public void setDoor(IDoor cd) { this.door = cd; }
 
 Here is the JSP code that causes this action to be executed:
 
 s:url var=unlock_url action=unlock namespace=/door_controls:param 
 name=door value=[0]//s:url s:a href=%{unlock_url}centerimg
 alt=Locked src=s:url value=/images/locked.png/
 border=none//center/s:a
 
 Now, the value=[0] is an iterator value of an object that implements the 
 IDoor interface.
 
 The Action returns input, which (I think) is because it can't figure out 
 how to set the parameter on the UnlockDoorAction.  How do I make the thing 
 recognize that setDoor(IDoor cd) will take that parameter

Tags Help

2009-01-27 Thread Mike Baranski
I'm using Struts 2, and have the following iterator:

ww:iterator value='person.userFields'
  trtdww:property value='slotNumber'//tdtdww:property
value='description'//td/tr
/ww:iterator

The package.properties file defines:

User1 = Label for user1
User2 = Label for user2
...
User40 = Label for user40

Now, how do I call getText for Userx where x is the slot number?  I can't
figure out how to generate that concatenated string of User + ww:property
value='slotNumber'/ and then call getText(that_string).

Can someone help?
Thanks,
Mike.

-
Mike Baranski
O: 919 788 9200
F: 919 510 0037
M: 919 395 0620

m...@secmgmt.com

CVI Authorized User Number: CVI-20080925-1020950
-

Warning: 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, 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 original sender
immediately by replying to this message and then delete it from your
computer. All e-mail sent to this address will be received by the SMC
corporate e-mail system and are subject to archiving and review by someone
other than the recipient.




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



RE: Tags Help

2009-01-27 Thread Mike Baranski
How exactly would you do it?  There are 0-40 (possibly set) user field
values, and I only want to show the ones that have values, and not the ones
that don't.

Thanks,
Mike.

-
Mike Baranski
O: 919 788 9200
F: 919 510 0037
M: 919 395 0620

m...@secmgmt.com

CVI Authorized User Number: CVI-20080925-1020950
-

Warning: 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, 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 original sender
immediately by replying to this message and then delete it from your
computer. All e-mail sent to this address will be received by the SMC
corporate e-mail system and are subject to archiving and review by someone
other than the recipient.


-Original Message-
From: Dave Newton [mailto:newton.d...@yahoo.com] 
Sent: Tuesday, January 27, 2009 11:55 AM
To: Struts Users Mailing List
Subject: Re: Tags Help

Mike Baranski wrote:
 ww:iterator value='person.userFields'
   trtdww:property value='slotNumber'//tdtdww:property
 value='description'//td/tr
 /ww:iterator
 
 The package.properties file defines:
 
 User1 = Label for user1
 User2 = Label for user2
 ...
 User40 = Label for user40
 
 Now, how do I call getText for Userx where x is the slot number?  I can't
 figure out how to generate that concatenated string of User +
ww:property
 value='slotNumber'/ and then call getText(that_string).

I'm not sure that's how I'd do that, but that aside, in addition to 
using an immediate expression:

s:set var=foo value='User' + #top.slotNumber/

(Or something like that--I almost never use the #top thing--or use a var 
in the iterator and assign each element to a variable, or use the same 
method directly in the getText call, and so on.)

Dave


-
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



List of tags that encode or filter output by default

2008-09-18 Thread Mike Ware
Is there a concise list anywhere that explains which tags HTML encode
output by default?

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



[S2] 2.1.3GA?

2008-08-17 Thread Mike Watson
Is there an ETA on when 2.1.3 (or greater) will go GA?

Mike

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



Re: ServletOutputStream

2008-07-30 Thread Mike Rooney
Thank you for the reply.  I know my action can only return one response.  
However I want to avoid saving my file somewhere on the server and would like 
the 'File Download' dialog to appear when the file is ready.  How can I do this 
in struts 2 while still forwarding to a 'status completed' page? Would it be 
possible to store the file data in a session and somehow have the File Download 
dialog show up?  If so I am not sure how to do that.



- Original Message 
From: Gabriel Belingueres [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Wednesday, July 30, 2008 3:59:29 AM
Subject: Re: ServletOutputStream

Your action can not generate two responses (if that's what you asking).
If you forward to a 'status completed' page, then you need to save
your excel data somewhere to not loosing it.

2008/7/29 Mike Rooney [EMAIL PROTECTED]:
 I created a small webapp that extracts data from a DB, creates an Excel file 
 from that data (using Apache POI), which then streams the file to the end 
 user's browser.  Everything is working fine, however I have to set the Action 
 class' return type to 'NULL' since I am setting the servlet response type to 
 'application/vnd-ms-excel'.  I want to change my application so that it 
 returns to a 'status completed' page when the extraction is completed. 
 However I cannot do this when I set the return type is null.  How can I do 
 this?

 Here is my code...

 public class ExtractAction extends ActionSupport {
  public String execute() throws Exception {
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet prodSheet = wb.createSheet(PROD);
    HSSFSheet devSheet = wb.createSheet(DEV);
    HSSFSheet testSheet = wb.createSheet(TEST);
    ...
    HttpServletResponse response = ServletActionContext.getResponse();
    response.setContentType(application/vnd.ms-excel);
    ServletOutputStream outstream = response.getOutputStream();
    wb.write(outstream);
    outstream.flush();
    response.flushBuffer();
  }
  return null;
  //return SUCCESS
 }

 and my struts.xml

 struts

  constant name=struts.enable.DynamicMethodInvocation value=false /
  constant name=struts.devMode value=false /

  package name=default extends=struts-default
    action name=Extractor class=action.ExtractAction
      result name=success/example/index.jsp/result
    /action
  /package

 /struts




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


  

Re: ServletOutputStream

2008-07-30 Thread Mike Rooney
Thank you for the help guys. I got it working.



- Original Message 
From: Gabriel Belingueres [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Wednesday, July 30, 2008 10:58:43 AM
Subject: Re: ServletOutputStream

A solution could be this: Store the excel data in session, then in
your 'status completed' page add an onload event to its body,
redirecting to the real download action:

IIRC:

body onload=document.location.href='http://blahblah/myaction.action';

You can also add a meta in the head:

head
    META HTTP-EQUIV=Refresh CONTENT=0;URL=http://blahblah/myaction.action;
/head

2008/7/30 Mike Rooney [EMAIL PROTECTED]:
 Thank you for the reply.  I know my action can only return one response.  
 However I want to avoid saving my file somewhere on the server and would like 
 the 'File Download' dialog to appear when the file is ready.  How can I do 
 this in struts 2 while still forwarding to a 'status completed' page? Would 
 it be possible to store the file data in a session and somehow have the File 
 Download dialog show up?  If so I am not sure how to do that.



 - Original Message 
 From: Gabriel Belingueres [EMAIL PROTECTED]
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Wednesday, July 30, 2008 3:59:29 AM
 Subject: Re: ServletOutputStream

 Your action can not generate two responses (if that's what you asking).
 If you forward to a 'status completed' page, then you need to save
 your excel data somewhere to not loosing it.

 2008/7/29 Mike Rooney [EMAIL PROTECTED]:
 I created a small webapp that extracts data from a DB, creates an Excel file 
 from that data (using Apache POI), which then streams the file to the end 
 user's browser.  Everything is working fine, however I have to set the 
 Action class' return type to 'NULL' since I am setting the servlet response 
 type to 'application/vnd-ms-excel'.  I want to change my application so that 
 it returns to a 'status completed' page when the extraction is completed. 
 However I cannot do this when I set the return type is null.  How can I do 
 this?

 Here is my code...

 public class ExtractAction extends ActionSupport {
  public String execute() throws Exception {
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet prodSheet = wb.createSheet(PROD);
    HSSFSheet devSheet = wb.createSheet(DEV);
    HSSFSheet testSheet = wb.createSheet(TEST);
    ...
    HttpServletResponse response = ServletActionContext.getResponse();
    response.setContentType(application/vnd.ms-excel);
    ServletOutputStream outstream = response.getOutputStream();
    wb.write(outstream);
    outstream.flush();
    response.flushBuffer();
  }
  return null;
  //return SUCCESS
 }

 and my struts.xml

 struts

  constant name=struts.enable.DynamicMethodInvocation value=false /
  constant name=struts.devMode value=false /

  package name=default extends=struts-default
    action name=Extractor class=action.ExtractAction
      result name=success/example/index.jsp/result
    /action
  /package

 /struts




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




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


  

Re: [S2} REST plugin Security

2008-07-29 Thread Mike Watson
Thanks Jeromy,

Yep, we did get the standard JEE security working in WAS.
(Fat-fingered typing in the web.xml was the culprit).

I'll have a look at the Sping option if we find the container stuff a
bit lacking.

Thanks again for your feedback.

Mike

2008/7/29 Jeromy Evans [EMAIL PROTECTED]:

 If you don't have complex URL patterns, I'd continue down the JEE path.  It
 should work. Although I haven't tried it with websphere it's a fundamental
 requirement of the container.

 I'd temporarily switch to HTTP BASIC instead of LDAP to try isolate the
 problem.

 Yes, creating a custom Security Interceptor is another approach.  It's
 pretty simple to throw your own interceptor into the stack that checks the
 Principal or Session and forces a redirect/error if appropriate.  It's a low
 effort approach but you take on some more risk of introducing
 vulnerabilities.

 An better approach is to use a third party filter.  Acegi/Spring Security is
 the most popular and probably the most flexible as it's closely bound to
 your (Spring) Object Factory.  There are other open source filters available
 too that may suite you.

 Hope that helps,
 Jeromy Evans


 Mike Watson wrote:

 I should probably add that I'm just trying to authenticate via LDAP at
 this stage. Authorization will be implemented later.

 2008/7/28 Mike Watson [EMAIL PROTECTED]:


 Hi Folks,

 What's the most straightforward way to secure my REST URLs?

 I'd assumed that I'd be able to use the standard JEE approach and
 secure based on URL patterns but this doesn't seem to work (on
 Websphere anyway) and I'm assuming it's to do with the fact everything
 I'm doing is happening in filters rather than working with 'real'
 resources. (I don't get any errors, I just get to see resources I
 shouldn't when I'm not authenticated).

 Is there some sort of Security Interceptor I should enable or should
 this work the way I initially assumed?

 Has anybody else (Jeromy?) done this?

 Cheers

 Mike



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


 Internal Virus Database is out of date.
 Checked by AVG - http://www.avg.com Version: 8.0.138 / Virus Database:
 270.5.5/1569 - Release Date: 23/07/2008 1:31 PM






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



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



ServletOutputStream

2008-07-29 Thread Mike Rooney
I created a small webapp that extracts data from a DB, creates an Excel file 
from that data (using Apache POI), which then streams the file to the end 
user's browser.  Everything is working fine, however I have to set the Action 
class' return type to 'NULL' since I am setting the servlet response type to 
'application/vnd-ms-excel'.  I want to change my application so that it returns 
to a 'status completed' page when the extraction is completed. However I cannot 
do this when I set the return type is null.  How can I do this? 

Here is my code... 

public class ExtractAction extends ActionSupport { 
  public String execute() throws Exception { 
    HSSFWorkbook wb = new HSSFWorkbook(); 
    HSSFSheet prodSheet = wb.createSheet(PROD); 
    HSSFSheet devSheet = wb.createSheet(DEV); 
    HSSFSheet testSheet = wb.createSheet(TEST); 
    ... 
    HttpServletResponse response = ServletActionContext.getResponse(); 
    response.setContentType(application/vnd.ms-excel); 
    ServletOutputStream outstream = response.getOutputStream(); 
    wb.write(outstream); 
    outstream.flush(); 
    response.flushBuffer(); 
  } 
  return null; 
  //return SUCCESS 
} 

and my struts.xml 

struts 

  constant name=struts.enable.DynamicMethodInvocation value=false / 
  constant name=struts.devMode value=false / 
  
  package name=default extends=struts-default 
    action name=Extractor class=action.ExtractAction 
      result name=success/example/index.jsp/result 
    /action 
  /package 
  
/struts


  

[S2} REST plugin Security

2008-07-27 Thread Mike Watson
Hi Folks,

What's the most straightforward way to secure my REST URLs?

I'd assumed that I'd be able to use the standard JEE approach and
secure based on URL patterns but this doesn't seem to work (on
Websphere anyway) and I'm assuming it's to do with the fact everything
I'm doing is happening in filters rather than working with 'real'
resources. (I don't get any errors, I just get to see resources I
shouldn't when I'm not authenticated).

Is there some sort of Security Interceptor I should enable or should
this work the way I initially assumed?

Has anybody else (Jeromy?) done this?

Cheers

Mike

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



Re: [S2} REST plugin Security

2008-07-27 Thread Mike Watson
I should probably add that I'm just trying to authenticate via LDAP at
this stage. Authorization will be implemented later.

2008/7/28 Mike Watson [EMAIL PROTECTED]:
 Hi Folks,

 What's the most straightforward way to secure my REST URLs?

 I'd assumed that I'd be able to use the standard JEE approach and
 secure based on URL patterns but this doesn't seem to work (on
 Websphere anyway) and I'm assuming it's to do with the fact everything
 I'm doing is happening in filters rather than working with 'real'
 resources. (I don't get any errors, I just get to see resources I
 shouldn't when I'm not authenticated).

 Is there some sort of Security Interceptor I should enable or should
 this work the way I initially assumed?

 Has anybody else (Jeromy?) done this?

 Cheers

 Mike


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



Re: S2 REST plugin

2008-07-24 Thread Mike Watson
What I actually return is a DefaultHttpHeaders with a 404 set.
getImage() returns an empty (not null) inputstream since there's no
content for the body.

I'll do some debugging when I get time and see where it's failing. It
certainly seems to be StreamResult that has the issue.

Thanks

Mike

2008/7/24 Jeromy Evans [EMAIL PROTECTED]:
 Mike Watson wrote:

 Hi folks,

 As mentioned in previous posts I'm using the REST plugin to serve
 images and everything seems to work fine when the content exists.

 However if I return an empty inputstream to StreamResult with a 404
 response code I get the exception below.
 Stepping through the code the getBufferSize() method on my controller
 is definitely called and returns a legitimate value...


 Does this only occur when you return a null or 0 buffer size?

 My guess is that it's a bug in the StreamResult or the result handler.  It
 probably evaluates ${bufferSize} and deduces that the property doesn't
 exist (because it's null/0) and uses it as a literal string value instead.
  That's just a guess.

 Is it really valid to return a zero length stream result?  I would instead
 return a http status result with 404 / NullResult for the error case (ie.
 just headers, no content).



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



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



Re: S2 REST plugin

2008-07-24 Thread Mike Watson
Thanks mate. I'll give that a try tomorrow.

2008/7/24 Jeromy Evans [EMAIL PROTECTED]:
 Mike Watson wrote:

 What I actually return is a DefaultHttpHeaders with a 404 set.
 getImage() returns an empty (not null) inputstream since there's no
 content for the body.



 You may need to return a different result type for the error case
 (HttpHeaderResult or NullResult) so it only attempts to set the headers
 though.


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



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



S2 REST plugin

2008-07-23 Thread Mike Watson
   at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:383)
[24/07/08 14:03:40:421 NZST] 001c SystemErr R   at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:263)
[24/07/08 14:03:40:421 NZST] 001c SystemErr R   at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
[24/07/08 14:03:40:421 NZST] 001c SystemErr R   at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
[24/07/08 14:03:40:421 NZST] 001c SystemErr R   at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
[24/07/08 14:03:40:421 NZST] 001c SystemErr R   at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[24/07/08 14:03:40:421 NZST] 001c SystemErr R   at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[24/07/08 14:03:40:421 NZST] 001c SystemErr R   at
com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
[24/07/08 14:03:40:421 NZST] 001c SystemErr R   at
com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
[24/07/08 14:03:40:421 NZST] 001c SystemErr R   at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
[24/07/08 14:03:40:421 NZST] 001c SystemErr R   at
com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
[24/07/08 14:03:40:421 NZST] 001c SystemErr R   at
com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)


?xml version=1.0 encoding=UTF-8?
!DOCTYPE struts PUBLIC -//Apache Software Foundation//DTD Struts
Configuration 2.0//EN
http://jakarta.apache.org/struts/dtds/struts-2.0.dtd; 
struts
  constant name=struts.action.extension
value=xhtml,,xml,json,img,png /
  !-- TODO: set devMode false before releasing product!!! --
  constant name=struts.devMode value=true /

  bean type=org.apache.struts2.dispatcher.mapper.ActionMapper
name=hierarchical
class=net.somecompany.rest.actionmapper.HierarchicalRestActionMapper
/
  constant name=struts.mapper.class
value=hierarchical/

  !-- location in the webapp/classpath of default results --
  constant name=struts.codebehind.pathPrefix value=/WEB-INF/results//

  bean name=namedVariablePatternMatcher
type=com.opensymphony.xwork2.util.PatternMatcher
class=com.opensymphony.xwork2.util.NamedVariablePatternMatcher/
  constant name=struts.patternMatcher value=namedVariablePatternMatcher/

  constant name=struts.codebehind.defaultPackage value=rest-h/
  constant name=struts.configuration.classpath.defaultParentPackage
value=rest-h /

  !-- Our custom XML handler, based on JiBX --
  bean name=myXML
type=org.apache.struts2.rest.handler.ContentTypeHandler
class=net.somecompany.domain.struts.StrutsXMLHandler /

  !-- Our custom image handler --
  bean name=myImg
type=org.apache.struts2.rest.handler.ContentTypeHandler
class=net.somecompany.domain.struts.ImgHandler /

  package name=rest-h extends=rest-default namespace=/
!--
!- Global results for error and exception handling. -
global-results
  result name=exception type=redirect/error.jsp/result
/global-results
global-exception-mappings
  exception-mapping exception=java.lang.Throwable result=exception/
/global-exception-mappings
 --
  /package

  package name=imagePackage extends=rest-h
action name=image class=net.somecompany.rest.action.ImageController
  result name=image type=stream
param name=contentType${contentType}/param
param name=inputNameimage/param
param name=bufferSize${bufferSize}/param
  /result
/action
  /package

/struts

Cheers Mike

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



Re: REST plugin URL syntax

2008-07-14 Thread Mike Watson
Jeromy,

Thanks *heaps* for finfing the time to do that. I'd pretty much done
everything your demo does except for one little detail:

  constant name=struts.patternMatcher value=namedVariablePatternMatcher/

Doh!

Now to see if that's broken my fancy pants image handler...

BTW, if I want a controller to work in multiple namespaces do I need
to declare seperate packages in struts.xml instead of just relying on
the @Namespace annotation?

Thanks again for all your help.

2008/7/12 Jeromy Evans [EMAIL PROTECTED]:
 Jeromy Evans wrote:


 Dusty, you're right. I just had a quick look and I do have a custom action
 mapper that checks whether the pattern above references an action or method
 for that exact reason (it checks the list of available actions and gives
 precedence to those).  Works great for me.

 I released another actionmapper that solved the problem using a different
 approach. It will be deprecated, but it's still up for info:
 http://code.google.com/p/struts2urlplugin/

 I had an opportunity to throw together a sample application.  Apologies for
 the delay.

 Relevant source and commentary are included in the demo.
 http://www.blueskyminds.com.au/url-hierarchy/

 From the description:
 This webapp demonstrates a technique to access resources with hierarchical
 relationships in Struts 2.

 The model is a Book with a list of Chapters. Each Book has a unique URI:
 eg. /book/1 (book #1)

 Each chapter also has a unique URI:
 eg. /book/1/chapter/2 (chapter #2 in book #1)

 Following Struts2 conventions, the list of books and list of chapters in a
 book are also available:
 eg. /book (list of books)
 eg. /book/1/chapter (list of chapters in book #1)

 regards,
 Jeromy Evans



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



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



Re: REST plugin URL syntax

2008-07-10 Thread Mike Watson
So what's the best way to get the latest 2.1.3 snapshot as source?
Only the jars seem to be in the maven snapshot repo...

Are there any instructions on doing that somewhere? I've looked but
can't find them...

2008/7/3 Jeromy Evans [EMAIL PROTECTED]:
 Mike Watson wrote:

 Hi Jeromy,

 I've finally found time to try to resolve this but haven't had much luck.

 Just to recap, I'm looking to be able to do something similar to the
 following:
 /book - returns a list of books
 /book/123 - returns book with id 123
 /book/123/chapter/1 - return chapter with id 1, retrieved from book
 123 (this is a simplistic example, all resources have a unique ID)

 I'd also like to be able to control access based on the
 context/namespace used to access a resource e.g.:
 /logo/abc - read or update
 /book/123/logo/abc - read only
 (would I need multiple LogoControllers for this?)

 Using Namespaces as described by Jeromy below certainly seems to make
 sense but as soon as I start to try the example provided I lose the
 ability to GET /book/123, and I've tried with BookController having
 namespace of / or /book and neither works. And so far I haven't
 been able to successfully hit the ChapterController using a url like
 /book/123/chapter.

 Am I missing something really obvious? Is there something I need to
 put in the struts.xml to configure the namespaces as well as using the
 @Namespace annotation?

 Jeromy, you seem to be pretty knowledgeable about this - can you think
 of anything I might be doing wrong?

 Thanks in advance for your help.

 Mike



 Hi Mike, I'll throw a quick answer together now and try to give you a more
 in-depth one in a day or two by building an example.
 The steps are:
 1. ensure struts is up-to-date. (2.1.3-SNAPSHOT preferably, to ensure you
 have the latest ActionMappingParamsInterceptor)
 2. enable the NamedVariablePatternMatcher via struts.xml 3. Create the
 BookController in the root namespace.  GET /book/123 will invoke
 BookController.show() with id=123
 4. Create the ChapterController in the namespace containing the book id
 variable (/book/{bookid}). GET /book/123/chapter will invoke
 ChapterContoller.index() with bookId=123.

 ie.

 @Namespace(/)
 public class BookController implements ModelDrivenBook {  }


 @Namespace(/book/{bookId})
 public class ChapterController implements ModelDrivenChapter {  }


 Now that's what *should* happen.  I use it in a large application that
 includes many other related tweaks so I'll throw together a vanilla sample
 and post it somewhere.

 I'll come back to the authorization issue separately.  The quick answer is
 that you can omit methods that are never permitted and/or filter URLs based
 on a URI pattern and/or user's role.
 regards,
 Jeromy Evans


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



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



Re: REST plugin URL syntax

2008-07-06 Thread Mike Watson
The trick (I believe) is that the url should be parsed from right to
left, not left to right. I don't think it's a hijack; for the
application I'm working on context is very important so knowing that a
given resource is being accessed in the context of another resource
has a big part to play in dictating which functions should be
available and how they behave. (The book/chapter model is just an
example I used to try and simplify the problem).

Jeromy, I'm still really struggling to get this going, I don't suppose
you've found time to knock up that demo app?

Thanks in advance,

Mike

2008/7/6 dusty [EMAIL PROTECTED]:

 This doesn't seem right.  How can you distinguish between something like
 /book/1/customMethod and /book/1/chapter?  Is it smart enough to see that
 chapter is a mapped action and customMethod is not and change what it
 invokes?  If it works then great, but doesn't it feel like a hijack?

 As I look at apps in Struts and Rails I realize that I really don't ever
 need to address a child resource with something like /books/1/chapters/1.
 That is because the :id property for chapter is unique and so you just
 address chapters with /chapters/1.  Most of the time, once I get a child I
 can figure out who the parent is in the action rather than relying on the
 url to tell me.  I suppose that if :id is not unique for chapter and is some
 kind of composite that requires the book id in order to look the chapter up
 then you need both pieces of information, but that is an exception case,
 right?

 Either way, I am definitely interested on how Jeremy got this to work using
 namespaces.  Are you using Codebehind or Convention Jeremy?


 Jeromy Evans - Blue Sky Minds wrote:

 Mike Watson wrote:
 Hi Jeromy,

 I've finally found time to try to resolve this but haven't had much luck.

 Just to recap, I'm looking to be able to do something similar to the
 following:
 /book - returns a list of books
 /book/123 - returns book with id 123
 /book/123/chapter/1 - return chapter with id 1, retrieved from book
 123 (this is a simplistic example, all resources have a unique ID)

 I'd also like to be able to control access based on the
 context/namespace used to access a resource e.g.:
 /logo/abc - read or update
 /book/123/logo/abc - read only
 (would I need multiple LogoControllers for this?)

 Using Namespaces as described by Jeromy below certainly seems to make
 sense but as soon as I start to try the example provided I lose the
 ability to GET /book/123, and I've tried with BookController having
 namespace of / or /book and neither works. And so far I haven't
 been able to successfully hit the ChapterController using a url like
 /book/123/chapter.

 Am I missing something really obvious? Is there something I need to
 put in the struts.xml to configure the namespaces as well as using the
 @Namespace annotation?

 Jeromy, you seem to be pretty knowledgeable about this - can you think
 of anything I might be doing wrong?

 Thanks in advance for your help.

 Mike



 Hi Mike, I'll throw a quick answer together now and try to give you a
 more in-depth one in a day or two by building an example.

 The steps are:
  1. ensure struts is up-to-date. (2.1.3-SNAPSHOT preferably, to ensure
 you have the latest ActionMappingParamsInterceptor)
  2. enable the NamedVariablePatternMatcher via struts.xml
  3. Create the BookController in the root namespace.  GET /book/123 will
 invoke BookController.show() with id=123
  4. Create the ChapterController in the namespace containing the book id
 variable (/book/{bookid}). GET /book/123/chapter will invoke
 ChapterContoller.index() with bookId=123.

 ie.

 @Namespace(/)
 public class BookController implements ModelDrivenBook {  }


 @Namespace(/book/{bookId})
 public class ChapterController implements ModelDrivenChapter {  }


 Now that's what *should* happen.  I use it in a large application that
 includes many other related tweaks so I'll throw together a vanilla
 sample and post it somewhere.

 I'll come back to the authorization issue separately.  The quick answer
 is that you can omit methods that are never permitted and/or filter URLs
 based on a URI pattern and/or user's role.

 regards,
 Jeromy Evans


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




 --
 View this message in context: 
 http://www.nabble.com/REST-plugin-URL-syntax-tp17855192p18298747.html
 Sent from the Struts - User mailing list archive at Nabble.com.


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



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



Re: REST plugin URL syntax

2008-07-02 Thread Mike Watson
Thanks heaps Jeromy, I'll grab the 2.1.3 snapshot and try again.

A vanilla sample app would be great (others would probably find it useful too).

Cheers

Mike

2008/7/3 Jeromy Evans [EMAIL PROTECTED]:
 Mike Watson wrote:

 Hi Jeromy,

 I've finally found time to try to resolve this but haven't had much luck.

 Just to recap, I'm looking to be able to do something similar to the
 following:
 /book - returns a list of books
 /book/123 - returns book with id 123
 /book/123/chapter/1 - return chapter with id 1, retrieved from book
 123 (this is a simplistic example, all resources have a unique ID)

 I'd also like to be able to control access based on the
 context/namespace used to access a resource e.g.:
 /logo/abc - read or update
 /book/123/logo/abc - read only
 (would I need multiple LogoControllers for this?)

 Using Namespaces as described by Jeromy below certainly seems to make
 sense but as soon as I start to try the example provided I lose the
 ability to GET /book/123, and I've tried with BookController having
 namespace of / or /book and neither works. And so far I haven't
 been able to successfully hit the ChapterController using a url like
 /book/123/chapter.

 Am I missing something really obvious? Is there something I need to
 put in the struts.xml to configure the namespaces as well as using the
 @Namespace annotation?

 Jeromy, you seem to be pretty knowledgeable about this - can you think
 of anything I might be doing wrong?

 Thanks in advance for your help.

 Mike



 Hi Mike, I'll throw a quick answer together now and try to give you a more
 in-depth one in a day or two by building an example.
 The steps are:
 1. ensure struts is up-to-date. (2.1.3-SNAPSHOT preferably, to ensure you
 have the latest ActionMappingParamsInterceptor)
 2. enable the NamedVariablePatternMatcher via struts.xml 3. Create the
 BookController in the root namespace.  GET /book/123 will invoke
 BookController.show() with id=123
 4. Create the ChapterController in the namespace containing the book id
 variable (/book/{bookid}). GET /book/123/chapter will invoke
 ChapterContoller.index() with bookId=123.

 ie.

 @Namespace(/)
 public class BookController implements ModelDrivenBook {  }


 @Namespace(/book/{bookId})
 public class ChapterController implements ModelDrivenChapter {  }


 Now that's what *should* happen.  I use it in a large application that
 includes many other related tweaks so I'll throw together a vanilla sample
 and post it somewhere.

 I'll come back to the authorization issue separately.  The quick answer is
 that you can omit methods that are never permitted and/or filter URLs based
 on a URI pattern and/or user's role.
 regards,
 Jeromy Evans


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



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



Re: REST plugin URL syntax

2008-07-01 Thread Mike Watson
Hi Jeromy,

I've finally found time to try to resolve this but haven't had much luck.

Just to recap, I'm looking to be able to do something similar to the following:
/book - returns a list of books
/book/123 - returns book with id 123
/book/123/chapter/1 - return chapter with id 1, retrieved from book
123 (this is a simplistic example, all resources have a unique ID)

I'd also like to be able to control access based on the
context/namespace used to access a resource e.g.:
/logo/abc - read or update
/book/123/logo/abc - read only
(would I need multiple LogoControllers for this?)

Using Namespaces as described by Jeromy below certainly seems to make
sense but as soon as I start to try the example provided I lose the
ability to GET /book/123, and I've tried with BookController having
namespace of / or /book and neither works. And so far I haven't
been able to successfully hit the ChapterController using a url like
/book/123/chapter.

Am I missing something really obvious? Is there something I need to
put in the struts.xml to configure the namespaces as well as using the
@Namespace annotation?

Jeromy, you seem to be pretty knowledgeable about this - can you think
of anything I might be doing wrong?

Thanks in advance for your help.

Mike

2008/6/18 Jeromy Evans [EMAIL PROTECTED]:
 Don Brown wrote:

 I believe it is technically possible to do this, but not at all
 intuitive right now.  This is probably my number one improvement
 request for the REST plugin.

 You should be able change the wildcard mapper to one that recognizes
 named wildcards then use them in your namespace annotation like this:
 @Namespace(/book/{bookId})


 Don


 Yeah, I use this feature heavily to support URIs matching Mike's
 requirement.

 in struts.xml
 bean type=com.opensymphony.xwork2.util.PatternMatcher
 name=namedVariablePatternMatcher
 class=com.opensymphony.xwork2.util.NamedVariablePatternMatcher/

 in *actions.*.ChapterContoller.java
 @Namespace(/book/{bookId})
 public class ChapterController implements ModelDrivenChapter {

  private void setBookId(Long id) {...}
  private void setId(Long id) { ..}
  private Chapter getModel() {...}

  public HttpHeaders show() {
   model = bookService.lookupChapter(bookid, id);
   if (model != null) {
 return new DefaultHttpHeaders(show);
   } else {
 return new DefaultHttpHeaders(error);
   }
  }
  public HttpHeaders index() {...}
 }

 and

 in *actions.BookContoller.java
 @Namespace(/)
 public class BookController implements ModelDrivenBook {  }

 regards,
 Jeromy Evans



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



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



Re: Rest plugin and binary data

2008-06-24 Thread Mike Watson
Hi Jeromy,

Please ignore my other email, I was being a dumb-ass.

Thanks heaps for the tips, I managed to get this working today.

Mike

2008/6/20 Jeromy Evans [EMAIL PROTECTED]:
 Mike Watson wrote:

 Hi Folks,

 I'm trying to figure out how to return binary data from the REST plugin.

 I'd like to be able to return images that are generated on the fly by
 a REST request but looking at ContentTypeHandlerManager, it assumes
 that we'll only ever want to return a string and so passes a
 StringWriter as the output for implementers of
 ContentTypeHandler.fromObject.



 At first, don't create a custom ContentTypeHander.
 Just have your Controller declare a StreamResult. The default
 ContentTypeHandler will drop through for result processing by XWork (as per
 a ServletRedirectResult).

 eg. GET /namespace/image/21

 @Result(stream, type = StreamResult.class, value=image)
 class ImageController {
  public InputStream getImage() {}

  public String show() {
// create the stream
return stream;}
 }

 See StreamResult for how to set the Content-type and other properties.

 One that works, you could (potentially) register a ContentTypeHandler for
 each image content type you want to return (eg. register the jpg and png
 extensions).  The ContentTypeHandler should do nothing except return a
 result name for XWork that is mapped to a StreamResult.  The image retrieval
 would have to be performed in the Controller rather than the Handler though.
  There is probably a bit of work to do in the plugin to handle binary
 results better though.

 Hope that gets you started.
 Jeromy Evans



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



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



Re: Rest plugin and binary data

2008-06-22 Thread Mike Watson
Hi Jeromy,

Thanks for the response, that's really helpful.

Could you possibly provide a little bit more detail though as I
haven't been able to get this working yet.

This might seem like a stupid question, but in your code snippet below
where you have: // create the stream
Where does the output go? Should I use ModelDriven and assign it to the model?

Also how do I get a handle on the StreamResult object so I can specify
attributes programmatically? All the samples I have seen do so
declaratively.

Thanks again for the tips!

Mike


2008/6/20 Jeromy Evans [EMAIL PROTECTED]:
 Mike Watson wrote:

 Hi Folks,

 I'm trying to figure out how to return binary data from the REST plugin.

 I'd like to be able to return images that are generated on the fly by
 a REST request but looking at ContentTypeHandlerManager, it assumes
 that we'll only ever want to return a string and so passes a
 StringWriter as the output for implementers of
 ContentTypeHandler.fromObject.



 At first, don't create a custom ContentTypeHander.
 Just have your Controller declare a StreamResult. The default
 ContentTypeHandler will drop through for result processing by XWork (as per
 a ServletRedirectResult).

 eg. GET /namespace/image/21

 @Result(stream, type = StreamResult.class, value=image)
 class ImageController {
  public InputStream getImage() {}

  public String show() {
// create the stream
return stream;}
 }

 See StreamResult for how to set the Content-type and other properties.

 One that works, you could (potentially) register a ContentTypeHandler for
 each image content type you want to return (eg. register the jpg and png
 extensions).  The ContentTypeHandler should do nothing except return a
 result name for XWork that is mapped to a StreamResult.  The image retrieval
 would have to be performed in the Controller rather than the Handler though.
  There is probably a bit of work to do in the plugin to handle binary
 results better though.

 Hope that gets you started.
 Jeromy Evans



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



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



Rest plugin and binary data

2008-06-19 Thread Mike Watson
Hi Folks,

I'm trying to figure out how to return binary data from the REST plugin.

I'd like to be able to return images that are generated on the fly by
a REST request but looking at ContentTypeHandlerManager, it assumes
that we'll only ever want to return a string and so passes a
StringWriter as the output for implementers of
ContentTypeHandler.fromObject.

Am I missing something really obvious or do I need to 'tweak' this
behaviour and decide what type of writer to provide?

Thanks in advance.

Mike

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



Re: REST plugin URL syntax

2008-06-17 Thread Mike Watson
Hi Al,

Thanks for the comments. The book/chapter description is actually a
simplification of my real problem domain (which is commercially
sensitive).

The under-lying storage mechanism isn't simple but is quite abstract
from the REST API we are providing and the hierarchical model is
required to describe the relationships between resources in the
desired way.

If you can get your hands on that O'Reilly book it's worth a read,
seems to be one of the better REST resources around.

Mike

2008/6/17 Al Sutton [EMAIL PROTECTED]:
 Mike,

 The safari signup requires a credit card which I'm not going to give so I'm
 afraid I can't comment after seeing the book.

 It has always been my understanding that the /Earth/France/Paris style of
 notation is a search engine optimised  (SEO) layer which has the design goal
 of being descriptive to humans and search engines and is not designed with
 the REST principals of performance and efficiency.

 The main problem with performance is that, in most cases, you're going to be
 looking the data up in a database table, therefore you have your unique ID
 as the primary key for the table. The data in the table may, in turn, be a
 reference to a storage device and location where the data is stored, but at
 the top level you have the single primary key, hence the single /noun/id
 combination.

 If you're thinking of mapping the book to a folder name and the chapter to a
 filename in the folder then I would urge you to look at some of the comments
 around the web on how flat file systems scale, and possibly think about an
 intermediate table which maps IDs to the location of the chapter data which
 would allow you to have separate file stores to spread the data accross.

 Al.

 Mike Watson wrote:

 Thanks for the feedback.

 I actually disagree regarding whether my url syntax is restful.

 Have you read the O'Reilly book: RESTful Web Services by Leonard
 Richardson; Sam Ruby?

 If not please take a look (you can probably see sample chapters on
 Safari if you don't have an account).
 Specifically in section 5.5.1 Encode Heirarchy into Path Variables
 where examples like this are provided:
 http://maps.example.com/Earth/France/Paris

 In fact the samples the entire book is based on all rely on hierarchy.
 Hierarchy is *very* relevant to my problem domain and is something
 that a RESTful interface *should* be able to support. Do you not agree
 a news website is hierarchical? The web is hierarchical in nature.
 REST is supposed to be the language of the web...

 If the REST plugin can't support this hierarchical model I'd say it is
 fundamentally flawed. I'm happy to help rectify this but to say that
 this approach just isn't REST is simply not true.

 Can anybody suggest where I would start in an attempt to implement
 this hierarchical model? Or do I need to start looking for a
 replacement for the Struts2 REST plugin?

 Thanks for your time.

 Mike

 2008/6/17 Al Sutton [EMAIL PROTECTED]:


 It's true that it takes a bit of reading between the lines, but basically
 REST relies on unique identifiers for resources, which for HTTP is
 commonly
 taken to mean a URLs of the form;

 http://server/resource_noun/id

 (to confirm this have a spin through the google results showing various
 examples).

 With servers with many apps on this is commonly expanded to;

 http://server/app/resource_noun/id

 In the strictest send the Mikes URLs should be;

 http://www.mydomain.com/chapter/123_1

 because we are uniquely identifying a chapter and to do this we need to
 include the book id, but for the sake of clarity (which was the reason I
 beleive he was using x/x_id/y/y_id notation I expanded the noun to show
 book
 and chapter.

 Al.


 Laurie Harper wrote:


 It may be the case that the REST plugin can't support this (I don't know
 if that's true) but I don't see anything in the cited reference that
 says
 such URLs are un-RESTful. And a Struts apps should certainly be able to
 support them, even if it requires writing a little more code (e.g. a
 custom
 action mapper?)

 L.

 Al Sutton wrote:


 Mike,

 Rest URLs doesn't work that way, so the plugin is correct and your
 needs
 are not in sync with REST standards (see
 http://en.wikipedia.org/wiki/Representational_State_Transfer for a more
 details on REST).

 If you want to do something with multiple IDs my suggestion would be
 URLs
 along the lines of;

 http://www.mydomain.com/rest/bookAndChapter/123_1

 Al.

 Mike Watson wrote:


 Hi Folks,

 I'm trying to use the REST plugin to implement a service that serves
 resources using the following url syntax:

 http://www.mydomain.com/rest/book/123   (which works fine)
 http://www.mydomain.com/rest/book/123/chapter   (which throws a 500
 because my book controller doesn't have a chapter() method)
 http://www.mydomain.com/rest/book/123/chapter/1   (which returns 404)

 I'd expect the two chapter urls to access the ChapterController
 instead of the BookController.

 Being able to request resources

Re: REST plugin URL syntax

2008-06-17 Thread Mike Watson
Hmmm, I haven't come across the Namspace annotation stuff. I'll
investigate that and see how I get on. If anyone can point me at some
useful examples of how I might achieve this it'd be greatly
appreciated.

Thanks again for all the responses...

2008/6/17 Don Brown [EMAIL PROTECTED]:
 I believe it is technically possible to do this, but not at all
 intuitive right now.  This is probably my number one improvement
 request for the REST plugin.

 You should be able change the wildcard mapper to one that recognizes
 named wildcards then use them in your namespace annotation like this:
 @Namespace(/book/{bookId})

 As I said, it really needs work as this is a huge deficiency in the
 REST plugin right now, but the reason I haven't just made this easier
 as I'm toying with the idea of borrowing the URI mapping behavior from
 Jersey, which I find very intuitive, if a bit un-Struts/xwork-like.

 Don

 On Tue, Jun 17, 2008 at 9:10 AM, Mike Watson [EMAIL PROTECTED] wrote:
 Well that'd be nice but I'm really struggling to get it to behave the
 way I want. Any thoughts on how I might do this?

 2008/6/17 Dave Newton [EMAIL PROTECTED]:
 --- On Mon, 6/16/08, Mike Watson [EMAIL PROTECTED] wrote:
 Can anybody suggest where I would start in an attempt to
 implement this hierarchical model?

 The existing REST plugin?

 Just an idea.

 Dave


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



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



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



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



Re: REST plugin URL syntax

2008-06-16 Thread Mike Watson
Thanks for the feedback.

I actually disagree regarding whether my url syntax is restful.

Have you read the O'Reilly book: RESTful Web Services by Leonard
Richardson; Sam Ruby?

If not please take a look (you can probably see sample chapters on
Safari if you don't have an account).
Specifically in section 5.5.1 Encode Heirarchy into Path Variables
where examples like this are provided:
http://maps.example.com/Earth/France/Paris

In fact the samples the entire book is based on all rely on hierarchy.
Hierarchy is *very* relevant to my problem domain and is something
that a RESTful interface *should* be able to support. Do you not agree
a news website is hierarchical? The web is hierarchical in nature.
REST is supposed to be the language of the web...

If the REST plugin can't support this hierarchical model I'd say it is
fundamentally flawed. I'm happy to help rectify this but to say that
this approach just isn't REST is simply not true.

Can anybody suggest where I would start in an attempt to implement
this hierarchical model? Or do I need to start looking for a
replacement for the Struts2 REST plugin?

Thanks for your time.

Mike

2008/6/17 Al Sutton [EMAIL PROTECTED]:
 It's true that it takes a bit of reading between the lines, but basically
 REST relies on unique identifiers for resources, which for HTTP is commonly
 taken to mean a URLs of the form;

 http://server/resource_noun/id

 (to confirm this have a spin through the google results showing various
 examples).

 With servers with many apps on this is commonly expanded to;

 http://server/app/resource_noun/id

 In the strictest send the Mikes URLs should be;

 http://www.mydomain.com/chapter/123_1

 because we are uniquely identifying a chapter and to do this we need to
 include the book id, but for the sake of clarity (which was the reason I
 beleive he was using x/x_id/y/y_id notation I expanded the noun to show book
 and chapter.

 Al.


 Laurie Harper wrote:

 It may be the case that the REST plugin can't support this (I don't know
 if that's true) but I don't see anything in the cited reference that says
 such URLs are un-RESTful. And a Struts apps should certainly be able to
 support them, even if it requires writing a little more code (e.g. a custom
 action mapper?)

 L.

 Al Sutton wrote:

 Mike,

 Rest URLs doesn't work that way, so the plugin is correct and your needs
 are not in sync with REST standards (see
 http://en.wikipedia.org/wiki/Representational_State_Transfer for a more
 details on REST).

 If you want to do something with multiple IDs my suggestion would be URLs
 along the lines of;

 http://www.mydomain.com/rest/bookAndChapter/123_1

 Al.

 Mike Watson wrote:

 Hi Folks,

 I'm trying to use the REST plugin to implement a service that serves
 resources using the following url syntax:

 http://www.mydomain.com/rest/book/123   (which works fine)
 http://www.mydomain.com/rest/book/123/chapter   (which throws a 500
 because my book controller doesn't have a chapter() method)
 http://www.mydomain.com/rest/book/123/chapter/1   (which returns 404)

 I'd expect the two chapter urls to access the ChapterController
 instead of the BookController.

 Being able to request resources 'within resources' like this is
 crucial to my application. Can anybody tell me how I can configure the
 rest plugin to behave like this, or point me at some documentation
 that does?

 Thanks in advance,

 Mike

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




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



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



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



Re: REST plugin URL syntax

2008-06-16 Thread Mike Watson
Well that'd be nice but I'm really struggling to get it to behave the
way I want. Any thoughts on how I might do this?

2008/6/17 Dave Newton [EMAIL PROTECTED]:
 --- On Mon, 6/16/08, Mike Watson [EMAIL PROTECTED] wrote:
 Can anybody suggest where I would start in an attempt to
 implement this hierarchical model?

 The existing REST plugin?

 Just an idea.

 Dave


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



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



REST plugin URL syntax

2008-06-15 Thread Mike Watson
Hi Folks,

I'm trying to use the REST plugin to implement a service that serves
resources using the following url syntax:

http://www.mydomain.com/rest/book/123   (which works fine)
http://www.mydomain.com/rest/book/123/chapter   (which throws a 500
because my book controller doesn't have a chapter() method)
http://www.mydomain.com/rest/book/123/chapter/1   (which returns 404)

I'd expect the two chapter urls to access the ChapterController
instead of the BookController.

Being able to request resources 'within resources' like this is
crucial to my application. Can anybody tell me how I can configure the
rest plugin to behave like this, or point me at some documentation
that does?

Thanks in advance,

Mike

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



Re: struts editor

2008-06-10 Thread Mike Jennings
If you don't understand how to use the configuration files, then all the 
editor will do is get you in trouble.


Felipe Lorenz wrote:

I dont know.. exist one for NetBeans.. but is beta..
https://nbstruts2support.dev.java.net/

But, if you find one, PLEASE tell us...

On Tue, Jun 10, 2008 at 4:46 PM, Lalchandra Rampersaud 
[EMAIL PROTECTED] wrote:


 hi,
i am having a hard time creating my .jsp pages with struts components in
eclipse with myeclipse.  is there a struts editor available that will make
the visual designing part easier?


Lalchandra Rampersaud

Carpe diem

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




Spam/Virus scanning by CanIt Pro

For more information see
http://www.kgbinternet.com/SpamFilter.htm

To control your spam filter, log in at
http://filter.kgbinternet.com


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



Re: authentication question

2008-03-18 Thread Mike Jennings
I use Acegi security to make sure that all of my pages are secure.  I 
find it very flexiable, but not always easy to configure.


If you are already using spring as you IoC, then you might as well take 
advantage of Acegi.


Jeromy Evans wrote:
I've been told that some older containers don't allow you to forward to 
JSP's behind /WEB-INF. It wouldn't surprise me.
Other than that I've found Ian's suggestion to be the most effective way 
to ensure users can't access JSPs directly, IMO a must for Tiles, html 
fragments and any page using struts tags.


The only issue I've experienced is when (bad) scriptets within the JSP 
manipulate the request object directly, which is assumed to use the 
/xxx.jsp URI but is actually /WEB-INF/results/xxx.jsp.


Many would argue that best practice is to not use JSPs at all.  Another 
group would argue that Acegi should be used rather than rolling your own 
filter.


Hope that helps.

mojoRising wrote:

Is this considered the Best Practice: Keeping all JSP's under the WEB-INF
directory? We have not done that on my project, I am curious if there are
plus' and minus' to this?

Thanks,
John



The easiest way is to always have the user call an action to get a 
JSP, even if it is a simple page.  You then also ensure that all data 
necessary for that page has been obtained.  The, by placing the JSP's 
in the WEB-INF directory you will prevent access directly from a 
browser (only from the s2 dispatcher).


Otherwise, I would suggest a servlet filter or header code for all 
JSPs that make the necessary checks.


/Ian

  



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



Spam/Virus scanning by CanIt Pro

For more information see
http://www.kgbinternet.com/SpamFilter.htm

To control your spam filter, log in at
http://filter.kgbinternet.com



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



Re: Newbie question

2008-03-18 Thread Mike Jennings
I like KGBInternet.com.  They are affordable and will provide you with 
the services that you need.


maitre wrote:

Hi,

I'm trying to find a decent hosting company that supports STRUTS 2. Are
there any recommendations?

Thanks,

Ed



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



[OT] Complete List of Logged In Users

2008-03-14 Thread Mike Duffy
I marked this as other because this is probably sever specific (in my case I am 
using JBoss).

Using the Struts framework is there some simple way to get a list of all the 
users logged into the server?

Thx.

Mike


  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


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



Re: servletOutputStream in S2 action

2008-02-07 Thread Mike Jennings

You can do this by creating a custom result type.

A example of a custom result type for streaming images from a action to 
a img tag is here.


http://struts.apache.org/2.x/docs/how-can-we-display-dynamic-or-static-images-that-can-be-provided-as-an-array-of-bytes.html

You can use this as a example, but will probably have to have a modify 
it slightly so that your action will have a getter and setter to pass a 
output stream to the result type.  In the result type you can write the 
 output stream to the response output stream.


Mike Jennings

bhaarat Sharma wrote:

Hello

I have a S2 action working perfectly fine.  But on one page of my web
App I would like the user to be able to download report in Excel.  We
have this functionality in other pages as well but they arent using S2
and are doing this via a custom servlet which has doGet doPost and
processRequest methods.

Inside the processRequest..they do bunch of stuff to get the excel
read and in the end do this:

 ServletOutputStream stream = null;
 String fileName = \something\;


 response.addHeader(\Content-Disposition\, \attachment;
filename=\ + fileName);
 response.setContentType(\application/vnd.ms-excel\);
 stream = response.getOutputStream();
 wb.write(stream);

this is a void method.

My question is, since in my case I already have a S2 action..I dont
want to make a new servlet to do this.

How can i do the same in my execute method for S2?? what should the
execute method return? because when user clicks get Excel link..the
page stays the same but just the user is presented with open/save
dialog.

Woudl appreciate any help.

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



Spam/Virus scanning by CanIt Pro

For more information see
http://www.kgbinternet.com/SpamFilter.htm

To control your spam filter, log in at
http://filter.kgbinternet.com



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



Struts, Interceptor error message customization

2008-01-30 Thread Mike J. M.
Hello,


So I am currently using Struts, including an action that has a fileUpload
Interceptor that checks for files that are too large and certain allowable
file types. Right now if either of these conditions are met, the system will
throw a generic HTTP 500 error up. What I am wondering is how to customize
this.


in the docs:
http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/interceptor/FileUploadInterceptor.html

i found these messages that i can supposedly customize. however, the doc
does not specify WHERE i am supposed to put these error messages at, and
furthermore, after looking at the source code for FileUploadInterceptor, I
found that these messages are printed to the log file, and it doesn't look
like it prints to the actual HTML.


* struts.messages.error.uploading - a general error that occurs when the
file could not be uploaded


* struts.messages.error.file.too.large - occurs when the uploaded file is
too large


* struts.messages.error.content.type.not.allowed - occurs when the uploaded
file does not match the expected content types specified


The doc says that these error messages originate from
struts-messages.properties. I'm guessing that's in the struts.jar itself
because I don't see it anywhere else, so am I supposed to modify that
directly? I'm a little bit iffy about doing that.




So, in a nutshell, how do I catch an Interceptor error and make it redirect
to a nice page instead of the generic HTTP 500 page? Actually, what would be
better is to redirect to an action while passing into it a parameter
message that will contain error messages. Then, in the JSP i want to do
s:property ... to grab that message.


thank you!


how to use difference resource file in Class ActionMessage

2008-01-09 Thread Mike . G
Hi, one question about the Class ActionMessage,
how to use the difference resource file in Class ActionMessage?

example:
I have to resource file,  one is the default for struts configuration,
secondly had used a bundle key.

so, how to use that message resource file in Class ActionMessage?

thanks

Mike.G


how to use difference message resource file in ActionMessage

2008-01-09 Thread Mike . G
Hi, everyone,
I am use the struts version 1.

now I have a question about the class ActionMessage:

if I had configurated more than one message resources in struts-config.xml,
and I had use difference key for mark  them.

but In my action, I want to use ActionMessage for some message,  how to do
for that ActionMessage don't use the default MessageResource?

In Bean Tag, I knew,  I can use bean:messsage key=somekey
bundle=resourcekey/, right?
how to do this in ActionMessage?

do I have to sub-class ActionMessage for hack that?


thanks very much.


Mike.G


Re: Struts 2.0.5 - Oracle 10g R3 App server problem

2008-01-08 Thread Mike Jennings
I had this same issue when using struts 2.0.5 with OC4J 10.1.3.1.  This 
issue has now been fixed and I have tested it when using struts 2.0.11 
and above.  Upgrade your struts release and the problem should be fixed.


Mike Jennings

VJ22 wrote:

Hi,

Our application has to be deployed on a Oracle Application server platform
(specific version 10g R3)..So we got an HTTP server which routes requests to
the OC4J server which processes them

 I am facing a peculiar problem with this...Whenever I POST data from any
screens either via forms or via URL re-writing (i.e
http://localhost:/test.action?id=11001) , the value of the
parameters(i.e. id) is always nullI can see that the entire
interceptor stack is invoked, but I am at a loss as to how this is
happening...

Could some one please shed some light on this ? Would be much appreciated
and thanks in advance...

P.S This works fine if I deploy it on a standalone OC4J container without
the HTTP server

Thanks...Vijay


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



  1   2   3   4   >