Re: [S2] Accessing objects in the Spring context?
On Tue, Sep 8, 2009 at 6:54 PM, James Carr wrote: > Eh, that's the more complicated way... struts2 autowires by name, no > need to implement ApplicationContextAware. I didn't realize that. The code in SpringObjectFactory looks for ContextAware and sets it independently and then calls autowire. I just assumed it did this because the Spring contexts was not autowired. >I think people are missing > the point. I did miss your point as the link you sent as part of this solved the problem fairly well. I thought you were looking for a different approach. I have not used a filter for this in the past as filtering isn't related to setting the application context in the servlet context. I have subclassed ContextLoaderListener to accomplish this task. Here is an example: public class ApplicationServletContextLoaderListener extends ContextLoaderListener { public void contextInitialized(ServletContextEvent event){ super.contextInitialized(event); ServletContext servletContext = event.getServletContext(); final ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); servletContext.setAttribute("applicationContex", new AbstractMap(){ ApplicationContext context = ctx; public Object get(Object key) { if(key == null){ return null; } return context.getBean(key.toString()); } public Set entrySet(){ return Collections.EMPTY_SET; } } ); } } I do like the ability of the filter to populate a prototype object from a request and use it in a later jsp. I can see how this could make simple searches easy. Thanks for posting that. > I got it working just fine by adding 10 properties to my action with > appropriate getters and setters, but I'm trying to sneak around having > to add them to my Actions because I'd rather just have them available > in my JSPs. No big deal I guess because I got it to work by adding the > properties to my Action and they get auto-wired by Spring, but it'd be > REALLY nice if they were available on the context map... it looks like > I can either writer an Interceptor to put the beans on the stack. I have tried to avoid the discussions as to why Spring doesn't just add the application context to the servlet context without additional work. This seems to be more of a Spring question than Struts. Most of the examples I have seen use accessors in a super class to accomplish what you are doing. I wish I knew why. I am confused about why doing this in an interceptor would be better than in the action. If you wish to expose a subset of the Spring beans, the action solution already does that. If you want to generally expose the Spring beans to the page, doing it as part of web app initialization seems like the most convenient approach. -- cordially, Marty Milligan PO Box 434, Falling Waters, WV 25419 http://milligansisland.com/ http://byteslinger.com/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Global Exceptions with Convention Plugin
Hi My project is using Struts 2.1.6 based on blank.war with the convention plugin enabled. I'm having a problem getting global exception catching to work - I'm still getting the stack trace displayed in the browser. Do I need to add anything that would not be available "out of the box" having started with importing blank.war into my ide. I've attached my struts.xml below. Regards http://struts.apache.org/dtds/struts-2.0.dtd";> menu -- View this message in context: http://www.nabble.com/Global-Exceptions-with-Convention-Plugin-tp25395678p25395678.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
Re: how to read the contents of uploaded file
Thank you so much -kirti -- View this message in context: http://www.nabble.com/how-to-read-the-contents-of-uploaded-file-tp25384149p25395100.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
Re: Chain a global result to an action?
Hi, I m facing the same problem, and I've posted to list. Please follow for any updates: http://www.nabble.com/Problem-with-result-returning-from-interceptor-td25075486.html Regards, ManiKanta G twitter.com/manikantag On Fri, Sep 11, 2009 at 1:10 AM, Bill Bohnenberger wrote: > I'll let someone else answer this... I've not jet used the convention > plugin > (too bleeding edge for me! :) > > On Thu, Sep 10, 2009 at 12:11 PM, Jim Collings > wrote: > > > I also forgot to mention that this is a convention-plugin project. > > > > On Thu, Sep 10, 2009 at 3:10 PM, Jim Collings > wrote: > > > Will I have to define the action in the struts.xml? I'm currently > > > using annotations to handle mapping. > > > > > > Jim C. > > > > > >> This works for me: > > >> > > >> > > >> > >> > > >> > > >>DeadEnd > > >> > > >> > > >>... > > >> > > >>deadEnd.jsp > > >> > > >> > > >>... > > >> > > >> > > >> > > >> The entire action class is: > > >> > > >> @SuppressWarnings("serial") > > >> public class DeadEnd extends ActionSupport > > >> { > > >> > > >> } > > >> > > >> and when any action returns "error" the deadEnd.jsp page is displayed. > > >> > > >> - Bill > > >> > > >> On Thu, Sep 10, 2009 at 11:49 AM, Jim Collings > > wrote: > > >> > > >>> Anybody know what the syntax for this is? I don't seem to be getting > > it > > >>> right. > > >>> > > >>> > > >>> Jim C. > > >>> > > >>> - > > >>> 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: Page waits to load initially with Div Dojo tag
Hello, I wonder if you solved this. I'm facing the same problema and saw no info on the docs. Also have tried with delay="0" and preload="true" Mekna wrote: > > I would appreciate any kind of Help, Thanks > > Hi, > > I am struts user. upgrading app from struts 2.0.11.2 to struts 2.1.6. > > Initial load works fine with s:div, I am not sure what am i missing using > sx:div. > Why does it wait for 5 secs (updateFreq value) for the first time load. > > Code with struts 2.0.11.2 > s:url id="d_url" action="DetailAction" /> id="details" href="%{d_url}" theme="ajax" > formId="frm_demo" updateFreq="5000"> > > > modified above code to the below one using struts 2.1.6 > id="details" href="%{d_url}" theme="ajax" > formId="frm_demo" updateFreq="5000" preload="true"> > > > But after upgrading to sx:div the page waits for 5 secs (updateFreq value) > even for the initial (first time load) page load. > I tried adding preload="true" for sx:div tag but still facing the same > issue. I couldn't get information in net on this issue. > > Please help. Thanks in advance. > Mekna > > > -- View this message in context: http://www.nabble.com/Page-waits-to-load-initially-with-Div-Dojo-tag-tp22959309p25392577.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
Re: [OT] Re: [OT] Re: Struts2 is not outputting to the Glassfish server.log
anyway thank you for the answer ;) haha 2009/9/7 > This is really funny...hahaa > I need to find this movie > > -Louis > > > > > From: Dale Newfield > To: Struts Users Mailing List > Sent: Monday, September 7, 2009 6:42:56 AM > Subject: Re: [OT] Re: Struts2 is not outputting to the Glassfish server.log > > Dave Newton wrote: > > the movie "Airplane", with the hysterical woman on the plane > > YouTube to the rescue: http://www.youtube.com/watch?v=Y_GJkKMPHxw > > -Dale > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org >
Re: Interceptor doesn't forward
2009/9/10 Jim Collings : > I think I am getting my syntax wrong for the global result. How do you > specify a global result that is an action? User redirectAction http://struts.apache.org/2.x/docs/redirect-action-result.html 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
Re: Chain a global result to an action?
I'll let someone else answer this... I've not jet used the convention plugin (too bleeding edge for me! :) On Thu, Sep 10, 2009 at 12:11 PM, Jim Collings wrote: > I also forgot to mention that this is a convention-plugin project. > > On Thu, Sep 10, 2009 at 3:10 PM, Jim Collings wrote: > > Will I have to define the action in the struts.xml? I'm currently > > using annotations to handle mapping. > > > > Jim C. > > > >> This works for me: > >> > >> > >> >> > >> > >>DeadEnd > >> > >> > >>... > >> > >>deadEnd.jsp > >> > >> > >>... > >> > >> > >> > >> The entire action class is: > >> > >> @SuppressWarnings("serial") > >> public class DeadEnd extends ActionSupport > >> { > >> > >> } > >> > >> and when any action returns "error" the deadEnd.jsp page is displayed. > >> > >> - Bill > >> > >> On Thu, Sep 10, 2009 at 11:49 AM, Jim Collings > wrote: > >> > >>> Anybody know what the syntax for this is? I don't seem to be getting > it > >>> right. > >>> > >>> > >>> Jim C. > >>> > >>> - > >>> 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: Chain a global result to an action?
I also forgot to mention that this is a convention-plugin project. On Thu, Sep 10, 2009 at 3:10 PM, Jim Collings wrote: > Will I have to define the action in the struts.xml? I'm currently > using annotations to handle mapping. > > Jim C. > >> This works for me: >> >> >> > >> >> DeadEnd >> >> >> ... >> >> deadEnd.jsp >> >> >> ... >> >> >> >> The entire action class is: >> >> @SuppressWarnings("serial") >> public class DeadEnd extends ActionSupport >> { >> >> } >> >> and when any action returns "error" the deadEnd.jsp page is displayed. >> >> - Bill >> >> On Thu, Sep 10, 2009 at 11:49 AM, Jim Collings wrote: >> >>> Anybody know what the syntax for this is? I don't seem to be getting it >>> right. >>> >>> >>> Jim C. >>> >>> - >>> 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: Chain a global result to an action?
Will I have to define the action in the struts.xml? I'm currently using annotations to handle mapping. Jim C. > This works for me: > > > > > DeadEnd > > > ... > > deadEnd.jsp > > > ... > > > > The entire action class is: > > @SuppressWarnings("serial") > public class DeadEnd extends ActionSupport > { > > } > > and when any action returns "error" the deadEnd.jsp page is displayed. > > - Bill > > On Thu, Sep 10, 2009 at 11:49 AM, Jim Collings wrote: > >> Anybody know what the syntax for this is? I don't seem to be getting it >> right. >> >> >> Jim C. >> >> - >> 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
excpetion chaining to custom exception handler issue
HI, I'm using a global exception handler action class to get the exception details and display it on a custom error page. Following is the struts xml configuration UnhandledExceptionHandler /jsp/systemerror.jsp Once my action class is invoked it will create my exception object using the current exception set by the struts setter as well as I get more details about the system at the time of the exception. In order to get the exception forwarded to my action class from the action where the exception occurs I use chaining in the result mapping " " This works and everything is populated on my error jsp page and the page gets displayed as expected. Now if I refresh this error page, although the actions go through the last exception path as expected, and my error handler class is executed, it will not display the error page again this time but will end up showing the following error= HTTP Status 500 - Infinite recursion detected: [//loginAction!login, //UnhandledExceptionHandler, //UnhandledExceptionHandler, //UnhandledExceptionHandler] - [unknown location] com.opensymphony.xwork2.ActionChainResult.execute(ActionChainResult.java :203) com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultAct ionInvocation.java:361) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo cation.java:265) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java :52) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:4 68) org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher .java:395) After this error if I refresh the above page(HTTP Status 500) , it will once again show my error page and a refresh on that page will bring back the error 500 again!!! This keeps on doing on consecutive refresh. This will go away if I use "redierctAction" in place of "chain" but then I will lost the information about the exception once it reached in my exception handling action class Please tell me is this a problem on my error handling or a sturts issue. Thanks Denny - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Chain a global result to an action?
This works for me: DeadEnd ... deadEnd.jsp ... The entire action class is: @SuppressWarnings("serial") public class DeadEnd extends ActionSupport { } and when any action returns "error" the deadEnd.jsp page is displayed. - Bill On Thu, Sep 10, 2009 at 11:49 AM, Jim Collings wrote: > Anybody know what the syntax for this is? I don't seem to be getting it > right. > > > Jim C. > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
Chain a global result to an action?
Anybody know what the syntax for this is? I don't seem to be getting it right. Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Interceptor doesn't forward
I think I am getting my syntax wrong for the global result. How do you specify a global result that is an action? Jim C. On Thu, Sep 10, 2009 at 2:27 PM, Mitch Claborn wrote: > It sounds like either the original page or the one being redirected to > is being controlled by container managed security, configured in web.xml. > > Mitch > > > > Jim Collings wrote: >> I want to send a user to the welcome page if they don't have something >> set in their session. >> >> I have an interceptor that works fine otherwise. It returns either >> invocation.invoke() OR it returns Action.LOGIN. Problem is that I >> can't get the LOGIN result to map properly. How is this done? I've >> tried specifying a global-result in the struts.xml in the package but >> no dice. It still doesn't send the user to the welcome page, instead >> it prompts for userid/password which is not at all what I had in mind. >> >> Anybody got a clue regarding this? A friend says it is related to >> global forwards. >> >> >> Jim C. >> >> - >> 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 doesn't forward
It sounds like either the original page or the one being redirected to is being controlled by container managed security, configured in web.xml. Mitch Jim Collings wrote: > I want to send a user to the welcome page if they don't have something > set in their session. > > I have an interceptor that works fine otherwise. It returns either > invocation.invoke() OR it returns Action.LOGIN. Problem is that I > can't get the LOGIN result to map properly. How is this done? I've > tried specifying a global-result in the struts.xml in the package but > no dice. It still doesn't send the user to the welcome page, instead > it prompts for userid/password which is not at all what I had in mind. > > Anybody got a clue regarding this? A friend says it is related to > global forwards. > > > Jim C. > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > >
Re: Interceptor doesn't forward
Yes. On Thu, Sep 10, 2009 at 12:58 PM, Lukasz Lenart wrote: > 2009/9/10 Jim Collings : >> I have an interceptor that works fine otherwise. It returns either >> invocation.invoke() OR it returns Action.LOGIN. Problem is that I > > Did you create global result named "login"? > > > 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: Interceptor doesn't forward
2009/9/10 Jim Collings : > I have an interceptor that works fine otherwise. It returns either > invocation.invoke() OR it returns Action.LOGIN. Problem is that I Did you create global result named "login"? 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
Interceptor doesn't forward
I want to send a user to the welcome page if they don't have something set in their session. I have an interceptor that works fine otherwise. It returns either invocation.invoke() OR it returns Action.LOGIN. Problem is that I can't get the LOGIN result to map properly. How is this done? I've tried specifying a global-result in the struts.xml in the package but no dice. It still doesn't send the user to the welcome page, instead it prompts for userid/password which is not at all what I had in mind. Anybody got a clue regarding this? A friend says it is related to global forwards. Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Warning message when setting BigDecimal to list of bean
hmm..i remember getting the warning even for doubles..as the error message says, OGNL fails when trying to set a String array (all request parameters are Strings ) into the BigDecimal field since it cannot find an appropriate setter. In connection to this, can anyone let me know how to suppress this message with lo4j.properties (not log4j.xml) configuration. On Thu, Sep 10, 2009 at 11:59 AM, Steven Yang wrote: > Sorry I forgot to mention > I am using Struts 2.1.8 SNAP SHOT with XWork 2.1.6 > samething happens with XWork 2.1.5 > > On Wed, Sep 9, 2009 at 2:03 PM, Steven Yang wrote: > > > Hi > > I have a bean like > > public class Account { > > > > private String type; > > private String name; > > private BigDecimal value1; > > private BigDecimal value2; > > private BigDecimal value3; > > //getter, setters > > } > > > > in my action i have > > > > public class TestAction extends ActionSupport { > > > > private List accounts = new ArrayList(); > > //getter, setters, execute > > } > > > > in my JSP: > > > > > > > > > > > > > > % > > > > > > > > > > > > > > % > > > > > > When i submit the form, i get warning message like the following when the > > BigDecimal value fields are empty : > > > > 2009-09-09 13:52:44,156 [http-80-Processor125] WARN > > com.opensymphony.xwork2.ognl.OgnlValueStack - Error setting expression > > 'accounts[0].value2' with value '[Ljava.lang.String;@165de14' > > ognl.MethodFailedException: Method "setValue2" failed for object > > junit.adm.authority.acco...@7a8ba4 [java.lang.NoSuchMethodException: > > junit.adm.authority.Account.setValue2([Ljava.lang.String;)] > > at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1265) > > at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1454) > > at > > > ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85) > > at > > ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162) > > at > > > com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28) > > at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2225)... > > > > If the fields have value, then there is no message for that particular > > field and value gets set properly. Only occur if the field is empty. > > If i change the property in Account to Double or double, there wont be > any > > warning. > > > > I am not running under devMode = true. > > > > Is this a bug? or something else? > > Thanks > > >
Re: Intermittent Session Problems in Strut2.
Are you using Spring to wire up the Action ? -- just a wild guess that the bean scope may be Singleton (the default value) and that causes the data sharing ? 2009/9/10 Paweł Wielgus > Hi, > i don't know if it will help but You can try same thing i did here [1] > i was trying to force pages not to being cached and it turned out not > to be trivial. > Still i don't know how it will behave with proxy. > > [1] > http://poulwiel.blogspot.com/2009/01/browser-back-button-and-caching-problem.html > > Best greetings, > Paweł Wielgus. > > > 2009/9/10 rohansd : > > > > Even we am facing this problem with my application whe it runs on proxy > > servers. > > Apparently, this problem occurs only with a certain proxy server. There > may > > be rules defined on the proxy server but being an internet application we > > have to live with it and find a solution. > > The information that is shared comes from the database.. > > Interestingly, when the browser is refreshed the data shows up correctly. > > we tried the no-cache as well as no-store stuff in jsps to no avail. > > Any pointers will be greatly appreciated. > > Thanks > > Rohan > > > > > > > > pankaj semwal wrote: > >> > >> Intermittent session problems come when our application runs on proxy > >> servers. > >> Even i put the cache remove tags in jsp. > >> > >> Still same problem i am facing. > >> > >> Thanks > >> > >> > > > > -- > > View this message in context: > http://www.nabble.com/Intermittent-Session-Problems-in-Strut2.-tp25100607p25376314.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: [S2] i18n for lists/maps
Z, I'll clarify with a simple example : The dropdown must be like : EnglishType1EnglishType2 for EN and SpanishType1SpanishType2 So, the values 1 and 2 remain constant, only the text changes. Now, i don't want to maintain 1, 2 separately from its text. My understanding from your suggestion is to have a list of "Option" objects whose responseKey attribute wil hold 1, 2 and responseValue attribute is like "key.value1" , "key.value2" etc. which is defined in properties file as : key.value1=EnglishType1 key.value2=EnglishType2 etc. Let me know if i've understood it correctly. Thanks, Joseph I just want to get a couple things straight: 1. Your state names are in localised properties files 2. The properties files are available to struts2 either via struts.custom.i18n.resources or convention (read don’t ask) If you app satisfies these two points then the method I mentioned will work fine. If it doesn’t, it’s not that much work to satisfy them. -- View this message in context: http://www.nabble.com/-S2--i18n-for-lists-maps-tp25300822p25385065.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
Re: how to read the contents of uploaded file
It's really not related to struts... Struts has done it's job in your case, now it's time for you to use other techniques commonly referred to as "programming" :) Since you are trying to read an excel spreadsheet, I would suggest you look at the POI library and then just expose a bean or array of beans that you can loop through in your view and create your table. Another alternative would be to look at the displaytable taglib to present the data after parsing the file with POI. -Wes On Thu, Sep 10, 2009 at 10:17 AM, KIRTI CHOPRA wrote: > > hi all > can you please help me with how can i start with how i can read the content > of the file uploaded using struts 2.0 and display them in jsp in table > format. > > since i am new to struts i am not able to think of where should i start from > and for saving that uploaded file i should give which path real or absolute > -- > View this message in context: > http://www.nabble.com/how-to-read-the-contents-of-uploaded-file-tp25384149p25384149.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 > > -- 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
how to read the contents of uploaded file
hi all can you please help me with how can i start with how i can read the content of the file uploaded using struts 2.0 and display them in jsp in table format. since i am new to struts i am not able to think of where should i start from and for saving that uploaded file i should give which path real or absolute -- View this message in context: http://www.nabble.com/how-to-read-the-contents-of-uploaded-file-tp25384149p25384149.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
Re: uploading a .xls file
Thank you so much for the help!!! -- View this message in context: http://www.nabble.com/uploading-a-.xls-file-tp25377242p25383919.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
Re: uploading a .xls file
Write code in your action class to copy the temp file. You'll have to respect your application server's containment rules: I simply copy the file to a permanent place in my application context. On Thu, Sep 10, 2009 at 12:59 AM, KIRTI CHOPRA wrote: > > Thank you so much but can you please tell me how can i save the uploaded > file > -- > View this message in context: > http://www.nabble.com/uploading-a-.xls-file-tp25377242p25378975.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 > >
how to save uploaded file
hi i have uploaded file successfully but i am now trying to save the file using following code it is not taking FileUtils and pls suggest if there is any other alternative. import static java.io.File.separator; import java.io.File; import java.lang.Object; import java.text.MessageFormat; import org.apache.commons.io.FileUtils ; import com.sun.deploy.cache.Cache; /** * Created by IntelliJ IDEA. * User: Owner * Date: Sep 9, 2009 * Time: 10:22:18 AM * To change this template use File | Settings | File Templates. */ public class UploadXlsAction extends BaseAction { private File file; private String fileFileName; private String fileContentType; private UploadXlsAction upload; public File getFile() { return file; } public void setFile(File file) { this.file = file; } public String getFileFileName() { return fileFileName; } public void setFileFileName(String fileFileName) { this.fileFileName = fileFileName; } public String getFileContentType() { return fileContentType; } public void setFileContentType(String fileContentType) { this.fileContentType = fileContentType; } public String execute() throws Exception{ this.file=getFile(); this.fileFileName=getFileFileName(); String filepath=file.getAbsolutePath(); System.out.println(file+fileFileName); return "success"; } public void uploaded(File file, String fileName){ /* File dir = new File(directoryName); if (!dir.exists()) { dir.mkdir(); }*/ String targetPath = MessageFormat.format("C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/jnewsletter/WEB-INF/classes/com/neevtech/newsletter/resources{0}{1}", File.separator, fileName); File fileDestination = new File(targetPath); try{ FileUtils fl=new FileUtils(); fl.copyFile(file, fileDestination); }catch(Exception e) { System.out.println(e); } } } -- View this message in context: http://www.nabble.com/how-to-save-uploaded-file-tp25381036p25381036.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
2.1.6 with Convention + Spring plugins
Hi All, I have set up my first Struts2 project. I have added the convention library and the spring library to the project. Now when I deploy (Glassfish 2 ur2) I receive various exception messages, all in the vein of java.lang.Exception: Could not load MultiColumnPrinter.class From Googling this error I can tell it is an issue with the version of Glassfish I am using. However looking deeper into the trace I can see it is also trying load java.lang.Exception: Could not load org/apache/struts/actions/DispatchAction.class at com.opensymphony.xwork2.util.finder.ClassFinder.readClassDef(ClassFinder .java:745) at com.opensymphony.xwork2.util.finder.ClassFinder.access$400(ClassFinder.j ava:57) Now, I recognise this as a Struts 1 class which another project I have deployed on the same domain of the same glassfish instance. For every class in this Struts 1 project which extends DispatchAction I have an error for. However this *only* happens if I have the spring plugin added to my Struts2 project. Also note this doesn't stop the application from working, but I am concerned that it appears to be searching the entire domain for actions, and spewing out these messages. Can anyone provide any suggestions on what I have done wrong here? Struts 2 Libs I have in my project: Commons-fileupload-1.2.1 Commons-io-1.3.2 Commons-logging-1.0.4 Freemarker-2.3.1.3 Ognl-2.6.11 Struts2-config-browser-plugin-2.1.6 Struts2-convention-plugin-2.1.6 Struts2-core-2.1.6 Xwork-2.1.2 Web-xml http://java.sun.com/xml/ns/javaee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";> org.springframework.web.context.ContextLoaderListener contextConfigLocation /WEB-INF/SpringConfig.xml struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndEx ecuteFilter struts.devMode true struts.objectFactory.spring.autoWire.alwaysRespect true struts.convention.result.path /WEB-INF/jsp struts2 /* 30 index.jsp Cheers James ___ This email has been scanned by MessageLabs on behalf of weComm Ltd. ___
Re: uploading a .xls file
Thank you so much but can you please tell me how can i save the uploaded file -- View this message in context: http://www.nabble.com/uploading-a-.xls-file-tp25377242p25378975.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
setting sx:submit targets conditionally?
Hey... I am just starting struts. Is it possible set targets attribute of sx:submit conditionally? For example, if my action return "error" go back and show error ( in s:actionerror) inside the parentDiv ( sx:submit targets="parentDiv" ) if "success", I want a new completely page, so no targets. (targets="none" ? ) Is this possible? or maybe a workaround? Why is this necessary? Well, because my form is inside a sx:tabbedpanel tab! (So almost every submit button must have a targets set or I my result page will appear in a new page (without the tabbed pane) ) thanks Ignacio - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org