论坛首页 Java企业应用论坛

struts+velocity-tools-1.1+hibernate+dao

浏览 7186 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2004-02-10  
各位老弟:
        如果你在struts项目中还未使用velocity-tools,赶紧吧!velocity-tools确实是个好东东,一但使用我保您立马抛弃那烦人jsp tag.
        有兴趣大家可以交流心得.
   发表时间:2004-02-10  
哥们,我现在也在找web层比较好的实现方式,你可以给一个你的demo么,看看你说的velocity好在哪?
0 请登录后投票
   发表时间:2004-02-10  
楼主能不能上传到服务器上来,共大家学习参考?
0 请登录后投票
   发表时间:2004-02-10  
各位:
    本人正在处理棘手事情。先贴出一个vm代码,我尽快将demo上传给大家研究.如果等不及,请到jakarta.apache.org上去下载velocity-tools 1.1 beta版,包中有例子.
     其中的struts tools直接可以与Struts的form,formbean,
ActionMessages,ActionErrors,Action,Validator,Tiles等一起工作.

<html>
    <head>
    	<title>群组表单</title>
    	<meta http-equiv="Content-Type" content="text/html; CHARSET=utf8">
    	<script type="text/javascript" src="scripts/webfxlayout.js"></script>
        <script language="JavaScript" src="scripts/jsTools.js"></script>
        <script type="text/javascript" src="scripts/tabpane.js"></script>
        <link rel="stylesheet" href="css/default.css" type="text/css">
    	<link rel="stylesheet" href="css/tab.winclassic.css" type="text/css">
    </head>

    <body bgcolor="#FFFFFF" text="#000000" topmargin="1" leftmargin="1" onLoad="document.group.groupName.focus();;">
         <TABLE  WIDTH="100%" BORDER=0 CELLSPACING=0 CELLPADDING=0 class="toolbar">
          <TR VALIGN="MIDDLE"  HEIGHT=24>
	        <TD width="20%" align="center">群组管理</TD>
            <TD  WIDTH="80%" ALIGN="RIGHT">
               <TABLE align=right  BORDER=0 CELLSPACING=0 CELLPADDING=0>
                 <TR VALIGN="middle">
                  #if(!$mode.equals("new"););
                   <TD WIDTH="60" class="action" valign="bottom" onclick="group.action.value='save'; document.group.submit();; return false;">更新</TD>
                  #else
                   <TD WIDTH="60" class="action" valign="bottom" onclick="group.action.value='save'; document.group.submit();; return false;">保存</TD>
                  #end
                    <TD   WIDTH="1">&</TD>
                    <TD WIDTH="60" class="action" valign="bottom" onclick="group.action.value='list'; document.group.submit();; return false;">取消</TD>
                    <TD  WIDTH="1">&</TD>
                 </TR>
               </TABLE>
           </TD>
         </TR>
        </TABLE>          
        <form name="group" method="POST" action="$link.setAction("groupAction");">
          <input type="hidden" name="action" value="">
          <input type="hidden" name="resource" value="3">
          <div class="tab-pane" id="tabPane1">
            <script type="text/javascript">
               tp1 = new WebFXTabPane( document.getElementById( "tabPane1" ); );;
             </script>
             <div class="tab-page" id="tabPage1">
                 <span class="tab">基本信息</span>
                <script type="text/javascript">
                   tp1.addTabPage( document.getElementById( "tabPage1" ); );;
                </script>
        #if(!$mode.equals("new"););
        <input type="hidden" name="groupID" value="$!groupForm.groupID"> 
        #end
        <table align="center" width="99%" cellpadding="1" cellspacing="1" border="0" bgcolor="#000000">
        	<tr> 
        		<td width="23%" class="lable">群组名称</td>
        		<td  class="field"><input type="text" name="groupName" value="$!groupForm.groupName"></td>
        	</tr>
        	<tr> 
        	    <td width="23%" class="lable">角色</td>
        		<td width="77%" class="field">
        		  #foreach($role in $roles);
        		       <input type="checkbox" name="roleIDs" value="$!role.value"  
        		          #foreach($id in $groupForm.roleIDs);
        		           #if($id==$role.value);
        		              checked  
        		           #end
        		         #end>$!role.label<br>
        		 #end
        		</td>
        	</tr>
        </table>
        </div>
	 </div>
	 <script type="text/javascript">
       //<![CDATA[
        setupAllTabs();;
        //]]>
     </script>
      #include("/scripts/enterToTab.js" ); 
      </form>
    </body>
</html>
0 请登录后投票
   发表时间:2004-02-11  
aloneflasher 写道
哥们,我现在也在找web层比较好的实现方式,你可以给一个你的demo么,看看你说的velocity好在哪?



我后天上传到服务器上.
0 请登录后投票
   发表时间:2004-02-12  
我看了关于velocity的一些资料,大致明白了它的一些原理。但是希望能给出一个tructs架构的例子。其中,包括网页面上传送list列表,对象的内容。并且,希望知道config配置文件中action和页面之间的映射关系。  velocity包中没有这种例子,或者我没有找到。 谢谢了。
0 请登录后投票
   发表时间:2004-07-01  
楼主能上传例子么?我也想了解这方面的东东
0 请登录后投票
   发表时间:2004-07-02  
xmnkl 写道
我看了关于velocity的一些资料,大致明白了它的一些原理。但是希望能给出一个tructs架构的例子。其中,包括网页面上传送list列表,对象的内容。并且,希望知道config配置文件中action和页面之间的映射关系。  velocity包中没有这种例子,或者我没有找到。 谢谢了。


其实Velocity只是用来替换jsp作显示用的,所以你只要把Action对应的jsp页面改成.vm页面就可以了,其它的FormBean和Action什么的都不用动的。

如果用tiles的话,只要把tile定义中的jsp页面改成vm页面。

Velocity的易用性确实值得称道。
0 请登录后投票
   发表时间:2004-07-03  
请问在哪可以找到更多关于struts+velocity的资料和示例
0 请登录后投票
   发表时间:2004-07-06  
请问如何用eclipse编辑vm文件,大家用的是哪个插件
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics