Struts BaseTag Sample

wty814022051 2010-04-24 12:16:42
In this example you will learn how to use Struts HTML Tags. In order to use the Struts HTML Tags you need to include the following taglib directive in the jsp page.

1.<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
All the Struts HTML tags should be nested within the body of the <html:form /> tag. We will create a simple feedback form to see how the different Struts HTML Tags can be used. The feedback.jsp contains the following code.

01.<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
02.<html>
03.<head>
04.<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
05.<title>Feedback Form</title>
06.</head>
07.<body>
08.<b>Feedback Form</b>
09.<hr>
10.<html:form action="https://youtubeproxy.org/default.aspx">
11.<table>
12. <tr>
13. <td>
14. Name :
15. </td>
16. <td>
17. <html:text name="feedbackForm" property="name" />
18. </td>
19. </tr>
20. <tr>
21. <td>
22. Sex :
23. </td>
24. <td>
25. <html:radio name="feedbackForm" property="sex" value="M" >
26. M </html:radio>
27. <html:radio name="feedbackForm" property="sex" value="F" >
28. F </html:radio>
29. </td>
30. </tr>
31. <tr>
32. <td>
33. Comments :
34. </td>
35. <td>
36. <html:textarea cols="20" rows="5" name="feedbackForm"
37. property="comments" />
38. </td>
39. </tr>
40. <tr>
41. <td>
42. <html:submit />
43. </td>
44. <td>
45. <html:reset />
46. </td>
47. </tr>
48.</table>
49.</html:form>
50.</body>
51.</html>
The name attribute of the HTML tag contains the Form Bean name. The property attribute of the HTML Tag contains the corresponding Form property.

Once the feedback is submitted by the user, the user will be forwarded to the success page. Here the feedback submitted by the user will be displayed. We use Struts Bean Tag do to this. We use Struts Logic Equal Tag to display Male if the user has selected M for sex and Female if the user has selected F for sex. In order to use the Struts Bean and Logic Tag you need to include the following taglib directives in the jsp page.

1.<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
2.<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
The success.jsp page contains the following code.

01.<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
02.<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
03.<html>
04.<head>
05.<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
06.<title>Feedback Form</title>
07.</head>
08.<body>
09.<b>Feedback Successfully Submitted.</b><br>
10.You have submitted the following feedback.
11.<table>
12. <tr>
13. <td>
14. Name :
15. </td>
16. <td>
17. <bean:write name="feedbackForm" property="name" />
18. </td>
19. </tr>
20. <tr>
21. <td>
22. Sex :
23. </td>
24. <td>
25. <logic:equal name="feedbackForm" property="sex" value="M"> Male </logic:equal>
26. <logic:equal name="feedbackForm" property="sex" value="F"> Female </logic:equal>
27. </td>
28. </tr>
29. <tr>
30. <td>
31. Comments :
32. </td>
33. <td>
34. <bean:write name="feedbackForm" property="comments" />
35. </td>
36. </tr>
37.</table>
38.</body>
39.</html>
On executing the example the following page will be dispalyed to the user.
...全文
56 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
WinDirStat - Directory Statistics
Copyright (c) 2003-2005 Bernhard Seifert. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

Shows where all your disk space has gone, and helps you clean it up.

You know the problem: The hard disk is almost full, and you don't know, where the big files actually are lying, which occupy all the space. They may well be hidden in sub-sub-directories. To find out this by means of the Windows Explorer, is tiring: you would have to expand and collapse directories over and over or view the "Properties" of the directories, which always count just the size of a single subtree. It's hard to form a mental image of the hard disk usage in this way. This is where WinDirStat helps.

On start up WinDirStat opens the Select Drives Dialog. Press the OK button.

Then WinDirStat reads in the whole directory tree once (this can last some minutes depending on the hard disk size) and then presents it in three useful views:

WinDirStat
Directory List Extension List
Treemap

The views are coupled with each other.

You can clean up the hard disks with several Cleanups.

The views and the User Defined Cleanups can be configured according to your personal needs.

Sorting

Legend

Frequently Asked Questions

Limits

Deinstallation

GNU Free Documentation License
  • 打赏
  • 举报
回复
你搞啥?

5,655

社区成员

发帖
与我相关
我的任务
社区描述
Web开发应用服务器相关讨论专区
社区管理员
  • 应用服务器社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧