📄 lib0102.html
字号:
<html>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>Presentation Layer Coding Guidelines</title>
<link rel="STYLESHEET" type="text/css" href="images/xpolecat.css">
<link rel="STYLESHEET" type="text/css" href="images/ie.content.css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/teamlib.gif" width="62" height="15" border="0" align="absmiddle" alt="Team LiB"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href="LiB0101.html"><img src="images/previous.gif" width="62" height="15" border="0" align="absmiddle" alt="Previous Section"></a>
<a href="LiB0103.html"><img src="images/next.gif" width="41" height="15" border="0" align="absmiddle" alt="Next Section"></a>
</div></td></tr></table>
<br>
<div class="chapter">
<a name="ch15"></a>
<div class="section">
<h2 class="first-section-title"><a name="505"></a><a name="ch15lev1sec2"></a>Presentation Layer Coding Guidelines</h2><p class="para">
<b>Keep every <span class="fixed">Action</span>, <span class="fixed">ActionForm</span>, and JSP thin.</b> They are difficult to debug if your company didn't buy tools that allow servlet debugging. You want as little conditional logic as possible. A layered architecture leads you to put all the complexity in the layers that are locally debuggable, like the business <a name="506"></a><a name="IDX-210"></a>and data access layers. If you use Javascript code, keep it thin for the same reasons.</p>
<p class="para">
<b>Action classes and JSPs should not use instance-level variables.</b> Otherwise, you have a good chance of getting incorrect behavior from your application because every instantiation of an action or JSP is used to service multiple users. In contrast, an <span class="fixed">ActionForm</span> can have instance-level variables.</p>
</div>
</div><br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/teamlib.gif" width="62" height="15" border="0" align="absmiddle" alt="Team LiB"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href="LiB0101.html"><img src="images/previous.gif" width="62" height="15" border="0" align="absmiddle" alt="Previous Section"></a>
<a href="LiB0103.html"><img src="images/next.gif" width="41" height="15" border="0" align="absmiddle" alt="Next Section"></a>
</div></td></tr></table>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -