HibernateRelationshipsUI |
|
Your trail: |
Difference between
version 4
and
version 3:
At line 1 changed 1 line. |
__Part II:__ [Create Weblog UI|HibernateRelationshipsUI] - 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. |
__Part II:__ [Create Weblog UI|HibernateRelationshipsUI] - 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. |
At line 14 changed 1 line. |
* [1] Modify userForm.jsp to allow creating/editing a weblog |
* [1] Modify userForm.jsp to allow creating/editing a weblog (many-to-many) |
At line 20 changed 1 line. |
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. |
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>. |
At line 22 added 16 lines. |
{{{ |
<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: |
|
|
Back to HibernateRelationshipsUI,
or to the Page History.
|