Raible's Wiki
Raible Designs AppFuseHomepage- Korean - Chinese - Italian - Japanese QuickStart Guide User Guide Tutorials Other ApplicationsStruts ResumeSecurity Example Struts Menu
Set your name in
UserPreferences
Referenced by
JSPWiki v2.2.33
Hide Menu |
This is version 5.
It is not the current version, and thus it cannot be edited. Part II: Create Weblog UI - A HowTo for creating a UI (in Struts) for managing the DAOs created in the Hibernate Relationships tutorial. I've eliminated creating managers in this tutorial for a couple reasons: 1) to reduce the amount of code and 2) to show you that you don't have to create them. About this TutorialIn this section, you'll create a UI that has the following features.
Table of Contents
Modify userForm.jsp to allow creating/editing a weblog [#1]A weblog record has 4 fields: weblogId, username, blogTitle and dateCreated. The blogTitle is the only field that users should be able to edit. The rest of them can be set programmatically. Open web/pages/userForm.jsp and add the following code to the bottom of the form (between </table> and </form>.<fieldset style="position: absolute; top: 190px; left: 520px"> <legend style="font-weight: bold">Weblogs</legend> <c:forEach var="blog" items="${userForm.weblogs}" varStatus="index"> <input type="hidden" name="weblogs[<c:out value='${index.index}'/>].weblogId" value="<c:out value='${blog.weblogId}'/>"/> <input type="hidden" name="weblogs[<c:out value='${index.index}'/>].username" value="<c:out value='${blog.username}'/>"/> <input type="hidden" name="weblogs[<c:out value='${index.index}'/>].dateCreated" value="<fmt:formatDate value='${blog.dateCreated}' pattern="MM/dd/yyyy"/>"/> <input type="text" name="weblogs[<c:out value='${index.index}'/>].blogTitle" size="40" value="<c:out value='${blog.blogTitle}'/>"/><br/> </c:forEach> </fieldset> If you run "ant deploy", go to http://localhost:8080/appfuse/editProfile.html and login as "tomcat/tomcat", you should see a screenshot like the one below: Modify the UserAction to support editing a user's weblogs [#2]Create an EntryAction to handle CRUD-ing Entries [#3]Add the ability to see all Weblogs and edit them, as well as their users [#4]Attachments:
|