<%@page contenttype="text/html;charset=gb2312"%>
<%@page import="java.io.*"%>
<%
try
{
string ejb_type=request.getparameter("ejb_type");
string ejb_name=request.getparameter("ejb_name");
file myfile=new file(ejb_name);
myfile.mkdir();
myfile=new file(ejb_name+"//"+ejb_name+"home.java");
myfile.createnewfile();
myfile=new file(ejb_name+"//"+ejb_name+"remote.java");
myfile.createnewfile();
myfile=new file(ejb_name+"//"+ejb_name+"ejb.java");
myfile.createnewfile();
%>
<html>
<body>
<script language="javascript">
function err(form)
{
return true;
}
function stringfilter(strfilter)
{
for (i=0;i<strfilter.length;i++)
{
if((strfilter.charat(i)>="a" && strfilter.charat(i)<="z")||(strfilter.charat(i)>="a"&&strfilter.charat(i)<="z")||(strfilter.charat(i)>="0"&&strfilter.charat(i)<="9")||(strfilter.charat(i)=="_"))
{}
else
{
window.alert ("您的输入中有非法字符");
return 1;
}
}
return 0;
}
</script>
<center>
<form action="createfile.jsp?ejb_type=<%=ejb_type%>&ejb_name=<%=ejb_name%>&server_type=<%=request.getparameter("server_type")%>" method="post" name="form1" onsubmit="return err(form1)">
<table border="1" width="700">
<tr>
<td align="right" width="300">
请输入您要将它创建的包名:
</td>
<td align="left" width="400">
<input type="text" name="package_name">
</td>
</tr>
<%if (ejb_type.equals("entity"))
{%>
<tr>
<td align="right" width="300">
请输入您要创建的entity bean的主键类型:
</td>
<td align="left" width="400">
<select name="primarykey">
<option value="string">string</option>
<option value="integer">integer</option>
<option value="long">long</option>
<option value="float">float</option>
<option value="date">date</option>
</select>
</td>
</tr>
<%}%>
<tr>
<td align="right" width="300">
请输入您要创建的home接口中的方法:
<br><font color="red">(请先写方法名称,空格后输入返回类型;以回车来分割不同方法)</font>
</td>
<td align="left" width="400">
<%if (ejb_type.equals("entity"))
{%>
<textarea name="home_method" rows="4" cols="50">create() <%=ejb_name+"remote"%>
findbyprimarykey() <%=ejb_name+"remote"%></textarea>
<%}else{%>
<textarea name="home_method" rows="4" cols="50">create() <%=ejb_name+"remote"%></textarea>
<%}%>
</td>
</tr>
<tr>
<td align="right" width="300">
请输入您要创建的remote接口中的方法:
<br><font color="red">(请先写方法名称,空格后输入返回类型;以回车来分割不同方法)</font>
</td>
<td align="left" width="400">
<textarea name="remote_method" rows="4" cols="50"></textarea>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="提交"> <input type="reset" value="重填"></td>
</tr>
</table>
<form>
</center>
</body>
</html>
<%
}
catch(exception e)
{
out.print(e.getmessage());
}%>
这个文件是createejb.jsp。主页面是index.jsp
