Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Hello. Im new into struts2, and i would like to know how I can declare a Bean.
I need this because i wont save my data/object (like the Bean) into a Map/Session object. It's annoying, and working with Struts (which is MVC) i prefeer manage Beans.
So, after, i think access to the attribute by using (for example) <s:property value="bean.attributeName" />
Define your bean as an attribute with getter/setter methods in the action going to the page for property tags. If it is for a form element you will want to define the attribute in the action going to the page and the action processing the submission of the page. When OGNL sees the property referencing fooBean it will look for a reference to it and find it in the action with the getFooBean() method.
In our case we decided not to use ModelDriven because we have situations where an action has the ability to transfer control to more than one jsp. In that case 'getModel()' wouldn't work very well if you have a different bean for each page.
It was just a matter of choice, but you are right that ModelDriven is a good alternative.
Peter Searls
psearls@hollandamerica.com
I'm not sure if I approve of this interruption. But this tiny ad checks out:
Free, earth friendly heat - from the CodeRanch trailboss