| Neill's profileLaney ConsultingBlogLists | Help |
Laney ConsultingApplication Development using Open Source and Java Technologies |
||||
|
April 19 Alternating row colors using STRUTS 2<s:iterator value="results" status="status"> February 21 Struts2 nested checkbox tag inside iteratorUsing the s:iterator tag and status attribute it's possible to display and update values of complex types within a collection. For example, using an iterator tag, <s:iterator value="results" status="status"> <s:hidden value="%{product.sku}" name="results[%{#status.index}].product.sku" /> <input type="checkbox" name="results[<s:property value="%{#status.index}" />].selected" <s:property value="%{selected}" />> </s:iterator> within a form tag, the submit action will update the list of results in the Action class, where my action class has protected List<ProductBean> results; with getters and setters, and my ProductBean has, private Product product; with getters and setters, and private boolean selected; /** /** NOTE: if you find something useful, please leave a comment, thanks! July 23 Implement connection pooling in Tomcat 5.5 using Hibernate 3, MySQL 5Culled from various sources: Add JDBC driver, mysql-connector-java-5.1.5.jar to apache-tomcat-5.5.xx\common\lib Add resource-ref to WEB-INF/web.xml ================================================================= <web-app ...> ... <resource-ref> </web-app> ================================================================ Add session-factory name attribute and property elements to WEB-INF/classes/hibernate.cfg.xml ================================================================= <hibernate-configuration> <!-- JNDI Connection --> <property name="hibernate.dialect"> ... </session-factory> ================================================================== Add Resource to META-INF/context.xml, alternatively add Resource to GlobalResources in tomcat server.xml ================================================================== <?xml version="1.0" encoding="UTF-8"?> <Context path="/MyApp" reloadable="true"> <Resource name="jdbc/MySqlDS" auth="Container" </Context> ================================================================== That should work! June 16 Unit test JPA Entities with in-memory database « Eskatos’s thoughts on JEE developmentI've been looking for a way to JUnit test my applications using Hibernate which require a database connection. This looks promising! Unit test JPA Entities with in-memory database « Eskatos’s thoughts on JEE development June 06 Struts2 checkboxlist UI tag rendering one item per lineAfter struggling with this UI tag for a some time today, I gave up and was attempting to use s:checkbox inside of an s:iterator to render one item per line, unsuccessfully. So, upon revisiting s:checkboxlist, I found that it's a relatively painless thing to override the checkboxlist.ftl file described here, http://struts.apache.org/2.0.9/docs/template-loading.html, add a break at the end of this line <label for="${parameters.name?html}-${itemCount}" class="checkboxLabel">${itemValue?html}</label><br />and save the file in the webapp/template/simple dir of my web application. |
||||
|
|