블로그 이미지
플로거
Android/J2EE/Web/통신/IBS/CRM/CS ..

calendar

        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  

Notice

2010.12.23 14:40 Programming/Velocity


[Sample.vm]

 

<html>

<body>

#set($message = "Hello World! 하이")

$message<br>

Velocity Version: $version<br>

$date

</body>
</html>



 

[Welcome.vm]

 <html>
   <head>
    <title>Welcome</title>
    <BASE href="$link.baseRef">
    </head>
    <body bgcolor="#ffffff">
    #if ($logonActionForm)
    <H3>Welcome $logonActionForm.username!</H3>
    #else
    <H3>Welcome World!</H3>
    #end
    $!errors.msgs()
  </body>
</html>

[Logon.vm]

 <HTML>
<HEAD>
 <TITLE>Sign in, Please!</TITLE>
 <script language="javascript" src="validate.js"></script>
 </HEAD>
<BODY>
  테스트 중
  $!errors.msgs()
<FORM name="logonForm" method="POST" action="$link.setAction('/logonAction')"
 onsubmit="return validate(this);">
 <TABLE border="0" width="100%">
 <TR>
  <TH align="right">Username:</TH>
  <TD align="left"><INPUT type="text" name="username" dispName="username" notNull
   value="$!logonForm.username"></TD>
 </TR>
 <TR>
  <TH align="right">Password:</TH>
  <TD align="left"><INPUT type="password" name="password" dispName="password"
   notNull value="$!logonForm.password"></TD>
  </TR>
<TR>
<TD align="right"><INPUT type="submit" value="Submit" name="submit"></TD>
<TD align="left"><INPUT type="submit" value="reset" value="Reset" name="reset"></TD>
</TR>
</TABLE>
</BODY>
</HTML>

[struts-config.xml]


 <form-beans>
     <form-bean name="logonForm" type="com.jumyung.sample.form.LogonActionForm" />
  </form-beans>
  <action-mappings>
    <action input="/Logon.vm" name="logonForm" path="/logonAction" scope="session"
 type="com.jumyung.sample.action.LogonAction" validate="true" > 
      <forward name="success" path="/Welcome.vm"/>
    </action>     
  </action-mappings>


[결과]




2010/12/23 - [JAVA/Velocity] - Velocity 개요, 실행원리
2010/12/23 - [JAVA/Velocity] - Velocity II - Development Configuration

Professional Struts Applications: Building Web Sites with Struts, Object Relational Bridge, Lucene, and Velocity
외국도서
저자 : John Carnell
출판 : Wrox 2003.01.01
상세보기


저작자 표시 비영리 변경 금지
신고
posted by 훈즈 플로거

티스토리 툴바