Re: Mapping a jsp to an action
Hi Zarar, Being crazy takes its toll; please have exact change. ;) If you re-read my response you will see that I recognise that Jennie is using Struts 1.x. I suppose I mentioned Struts 2 because you can *almost* do the URL mapping that she requires with it. I say almost because the solution below redirects recipes/4735/steak-with-barbecue-sauce.jsp to recipes/resultDetails.action?number=4735name=steak-with-barbecue-sauce. It would possibly be nicer if we could use the chain result type but I think you could run into parameter difficulties. E.g. struts constant name=struts.enable.SlashesInActionNames value=true / constant name=struts.action.extension value=action,jsp / package name=recipes namespace=/recipes extends=struts-default action name=*/* result type=redirect-action param name=actionNameresultDetails/param param name=number{1}/param param name=name{2}/param /result /action action name=resultDetails class=com.pub.actions.RecipeDetailsAction result/recipeDetailsSuccess.jsp/result /action /package /struts I appreciate that Struts 1.2+ allow wildcards in action mappings, i.e.: http://struts.apache.org/1.3.8/userGuide/building_controller.html#action_mapping_wildcards http://www.lunatech-research.com/archives/2006/01/23/struts-action-mappings but the problem here is how to pass the multiple parameters that we require. Hence my suggestion that it would be easier to use URL mapping (e.g. mod_rewrite or similar). I hope this clears things up for you. Mark Zarar Siddiqi wrote: Am I crazy or is Jennie using Struts 1.x and Mark just proposed a solution for 2.x? Jennie, your web.xml servler-mapping is overriding each other, you're first saying you want /*/*.jsp sent to action but then you're saying you want *.do's sent to action? I'm not too sure if that's valid. Have you tried just using *.jsp like the following and see how far you get? servlet-mapping servlet-nameaction/servlet-name url-pattern*.jsp/url-pattern /servlet-mapping Zarar On 9/28/07, Jennie Moeller [EMAIL PROTECTED] wrote: Thank much Mark, I talked with a colleague and we're going to give the urlrewrite a try. Thanks! -Original Message- From: Mark McLaren [mailto:[EMAIL PROTECTED] Sent: 28 September 2007 12:02 To: Struts Users Mailing List Subject: Re: Mapping a jsp to an action Hi Jennie, I am fairly new to Struts 2 but you can certainly do action wildcard mappings with it, such as: action name=* result/{1}.jsp/result /action where foo.action would map to foo.jsp. However, my guess is that what you are asking for is a little bit more advanced (and judging by the *.do you are not using Struts 2). You might be better to look at using mod_rewrite on apache if you can. Alternatively you could create or use something like the URL rewriting servlet filter below. http://tuckey.org/urlrewrite/ A very simple URL mapping servlet would do the trick and look something like the servlet below. I'm sure that other other here would be able to improve on this with some clever one line regular expression but at least it gives you an idea of how to do it: public class UrlMappingServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String path=req.getServletPath(); String queryString = req.getQueryString(); // cut off the extension and leading slash int end = path.lastIndexOf(.jsp); path = path.substring(1, end); // split the path into components String[] pathcomponents = path.split(/); // 0 -recipes // 1 - number String number = pathcomponents[1]; // 2 - recipe name String name = pathcomponents[2]; String destination = /recipeDetails.jsp?number= + number + name= + name + + queryString; RequestDispatcher rd; rd = req.getRequestDispatcher(destination); rd.forward(req, resp); } } Of course, best practice states you should never go directly to a JSP url in a Struts app. You should always go via an action. HTH Mark On 9/28/07, Jennie Moeller [EMAIL PROTECTED] wrote: Hi, I'm trying to map a jsp page to an action. When any jsp gets loaded with the recipe path on it I want it to go to an action. for example: This uri: recipes/4735/steak-with-barbecue-sauce.jsp I want it to hit my recipeDetails action My struts action looks like this: action path=/recipes/** type=com.pub.actions.RecipeDetailsAction name=recipeDetailsForm scope=request validate=false forward redirect=false name=success path=/WEB-INF/jsp/recipeDetails.jsp / /action My web.xml looks like this: servlet-mapping servlet-nameaction/servlet-name
Where to find detailed changes over Struts versions?
Hi, I am searching a table comparison like this for all features and enhancements from 1.x to 2.x: http://struts.apache.org/1.2.7/userGuide/release-notes.html#Detail but I am not able to find one which covers also 1.3.x/2.0 features and enhancements. Thanks in advance, Best regards. -- View this message in context: http://www.nabble.com/Where-to-find-detailed-changes-over-Struts-versions--tf4538514.html#a12953379 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Help on expression language
Hi, time ago I bookmarked a detailed table reference about EL, but now I lost this bookmark :super: . So, where to find detailed table reference, source code samples or source code implementations about the expression language? Thanks in advance, best regards. -- View this message in context: http://www.nabble.com/Help-on-expression-language-tf4538542.html#a12953443 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Indexed and Nested properties
Hi, i am working on indexed,nested properties. i have following entries in my ActionForm private ArrayList countryNames = new ArrayList(); public void setCountryNames(int index,LabelValueBean val) { this.countryNames.add(index,val); } public LabelValueBean getCountryNames(int index){ while(index=this.countryNames.size()) this.countryNames.add(new LabelValueBean(label,value)); return (LabelValueBean) this.countryNames.get(index); } i am writing code in JSP like this, logic:iterate id=countryNames name=myBean indexId=i html:text name=countryNames property=label indexed=true/ html:text name=countryNames property=value indexed=true/ /logic:iterate after execution i am getting the source like input type=text name=countryNames[0].label / input type=text name=countryNames[0].value / input type=text name=countryNames[1].label / input type=text name=countryNames[1].value / .. but when i click on my submit button, setter method never get called, it calls getter method properly for all text boxes Can anyone please tell me what could be the problem and how solve this. Thanks. - Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
Re: Where to find detailed changes over Struts versions?
I am searching a table comparison like this for all features and enhancements from 1.x to 2.x: There is nothing like that because Struts 2 is not based on Struts 1 but on WebWork - it has a complete different code base. Maybe this comparison does help: http://www.roseindia.net/struts/struts2/Struts2vsStruts1.shtml Piero - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Indexed and Nested properties
On 9/29/07, Radha Krishna [EMAIL PROTECTED] wrote: Hi, i am working on indexed,nested properties. i have following entries in my ActionForm Radha, I think you are making this too complicated trying to use an index in your setter (I think if I recall correctly you only needed that kind of thing in Java1.3 with the way BeanUtils worked?). I'm assuming you want to submit the form and have all the selections from your List on the form captured? If so, follow this example: http://www.learntechnology.net/content/struts/struts_nested.jsp That example shows using the nested tag to do what you want or straight JSTL. (The only slight 'gotcha' is look at the reset method.. but it's still really simple.) -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT, ajax form submission
Zarar Siddiqi wrote: I really recommend using something like Prototype to do your Ajax stuff. There's no need to reinvent the wheel and introduce countless Struts2 incorporates DoJo, so there's not much sense adding another Ajax framework - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] ScopedModelDriven issues [newbie]
Wouldn't you also have to include the SessionAware interceptor in your myForm stack as well as implement the SessionAware Interface or is that over kill for scopedModelDriven? On 9/28/07, ghodgins [EMAIL PROTECTED] wrote: Does anyone have a working example using the scopedModelDriven interceptor to work for a session bean? I've tried with the following: 1. define interceptor in struts.xml ... interceptors interceptor name=myForm class=com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor lt;param name=scopesessionlt;/param lt;param name=namemyFormlt;/param lt;param name=classNamemodel.MyFormBeanlt;/param /interceptor /interceptors ... 2. define interceptor-ref for action(s) in struts.xml action ... interceptor-ref name=myForm / ... /action 3. Action class extends ScopedModelDrivenMyFormBean public class MyAction extends ActionSupport implements ScopedModelDrivenMyFormBean { ... private String scopeKey; private MyFormBean model; ... public String getScopeKey() { return scopeKey; } public void setScopeKey(String key) { scopeKey = key; } public void setModel(MyFormBean model) { this.model = model; } public MyFormBean getModel() { return model; } } 4. attempt to populate a property of MyFormBean via JSP form: s:form ... s:textfield name=model.property/ s:submit / /s:form With this setup, the model is persisted in the session, however, none of my properties are populated or preserved in subsequent actions/screens. I'm sure I'm missing something trivial or completely misunderstanding something but any help is appreciated. Thanks, Grant Tracy12 wrote: Hi, Has any one successfull getting ScopedModelDriven with session scoped form beans, I tried several times and it failed, the values only remains for request scope, it get reset each time. Is this a bug. Plese let us know how to proceed. Thanks Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/ScopedModelDriven-issues-tf3776022.html#a12950248 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where to find detailed changes over Struts versions?
Piero Sartini-3 wrote: I am searching a table comparison like this for all features and enhancements from 1.x to 2.x: There is nothing like that because Struts 2 is not based on Struts 1 but on WebWork - it has a complete different code base. Maybe this comparison does help: http://www.roseindia.net/struts/struts2/Struts2vsStruts1.shtml Piero - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Thank you very much Piero (grazie mille) -- View this message in context: http://www.nabble.com/Where-to-find-detailed-changes-over-Struts-versions--tf4538514.html#a12958148 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Help on expression language
Have a look at this friend. http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html On 9/29/07, rigel [EMAIL PROTECTED] wrote: Hi, time ago I bookmarked a detailed table reference about EL, but now I lost this bookmark :super: . So, where to find detailed table reference, source code samples or source code implementations about the expression language? Thanks in advance, best regards. -- View this message in context: http://www.nabble.com/Help-on-expression-language-tf4538542.html#a12953443 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Scott [EMAIL PROTECTED]
Karma upgrade?
Hi everyone, I'd like to help editing the Struts2 documentation. I've already sent the fax with my info and signature 2 weeks ago, but I don't know what a Karma upgrade means. And it seems I need one of 'those' to contribute. (I'm following the directions in: http://struts.apache.org/2.x/docs/editing-the-documentation.html) Thanx in advance. Good day to you all :-) -- - Marcos H. You must be the change you wish to see in the world ~ Gandhi
Re: Karma upgrade?
On 9/29/07, Marcos Hernandez [EMAIL PROTECTED] wrote: Hi everyone, I'd like to help editing the Struts2 documentation. I've already sent the fax with my info and signature 2 weeks ago, but I don't know what a Karma upgrade means. And it seems I need one of 'those' to contribute. (I'm following the directions in: http://struts.apache.org/2.x/docs/editing-the-documentation.html) Actually, the instructions say to ask on the dev list. :) (I just checked, and your iCLA hasn't been recorded yet.) -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Karma upgrade?
The people who manage CLAs are volunteers, so it does take a bit of time. I never received any email when mine was registered... This part still has dependencies on wetware. Give it a bit of time, then check back with the dev@ list. The karma upgrade is simply a matter of contributing to discussions and gaining the trust of the people involved. If the documentation you are planning on contributing to is the wiki, simply add comments to the pages you think need changes. If you would like, just send those of us with access an email when you do, and someone will make the change. This would likely be a good way to get the karma you are looking for. -Wes On 9/29/07, Marcos Hernandez [EMAIL PROTECTED] wrote: Thanx for that link, now I can see the list. Another question: does the system automatically emails you when you are added? :-? On 9/29/07, Wendy Smoak [EMAIL PROTECTED] wrote: On 9/29/07, Marcos Hernandez [EMAIL PROTECTED] wrote: Hi Wendy, thanx for replying. Just one question: how long do you think it could be before my iCLA is recorded? a month, two, three? because until then I can't be sure that they actually received it by fax :-/ I think it should have been done in two weeks' time. Please go ahead and fax it again, and ping the dev list in a week or so. (I also added a link to the wiki page so you can watch for it yourself.) Thanks for your patience. :) -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- - Marcos H. You must be the change you wish to see in the world ~ Gandhi -- Wesley Wannemacher President, Head Engineer/Consultant WanTii, Inc. http://www.wantii.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT, ajax form submission
Well, just because it incorporates Dojo doesn't mean you have to use it and are forbidden from trying something better. By default dojo.js isn't dumped into your JSP/Freemarker pages so it's not like it's ever-present for him to use and could get in the way. In all my Struts apps I use Prototype/Scriptaculous for the Ajaxy features, I don't see anything wrong with that. Besides, Prototype is lightweight, easy-to-use, tested and has excellent documentation, hence the suggestion. Zarar On 9/29/07, Oleg Mikheev [EMAIL PROTECTED] wrote: Zarar Siddiqi wrote: I really recommend using something like Prototype to do your Ajax stuff. There's no need to reinvent the wheel and introduce countless Struts2 incorporates DoJo, so there's not much sense adding another Ajax framework - 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: Karma upgrade?
Hi Wendy, thanx for replying. Just one question: how long do you think it could be before my iCLA is recorded? a month, two, three? because until then I can't be sure that they actually received it by fax :-/ Thanx On 9/29/07, Wendy Smoak [EMAIL PROTECTED] wrote: On 9/29/07, Marcos Hernandez [EMAIL PROTECTED] wrote: Hi everyone, I'd like to help editing the Struts2 documentation. I've already sent the fax with my info and signature 2 weeks ago, but I don't know what a Karma upgrade means. And it seems I need one of 'those' to contribute. (I'm following the directions in: http://struts.apache.org/2.x/docs/editing-the-documentation.html) Actually, the instructions say to ask on the dev list. :) (I just checked, and your iCLA hasn't been recorded yet.) -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- - Marcos H. You must be the change you wish to see in the world ~ Gandhi
Plug in for Eclipse 3.2 to run struts applications
Hi Do any one have link where I can download plug in for eclipse 3.2 for running struts applications. I tried Easy Struts and it works only with eclipse 2.x and not with eclipse 3.2. I am running a application in my PC and need this plug in. If any one have link to download the plug in, that would be great. Thanks _ Explore the seven wonders of the world http://search.msn.com/results.aspx?q=7+wonders+worldmkt=en-USform=QBRE
Re: Karma upgrade?
Thanx for that link, now I can see the list. Another question: does the system automatically emails you when you are added? :-? On 9/29/07, Wendy Smoak [EMAIL PROTECTED] wrote: On 9/29/07, Marcos Hernandez [EMAIL PROTECTED] wrote: Hi Wendy, thanx for replying. Just one question: how long do you think it could be before my iCLA is recorded? a month, two, three? because until then I can't be sure that they actually received it by fax :-/ I think it should have been done in two weeks' time. Please go ahead and fax it again, and ping the dev list in a week or so. (I also added a link to the wiki page so you can watch for it yourself.) Thanks for your patience. :) -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- - Marcos H. You must be the change you wish to see in the world ~ Gandhi
Re: how to avoid creating new Action class instance for every request in STRUTS2
If you're using Spring you could define your action bean as a singleton and that would do the trick since the same instance would always be reused. Note that this is pretty crazy in most cases, you're probably better off storing our objects in session scope like Chris suggested. Zarar On 9/29/07, Jose4u [EMAIL PROTECTED] wrote: implementation: I have .jsp in which i have two text box and a Add button. whenever i enter something in the two text box and click on Add button the values needs to be added to the html table which is right down the entry area with two text boxes. Whenver i Click on add i am calling a Action class where i have a colection object in which i add the two text box values to the collection object and on SUCCESS comming to .jsp i iterate the collection object and display it in the .jsp. Problem facing: Whenever i call the action class and i am adding, its adding and displaying in the html table but the next time i add the previous values in the collection gets removed At a time only one object is there in the collection. The same implementation i did it in Struts 1 it was working fine, but in struts 2 its not retaining the values in the collection.Is it because for every call a new Action instance is created in Struts2? Is there any intercepto i need to use? Please provide me a solution to implement this functionality in struts 2 Thanks in advance Jose -- View this message in context: http://www.nabble.com/how-to-avoid-creating-new-Action-class-instance-for-every-request-in-STRUTS2-tf4538022.html#a12952131 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: Karma upgrade?
On 9/29/07, Marcos Hernandez [EMAIL PROTECTED] wrote: Hi Wendy, thanx for replying. Just one question: how long do you think it could be before my iCLA is recorded? a month, two, three? because until then I can't be sure that they actually received it by fax :-/ I think it should have been done in two weeks' time. Please go ahead and fax it again, and ping the dev list in a week or so. (I also added a link to the wiki page so you can watch for it yourself.) Thanks for your patience. :) -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]