I am teaching myself Struts 2 after using Struts 1. In Struts 1 I would access data from the action form in my jsp using the bean tag (ex. <bean:define name="myForm" id="myForm" scope="session"/> ). However Struts 2 seems to have merged the action class with the action form so I am not sure how to access this now. I know there is the <s:property/> tag but I want to assign the value in the jsp such as this...
<!-- Example Struts.xml --> <struts> <package name="default" namespace=""> <action name="MyTestDisplay" class="mypackage.MyTestDisplay"> <result>/web/mytest.jsp</result> </package> </struts> <!-- mypackage.MyTestDisplay.java --> public class MyTestDisplay extends ActionSupport { List<Integer> list1 = new ArrayList<String>(); public String execute() throws Exception { list1.add( 1 ); list2.add( 2 ); list1.add( 3 ); list2.add( 4 ); return SUCCESS; } public List getList1() { return list1; } } <!-- mytest.jsp --> <html> <%@ taglib prefix="s" uri="/struts-tags" %> <table> <tr> <td> <% List<Integer> myList = MyTestDisplay.getList1(); <!-- HOW DO I DO THIS --> for ( Integer i : myData ) { if ( (i % 2) == 0 ) { out.print( i ); } } %> </td> </tr> <html> (I just threw together this example on the fly so sorry if there is a mistake but I am only conserned with the line that has the bold comment) -- View this message in context: http://www.nabble.com/Proper-way-to-access-action-from-JSP-tf4430767.html#a12640050 Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]