Re: Struts 2 Testing - odd behaviour
You're right... there is something wrong in the way IE6 handles buttons. Why don't you simply use: s:submit type=submit value=Next/ s:submit type=submit value=Menu method=menu/ 2010/11/29 RogerV roger.var...@googlemail.com: Maurizio Cucchiara wrote: Could you post the generated html? Posted below. Thanks for the typo nudge Dave, I hadn't spotted that because it actually works! The additional data in the html above what I posted in the .jsp file comes from Sitemesh decorators. Regards !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / style type=text/css@import /FlashFileLoader/resources/css/global.css;/style script type=text/javascript src=/FlashFileLoader/resources/js/jquery-1.3.2.min.js/script meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / /head body id= onload= div id=container !-- Wrapper for the entire page -- div id=outer-header !-- Wrapper for header elements -- div id=headerLogo /FlashFileLoader/resources/images/Common-Heading_1.png /div /div !-- End Of Header Wrappers -- div id=right-panel-wrapper div id=navigation-wrapper /div div id=contents-wrapper h2 id=titleSelect Platform/h2 div class=formWrapper form id=select-platform name=select-platform action=/FlashFileLoader/select-platform.action method=post select name=platformId id=select-platform_platformId option value=9Defender 2007 on/option option value=44Defender 2011/option option value=1Discovery 3 / LR3/option option value=2Discovery 4 / LR4/option option value=10Freelander 2/option option value=5Range Rover 2004.5 to 2005/option option value=6Range Rover 2006/option option value=7Range Rover 2007 to 2009/option option value=8Range Rover 2010 on/option option value=3Range Rover Sport 2005 to 2009/option option value=4Range Rover Sport 2010 on/option /select button type=submit id=select-platform_0 value=Submit Next /button button type=submit id=select-platform__menu name=method:menu value=Submit Menu /button /form /div /div /div div id=push/div /div !-- End of container -- div id=footer-wrapper pCopyright copy; 2008-2010 Blackbox Solutions./p /div /body /html -- View this message in context: http://old.nabble.com/Struts-2-Testing---odd-behaviour-tp30308915p30328168.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 -- Maurizio Cucchiara - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2 Testing - odd behaviour
Maurizio Cucchiara wrote: You're right... there is something wrong in the way IE6 handles buttons. Why don't you simply use: s:submit type=submit value=Next/ s:submit type=submit value=Menu method=menu/ Thanks for the confirmation Maurizio, I thought I was going mad. Your suggestion works, my app is now behaving itself on IE6 as well. Since your solution renders as a button anyway in IE6, IE7, IE8, Firefox and Chrome, does anyone know what the point of s:submit type=button is? (It also might be worth a mention in the tag reference as well) Regards -- View this message in context: http://old.nabble.com/Struts-2-Testing---odd-behaviour-tp30308915p30328991.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
binding paramters in struts2 without the form
s:form action=register s:textfield name=personBean.firstName label=First name / s:submit/ /s:form public class Register extends ActionSupport { private static final long serialVersionUID = 1L; private Person personBean; // } Using the s:form tag one can bind the parameter from the client to a java object(the personBean in the Register action). However it seems that the struts tag is required,but my action is not called from the web form,so any way? And I tried this way: public class ParaWrapper(){ private String firstName; public void setFirstName(String ..){ this.firstName=... } //the getter of firstName public } public MyAction extends ActionSupport{ private ParaWrapper wrapper; public void setXXX()... public void getXXX()... public void execute(){ System.out.println(wrapper.getFirstName()); //here I can not get the parameters,it seems that the parameters are not populated to this object. } } It does not work since struts does not know which object should be used to bind the parameter. I wonder there is any way to using this manner?
Re: binding paramters in struts2 without the form
Frankly, even after I watched your question on stackoverflow, I can't figure out what you meant. You don't necessary need struts tag, you can pass parameter via http request, so, for example, if you enter http://your_url:your_port/your_struts.action?personBean.firstName=your_name in the address bar struts will try to inject value inside your bean. Does this answer your question? 2010/11/29 maven apache apachemav...@gmail.com: BTW,this is a cross post at stackoverflowhttp://stackoverflow.com/questions/4300409/binding-paramters-in-struts2-without-the-form . 2010/11/29 maven apache apachemav...@gmail.com s:form action=register s:textfield name=personBean.firstName label=First name / s:submit/ /s:form public class Register extends ActionSupport { private static final long serialVersionUID = 1L; private Person personBean; // } Using the s:form tag one can bind the parameter from the client to a java object(the personBean in the Register action). However it seems that the struts tag is required,but my action is not called from the web form,so any way? And I tried this way: public class ParaWrapper(){ private String firstName; public void setFirstName(String ..){ this.firstName=... } //the getter of firstName public } public MyAction extends ActionSupport{ private ParaWrapper wrapper; public void setXXX()... public void getXXX()... public void execute(){ System.out.println(wrapper.getFirstName()); //here I can not get the parameters,it seems that the parameters are not populated to this object. } } It does not work since struts does not know which object should be used to bind the parameter. I wonder there is any way to using this manner? -- Maurizio Cucchiara - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2 Testing - odd behaviour
Simply, the former renders a input type=submit element, the latter renders a button type=submit. They should be the same thing, according to html 4.01 specification. The point is that ie6 doesn't like button tag. 2010/11/29 RogerV roger.var...@googlemail.com: Maurizio Cucchiara wrote: You're right... there is something wrong in the way IE6 handles buttons. Why don't you simply use: s:submit type=submit value=Next/ s:submit type=submit value=Menu method=menu/ Thanks for the confirmation Maurizio, I thought I was going mad. Your suggestion works, my app is now behaving itself on IE6 as well. Since your solution renders as a button anyway in IE6, IE7, IE8, Firefox and Chrome, does anyone know what the point of s:submit type=button is? (It also might be worth a mention in the tag reference as well) Regards -- View this message in context: http://old.nabble.com/Struts-2-Testing---odd-behaviour-tp30308915p30328991.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 -- Maurizio Cucchiara - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: binding paramters in struts2 without the form
2010/11/29 Maurizio Cucchiara maurizio.cucchi...@gmail.com Frankly, even after I watched your question on stackoverflow, I can't figure out what you meant. :( You don't necessary need struts tag, you can pass parameter via http request, so, for example, if you enter http://your_url:your_port /your_struts.action?personBean.firstName=your_name in the address bar Thanks. I use the http://xxx.action?firstName=name. So it does not work. http://your_url:your_port/your_struts.action?personBean.firstName=your_name I do not know the parameter can be sent this way!!! Thanks. struts will try to inject value inside your bean. Does this answer your question? 2010/11/29 maven apache apachemav...@gmail.com: BTW,this is a cross post at stackoverflow http://stackoverflow.com/questions/4300409/binding-paramters-in-struts2-without-the-form . 2010/11/29 maven apache apachemav...@gmail.com s:form action=register s:textfield name=personBean.firstName label=First name / s:submit/ /s:form public class Register extends ActionSupport { private static final long serialVersionUID = 1L; private Person personBean; // } Using the s:form tag one can bind the parameter from the client to a java object(the personBean in the Register action). However it seems that the struts tag is required,but my action is not called from the web form,so any way? And I tried this way: public class ParaWrapper(){ private String firstName; public void setFirstName(String ..){ this.firstName=... } //the getter of firstName public } public MyAction extends ActionSupport{ private ParaWrapper wrapper; public void setXXX()... public void getXXX()... public void execute(){ System.out.println(wrapper.getFirstName()); //here I can not get the parameters,it seems that the parameters are not populated to this object. } } It does not work since struts does not know which object should be used to bind the parameter. I wonder there is any way to using this manner? -- Maurizio Cucchiara - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
labelizing submit buttons
Hi all, Could somebody help me with the next issue? In a submit button I want to use a customized label (which is extracted from a .properties file). The problem is that I get the next exception: Error setting expression 'btn.search' with value '[Ljava.lang.String;@1ed56e2' *ognl.OgnlException*: target is null for setProperty(null, search, [Ljava.lang.String;@1ed56e2) at ognl.OgnlRuntime.setProperty(*OgnlRuntime.java:1651*) Here is the code involved: …in the .properties: btn.search=Search …in the .jsp: s:submit key=btn.search / Does somebody know how to avoid this exception without implementing a method ‘setSearch()’ in the action? Thanks in advance! --
Re: binding paramters in struts2 without the form
Struts will not automatically populate fields based on parameters passed via the URL. Your action will need to implement the ParameterAware interface, and the setParameters(MapString, String[] parameters) method. Then you can use the map to populate your fields. Jason On Mon, Nov 29, 2010 at 5:25 AM, maven apache apachemav...@gmail.comwrote: 2010/11/29 Maurizio Cucchiara maurizio.cucchi...@gmail.com Frankly, even after I watched your question on stackoverflow, I can't figure out what you meant. :( You don't necessary need struts tag, you can pass parameter via http request, so, for example, if you enter http://your_url:your_port /your_struts.action?personBean.firstName=your_name in the address bar Thanks. I use the http://xxx.action?firstName=name. So it does not work. http://your_url:your_port /your_struts.action?personBean.firstName=your_name I do not know the parameter can be sent this way!!! Thanks. struts will try to inject value inside your bean. Does this answer your question? 2010/11/29 maven apache apachemav...@gmail.com: BTW,this is a cross post at stackoverflow http://stackoverflow.com/questions/4300409/binding-paramters-in-struts2-without-the-form . 2010/11/29 maven apache apachemav...@gmail.com s:form action=register s:textfield name=personBean.firstName label=First name / s:submit/ /s:form public class Register extends ActionSupport { private static final long serialVersionUID = 1L; private Person personBean; // } Using the s:form tag one can bind the parameter from the client to a java object(the personBean in the Register action). However it seems that the struts tag is required,but my action is not called from the web form,so any way? And I tried this way: public class ParaWrapper(){ private String firstName; public void setFirstName(String ..){ this.firstName=... } //the getter of firstName public } public MyAction extends ActionSupport{ private ParaWrapper wrapper; public void setXXX()... public void getXXX()... public void execute(){ System.out.println(wrapper.getFirstName()); //here I can not get the parameters,it seems that the parameters are not populated to this object. } } It does not work since struts does not know which object should be used to bind the parameter. I wonder there is any way to using this manner? -- Maurizio Cucchiara - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: binding paramters in struts2 without the form
2010/11/29 Jason Ferguson fergusonja...@gmail.com Struts will not automatically populate fields based on parameters passed via the URL. Your action will need to implement the ParameterAware interface, and the setParameters(MapString, String[] parameters) method. Then you can use the map to populate your fields. Maurizio Cucchiara's answer seems like a good idea excepting I have add the personbean.name=xxx. (The personBean is required) I do not want to use the ParameterAware,I want to use a object save some default value of some parameters rather than the map. Also,if using the parameterAware,why not using the ActionContext.getcontext().getParameters() instead? Jason On Mon, Nov 29, 2010 at 5:25 AM, maven apache apachemav...@gmail.com wrote: 2010/11/29 Maurizio Cucchiara maurizio.cucchi...@gmail.com Frankly, even after I watched your question on stackoverflow, I can't figure out what you meant. :( You don't necessary need struts tag, you can pass parameter via http request, so, for example, if you enter http://your_url:your_port /your_struts.action?personBean.firstName=your_name in the address bar Thanks. I use the http://xxx.action?firstName=name. So it does not work. http://your_url:your_port /your_struts.action?personBean.firstName=your_name I do not know the parameter can be sent this way!!! Thanks. struts will try to inject value inside your bean. Does this answer your question? 2010/11/29 maven apache apachemav...@gmail.com: BTW,this is a cross post at stackoverflow http://stackoverflow.com/questions/4300409/binding-paramters-in-struts2-without-the-form . 2010/11/29 maven apache apachemav...@gmail.com s:form action=register s:textfield name=personBean.firstName label=First name / s:submit/ /s:form public class Register extends ActionSupport { private static final long serialVersionUID = 1L; private Person personBean; // } Using the s:form tag one can bind the parameter from the client to a java object(the personBean in the Register action). However it seems that the struts tag is required,but my action is not called from the web form,so any way? And I tried this way: public class ParaWrapper(){ private String firstName; public void setFirstName(String ..){ this.firstName=... } //the getter of firstName public } public MyAction extends ActionSupport{ private ParaWrapper wrapper; public void setXXX()... public void getXXX()... public void execute(){ System.out.println(wrapper.getFirstName()); //here I can not get the parameters,it seems that the parameters are not populated to this object. } } It does not work since struts does not know which object should be used to bind the parameter. I wonder there is any way to using this manner? -- Maurizio Cucchiara - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: binding paramters in struts2 without the form
On Mon, Nov 29, 2010 at 6:55 AM, Jason Ferguson wrote: Struts will not automatically populate fields based on parameters passed via the URL. Your action will need to implement the ParameterAware interface, and the setParameters(MapString, String[] parameters) method. Then you can use the map to populate your fields. It won't? Is this new behavior? It's always worked for me just fine. Dave
Re: binding paramters in struts2 without the form
If you don't want dot notation, I should consider using ModelDriven interface. Take a look at http://struts.apache.org/2.2.1/struts2-core/apidocs/com/opensymphony/xwork2/ModelDriven.html 2010/11/29 maven apache apachemav...@gmail.com: Maurizio Cucchiara's answer seems like a good idea excepting I have add the personbean.name=xxx. (The personBean is required) I do not want to use the ParameterAware,I want to use a object save some default value of some parameters rather than the map. Also,if using the parameterAware,why not using the ActionContext.getcontext().getParameters() instead? Jason On Mon, Nov 29, 2010 at 5:25 AM, maven apache apachemav...@gmail.com wrote: 2010/11/29 Maurizio Cucchiara maurizio.cucchi...@gmail.com Frankly, even after I watched your question on stackoverflow, I can't figure out what you meant. :( You don't necessary need struts tag, you can pass parameter via http request, so, for example, if you enter http://your_url:your_port /your_struts.action?personBean.firstName=your_name in the address bar Thanks. I use the http://xxx.action?firstName=name. So it does not work. http://your_url:your_port /your_struts.action?personBean.firstName=your_name I do not know the parameter can be sent this way!!! Thanks. struts will try to inject value inside your bean. Does this answer your question? 2010/11/29 maven apache apachemav...@gmail.com: BTW,this is a cross post at stackoverflow http://stackoverflow.com/questions/4300409/binding-paramters-in-struts2-without-the-form . 2010/11/29 maven apache apachemav...@gmail.com s:form action=register s:textfield name=personBean.firstName label=First name / s:submit/ /s:form public class Register extends ActionSupport { private static final long serialVersionUID = 1L; private Person personBean; // } Using the s:form tag one can bind the parameter from the client to a java object(the personBean in the Register action). However it seems that the struts tag is required,but my action is not called from the web form,so any way? And I tried this way: public class ParaWrapper(){ private String firstName; public void setFirstName(String ..){ this.firstName=... } //the getter of firstName public } public MyAction extends ActionSupport{ private ParaWrapper wrapper; public void setXXX()... public void getXXX()... public void execute(){ System.out.println(wrapper.getFirstName()); //here I can not get the parameters,it seems that the parameters are not populated to this object. } } It does not work since struts does not know which object should be used to bind the parameter. I wonder there is any way to using this manner? -- Maurizio Cucchiara - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Maurizio Cucchiara - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: labelizing submit buttons
You shouldn't need a setSearch method inside your action: the bEst way to make it work is to verify that your ActionClassName.properties contains a btn.search entry. 2010/11/29 webmeiker i...@webmeiker.com: Hi all, Could somebody help me with the next issue? In a submit button I want to use a customized label (which is extracted from a .properties file). The problem is that I get the next exception: Error setting expression 'btn.search' with value '[Ljava.lang.String;@1ed56e2' *ognl.OgnlException*: target is null for setProperty(null, search, [Ljava.lang.String;@1ed56e2) at ognl.OgnlRuntime.setProperty(*OgnlRuntime.java:1651*) Here is the code involved: …in the .properties: btn.search=Search …in the .jsp: s:submit key=btn.search / Does somebody know how to avoid this exception without implementing a method ‘setSearch()’ in the action? Thanks in advance! -- -- Maurizio Cucchiara - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: labelizing submit buttons
i have exactly the same problem: s:text name=event.name/ with event.name set in the package.properties file: works ok. s:submit key=button.create with button.create set in the same .properties-file causes exception. Suggestion: It works only if you use ActionClassName.properties file instead of package.properties? - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Upload file content to text box using struts 1.3.8
Can anyone help me on getting file content (txt/CSV file) to be load in text area of web page? I have textarea in webpage and want to load the content of the file to that textarea. I am using struts 1.3.8. I couldn't fig out how can mimic file input button. Any hint will be appreciated. Thanks Anjib - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Configuration for struts.convention.action.suffix
Hello, I need have a web application that expose part of its functionality as RESTfull web services. For this I plan to use the REST Plugin but this implies set in struts.xml the next: constant name=struts.convention.action.suffix value=Controller/ In this context i have a doubt: Is possible that 'struts.convention.action.suffix' supports several values (for example Action and Controller)? or is possible do have the web application and the RESTfull services in the same WAR? Regards,
Re: Configuration for struts.convention.action.suffix
According to rest plugin docs (http://struts.apache.org/2.2.1/docs/rest-plugin.html) struts.convention.action.suffix should be a String, so I guess that it doesn't accept multiple value. I'm not sure it works, but why don't you try to use struts.convention.package.locators instead of action.suffix constant? 2010/11/29 developer researcher java.developer.researc...@gmail.com: Hello, I need have a web application that expose part of its functionality as RESTfull web services. For this I plan to use the REST Plugin but this implies set in struts.xml the next: constant name=struts.convention.action.suffix value=Controller/ In this context i have a doubt: Is possible that 'struts.convention.action.suffix' supports several values (for example Action and Controller)? or is possible do have the web application and the RESTfull services in the same WAR? Regards, -- Maurizio Cucchiara - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Link Display Logic
Hello users. I'm Kevin, first time caller, long time listener (Mr. Obvious reference). I have two reports and need to display a link for each if the following conditions are met: 1. The user is authorized to view the reports (they are secured), and 2. The specific report currently exists Both of these conditions are determined via predefined methods (they are black boxes to me). Following the MVC pattern, what is the best way to split up the display logic of this such that my links are displaying to the appropriate users when they exist? The links will display on the home page. So I thought about determining these factors in the home action and wrapping s:if tags around links to the reports. It seems simple enough, I was just curious if there was a different and/or better approach. Thank you for your time, Kevin - Beez
Re: Link Display Logic
I'll generally expose permission info through an action (or whatever model makes it to the page) and use a custom tag to really clarify and narrow the purpose of that particular JSP/etc. logic. Other than that, though, not sure what else I'd really do, if I'm trying to stay within the S2 framework. Spring Security is another option. Dave On Mon, Nov 29, 2010 at 1:41 PM, Biesbrock, Kevin biesbrock.ke...@aoins.com wrote: Hello users. I'm Kevin, first time caller, long time listener (Mr. Obvious reference). I have two reports and need to display a link for each if the following conditions are met: 1. The user is authorized to view the reports (they are secured), and 2. The specific report currently exists Both of these conditions are determined via predefined methods (they are black boxes to me). Following the MVC pattern, what is the best way to split up the display logic of this such that my links are displaying to the appropriate users when they exist? The links will display on the home page. So I thought about determining these factors in the home action and wrapping s:if tags around links to the reports. It seems simple enough, I was just curious if there was a different and/or better approach. Thank you for your time, Kevin - Beez
RE: Link Display Logic
Dave, Utilizing your suggestion, it sounds like it would be possible to utilize the s:action tag? I guess, what would your custom tag do? It sounds like, either way, you'd need to call the action from your jsp/view to return a jsp fragment with either the authorized links or nothing. Am I understanding that correctly? Beez -Original Message- From: Dave Newton [mailto:davelnew...@gmail.com] Sent: Monday, November 29, 2010 2:06 PM To: Struts Users Mailing List Subject: Re: Link Display Logic I'll generally expose permission info through an action (or whatever model makes it to the page) and use a custom tag to really clarify and narrow the purpose of that particular JSP/etc. logic. Other than that, though, not sure what else I'd really do, if I'm trying to stay within the S2 framework. Spring Security is another option. Dave On Mon, Nov 29, 2010 at 1:41 PM, Biesbrock, Kevin biesbrock.ke...@aoins.com wrote: Hello users. I'm Kevin, first time caller, long time listener (Mr. Obvious reference). I have two reports and need to display a link for each if the following conditions are met: 1. The user is authorized to view the reports (they are secured), and 2. The specific report currently exists Both of these conditions are determined via predefined methods (they are black boxes to me). Following the MVC pattern, what is the best way to split up the display logic of this such that my links are displaying to the appropriate users when they exist? The links will display on the home page. So I thought about determining these factors in the home action and wrapping s:if tags around links to the reports. It seems simple enough, I was just curious if there was a different and/or better approach. Thank you for your time, Kevin - Beez - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Link Display Logic
What we have implemented is a set of public authorisation methods in our base action which we call via ognl passing the actionId as the parameter. For example to test if a user should be shown the print report we have a isUserAuthorised(Integer actionId) method which we use as follows: s:if test=%{isUserAuthorised(123)}Your stuff in here/s:if I have to say that I think this is one of the best aspects of OGNL as we're easily able to easily use server side authorisation with simple ajax calls. Z. On 30/11/10 5:41 AM, Biesbrock, Kevin biesbrock.ke...@aoins.com wrote: Hello users. I'm Kevin, first time caller, long time listener (Mr. Obvious reference). I have two reports and need to display a link for each if the following conditions are met: 1. The user is authorized to view the reports (they are secured), and 2. The specific report currently exists Both of these conditions are determined via predefined methods (they are black boxes to me). Following the MVC pattern, what is the best way to split up the display logic of this such that my links are displaying to the appropriate users when they exist? The links will display on the home page. So I thought about determining these factors in the home action and wrapping s:if tags around links to the reports. It seems simple enough, I was just curious if there was a different and/or better approach. Thank you for your time, Kevin - Beez - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Upload file content to text box using struts 1.3.8
(1)Select file from a [file input] (2)Upload it to your Action (by a post) (3)In your action, read in the CSV data, and store into some property(let's say CSVDataProperty) (4)Show your page again, and set the default value of the textarea by CSVDataProperty 2010/11/30 Anjib Mulepati anji...@hotmail.com: Can anyone help me on getting file content (txt/CSV file) to be load in text area of web page? I have textarea in webpage and want to load the content of the file to that textarea. I am using struts 1.3.8. I couldn't fig out how can mimic file input button. Any hint will be appreciated. Thanks Anjib - 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: Upload file content to text box using struts 1.3.8
This textarea itself is one of the component of the form. So how to put two forms in a single page? On 11/29/2010 9:30 PM, Li Ying wrote: (1)Select file from a [file input] (2)Upload it to your Action (by a post) (3)In your action, read in the CSV data, and store into some property(let's say CSVDataProperty) (4)Show your page again, and set the default value of the textarea by CSVDataProperty 2010/11/30 Anjib Mulepatianji...@hotmail.com: Can anyone help me on getting file content (txt/CSV file) to be load in text area of web page? I have textarea in webpage and want to load the content of the file to that textarea. I am using struts 1.3.8. I couldn't fig out how can mimic file input button. Any hint will be appreciated. Thanks Anjib - 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: Upload file content to text box using struts 1.3.8
Why do you need two forms? Can't you put the FileUpload and the textarea in one form? And in your Action, you can create 2 method, one handle the file upload, and the other one handle the other request - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Upload file content to text box using struts 1.3.8
Another way is, using AJAX: (1)Send a file upload post, (using AJAX), to your FileUploadAction (2)FileUploadAction just read in the CSV file content, and return it as HTTP Response (3)On client side, AJAX can receive the Server response, then you can put it to the textarea (using JQuery) See: http://stackoverflow.com/questions/166221/how-can-i-upload-files-asynchronously-with-jquery - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org