修改模板:
找到com.genuitec.eclipse.wizards_9.0.0.me201108091322.jar,至少格式是首碼是一樣,每個版本不一樣,我的是myeclipse10.
然後用war軟體開啟。
建立一個Struts2_jsp.vtl
Struts2_jsp.vtl
------------------------------------- Jsp代碼
- <%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
- <%@ taglib prefix="s" uri="/struts-tags"%>
- <%
- String titleString = "My Struts2 JSP Template";
- String footerString= "My Struts2 JSP Template";
- String path = request.getContextPath();
- String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
- %>
- <html>
- <head>
- <title><%=titleString%></title>
- </head>
- <body>
- <center><h1><%=titleString%></h1></center>
- <hr>
- <%=new Date()%><br>
- Actionerror:<s:actionerror/><br>
- Actionmessage:<s:actionmessage/><br>
- <hr>
- <div style="height:100%;border:1px solid #6699FF">
- <s:form action="myAction" method="post">
- <s:textfield name="user" label="UserName" value="default value" size="50"></s:textfield>
- <s:submit value="Submit"></s:submit>
- </s:form>
- </div>
- <hr>
- <center><%=footerString%></center>
- </body>
- </html>
然後把這個檔案放到jar裡面的com.genuitec.eclipse.wizards_9.0.0.me201108091322.jar\templates\jsp
然後回到com.genuitec.eclipse.wizards_9.0.0.me201108091322.jar最外面的,看見templates.xml
解壓出來,然後在<!-- JSP templates -->的後面增加如下代碼: Xml代碼
- <template
- context="com.genuitec.eclipse.wizards.jsp"
- script="templates/jsp/Struts2_jsp.vtl"
- name="Standard JSP using Struts 2.X with a form"/>
儲存之後,在放到war開啟的jar一樣的地方那個,覆蓋裡面的檔案。
然後啟動myeclipse,點new/jsp 然後就能選擇剛才的模板了。