Re: Struts2 - Generate XML in an Action, then direct user to download .xml

2010-10-12 Thread Steven Yang
Hi Overby Result is indeed your choice to go. in general you should avoid any direct use of the Servlet stuff in your Actions. you should prepare your data in your action or "execute" then determine what data type you want to return then return the proper "result" string then let your Result form

Re: Struts2 - Generate XML in an Action, then direct user to download .xml

2010-10-12 Thread Grant Overby
After some googling; I'm looking at the Result interface. Would it be proper for the action to set a property, and use this custom Result to read that property from ValueStack and write it to (with XStream for isntance) ServletActionContext.getResponse().getOutputStream() ? So Results exist for d

Re: [S2] 2.2.1 possible freemarker template bug

2010-10-12 Thread dusty
Finally, some progress. web.xml templatePath template It said in the source code that it can't be a relative path but for me template is under my webroot. Sean Ford wrote: > > Hello, > > We are experiencing some Freemarker theme issues after upgrading to > Str

Re: Struts2 - Generate XML in an Action, then direct user to download .xml

2010-10-12 Thread Li Ying
You can generate your XML dynamically, and then write it to the response stream. If you set the response headers correctly, the browser should treat this response as a file downloading. Code in your action looks like this: public String execute() { String xmlStr = generateXML(); Http

Re: Master-details JSP with Validation xml

2010-10-12 Thread Li Ying
Interface [Preparable] is another choice to implement the data loading logic. But, in some case, the data loading logic need to access the parameters value to know what data should be loaded. And, unfortunately, the interceptor [prepare] is configured before interceptor [params] in the default int

Re: Struts2 - Generate XML in an Action, then direct user to download .xml

2010-10-12 Thread Dave Newton
Which version of Struts?! Stream result if Struts 2, handle the headers and return null if Struts 1. On Tuesday, October 12, 2010, Grant Overby wrote: > I've generated some XML in an action, and I'd like to direct the user to > download it. It should be have as if they clicked a link pointing to

Re: Generic Question about Struts2 Interceptor

2010-10-12 Thread aum strut
That's really Helpful Greg On Wed, Oct 13, 2010 at 12:21 AM, Greg Lindholm wrote: > Here are some that I've used in recent project: > > AuthenticationInterceptor to check if user is signed in. > HibernateInterceptor to manage Hibernate session lifecycles > LoggingInterceptor for custom logging >

Struts2 - Generate XML in an Action, then direct user to download .xml

2010-10-12 Thread Grant Overby
I've generated some XML in an action, and I'd like to direct the user to download it. It should be have as if they clicked a link pointing to the dynamic xml, eg: /yourfile.xml . Any pointers on how to accomplish this? gove...@students.kennesaw.edu

Re: Store permanently file in temp directory

2010-10-12 Thread Dave Newton
On Tuesday, October 12, 2010, Anjib Mulepati wrote: > Also in validation part, I didn't find a way file names in the file input box > reload automatically after validation fail. It is possible to do with normal > HTML tag No. That's just how browsers work; it's a security thing. Dave

Re: Store permanently file in temp directory

2010-10-12 Thread Anjib Mulepati
Does the (temporary!!) files get deleted automatically? I though that we have to delete it with some additional code. Can any one make clear on this. Also in validation part, I didn't find a way file names in the file input box reload automatically after validation fail. It is possible to do

Store permanently file in temp directory

2010-10-12 Thread Oscar
Hi to all, i'm developing a S1 application that has a form with upload file control. I know that, by default, when you upload a file, it stores temporally in a temp directory that normally is web directory. I know that after that, the file is deleted, so i wanna know if exists a way to tell struts

Re: Generic Question about Struts2 Interceptor

2010-10-12 Thread Greg Lindholm
Here are some that I've used in recent project: AuthenticationInterceptor to check if user is signed in. HibernateInterceptor to manage Hibernate session lifecycles LoggingInterceptor for custom logging HandsetPropertiesInterceptor for injecting properties into the request based on User-Agent sett

Re: Setting associated objects for the current model

2010-10-12 Thread Dave Newton
I don't know about sets; personally I'd use a map so you actually have a way to access them by something meaningful, like an ID. Then you use map-based property field names (it's [] or (), with the key inside, I forget which off the top of my head). I think () is for indexed, so I'd aim for [] firs

Setting associated objects for the current model

2010-10-12 Thread Ryan Beckes
Hello, I'm using an action which implements the ModelDriven interface where my model is a hibernate POJO (e.g. Customer). In this Customer I have a OneToMany relationship with another hibernate POJO (e.g. Address)... /** persistent field */ @OneToMany(mappedBy="customer", targetEntity=com

Re: Master-details JSP with Validation xml

2010-10-12 Thread Dave Newton
It does if you use the prepare params prepare stack. On Tuesday, October 12, 2010, cellterry wrote: > > At Preparable timing it does not have the customer data (customer=null) so > that I cannot retrieve warehouse information by customer ID. > > Terry. > > > Dave Newton-6 wrote: >> >> Ugh, implem

Re: Generic Question about Struts2 Interceptor

2010-10-12 Thread aum strut
I am truely agree but can give me some example where you have applied them just to get me an idea may be lacing imagination this time :) On Tue, Oct 12, 2010 at 10:40 PM, Greg Lindholm wrote: > Every app I've written has custom interceptors (and of course custom > interceptor stacks). > Don't fe

Re: Master-details JSP with Validation xml

2010-10-12 Thread cellterry
At Preparable timing it does not have the customer data (customer=null) so that I cannot retrieve warehouse information by customer ID. Terry. Dave Newton-6 wrote: > > Ugh, implementing Prepareable seems more palatable to me than throwing > the same logic into somethingnthat returns the inputn

Re: Generic Question about Struts2 Interceptor

2010-10-12 Thread Greg Lindholm
Every app I've written has custom interceptors (and of course custom interceptor stacks). Don't fear interceptors, they are your friends. On Tue, Oct 12, 2010 at 12:17 PM, aum strut wrote: > Hi All, > > I have a generic question about Struts2Interceptor,since Struts2 is itself > in term of Interc

Re: Master-details JSP with Validation xml

2010-10-12 Thread Dave Newton
Ugh, implementing Prepareable seems more palatable to me than throwing the same logic into somethingnthat returns the inputnresult name. Dave On Tuesday, October 12, 2010, cellterry wrote: > > Thank you. > > This helps to solve the problem,, Li Ying. > > Terry. > > > Li Ying-2 wrote: >> >> Hi ce

Re: Generic Question about Struts2 Interceptor

2010-10-12 Thread Dave Newton
I don't think I've deployed an app without at least one or two custom interceptors. On Tuesday, October 12, 2010, aum strut wrote: > Hi All, > > I have a generic question about Struts2Interceptor,since Struts2 is itself > in term of Interceptor and most of the required interceptors are there > pl

Re: struts2-portlet2-plugin-2.1.8.1 in Liferay 6.0.5 - Post-Redirect-Get aka Redirect after post

2010-10-12 Thread Alberto Gallardo
> couldn't get the Post-Redirect-Get (PRG) working. The type="redirectAction"> does not translate into a browser redirection. I've tried to debug the code, and only could find following method implementation, that suggest me that an http redirection _is_not_supported_: package org.apache.struts2

Generic Question about Struts2 Interceptor

2010-10-12 Thread aum strut
Hi All, I have a generic question about Struts2Interceptor,since Struts2 is itself in term of Interceptor and most of the required interceptors are there placed. My question is how many of us are using custom Interceptor which are there in production enviornment.my idea is to get some broad presp

Re: Master-details JSP with Validation xml

2010-10-12 Thread cellterry
Thank you. This helps to solve the problem,, Li Ying. Terry. Li Ying-2 wrote: > > Hi cellterry: > > I think your problem is very general. > > What you need is a chance to reload some data, when the > validation get failed and the page is displayed again. > > I think this document can help

Re: Activity can display dynamically depend on the locale on Struts

2010-10-12 Thread Maurizio Cucchiara
I would not mix tag directive with action logic. Why don't you simply put localization keys inside ListItem value and after retrieve your localized values inside through struts tags? For example: arraylist.add(new ListItem("Activity", "activity.name")); or alternatively struts could directly tr

Re: Master-details JSP with Validation xml

2010-10-12 Thread Li Ying
By the way, you can read source code of [com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor] to see how these 2 solutions get work. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands,

Re: Master-details JSP with Validation xml

2010-10-12 Thread Li Ying
Another solution is: 1, Implement interface [ValidationWorkflowAware] in your Action class 2, In method [getInputResultName], you can load all the data you need, and then, return constant [INPUT] as the result name. Actually, In my application, I am using this solution in a little different w

Re: Master-details JSP with Validation xml

2010-10-12 Thread Li Ying
Hi cellterry: I think your problem is very general. What you need is a chance to reload some data, when the validation get failed and the page is displayed again. I think this document can help you: http://struts.apache.org/2.2.1/docs/inputconfig-annotation.html

Activity can display dynamically depend on the locale on Struts

2010-10-12 Thread singh123
i want to display activities dynamically which can be increase or decrease on struts 2 framework and that depend on the Locale (like English or French) . dynamically means user can be expend or collapse (add or delete) activity at run time. I have two properties file: messages.properties: activi