现在根据客户需求,不同的产品要对应不同的jsp(既页面上的输入框和下拉菜单不确定),这该怎么做啊?
刚才在网上搜索了下 找了个解决方法 就是:
<%
// 动态生成jsp文件,然后动态调用
String filename = "testDynamicInclude.jsp";
String path = application.getRealPath(".");
FileWriter fw = new FileWriter(path + "/" + filename);
fw.write("<" + "%@ page language=\"java\" contentType=\"text/html; charset=GBK\" pageEncoding=\"GBK\"%" + ">");
fw.write("<" + "%=new java.util.Date()%" + ">");
fw.close();
%>
<jsp:include page="<%=filename%>" />但是个人感觉 因为我们的页面比较复杂 这样一个一个组件往里面写的话 好像挺费劲 不知道各位大虾们有什么高招啊 请多多指点 指点的好的话 我会追加分的
刚才在网上搜索了下 找了个解决方法 就是:
<%
// 动态生成jsp文件,然后动态调用
String filename = "testDynamicInclude.jsp";
String path = application.getRealPath(".");
FileWriter fw = new FileWriter(path + "/" + filename);
fw.write("<" + "%@ page language=\"java\" contentType=\"text/html; charset=GBK\" pageEncoding=\"GBK\"%" + ">");
fw.write("<" + "%=new java.util.Date()%" + ">");
fw.close();
%>
<jsp:include page="<%=filename%>" />但是个人感觉 因为我们的页面比较复杂 这样一个一个组件往里面写的话 好像挺费劲 不知道各位大虾们有什么高招啊 请多多指点 指点的好的话 我会追加分的
解决方案 »
- COOKIE问题 在线求助啊 急死人了
- 如何读写PowerPopit
- 如何从结果集获得经过聚集函数处理过的数据
- jfreechart问题 大侠帮忙解决 谢谢
- 有那位高人做过struts+acegi+spring+hibernate的系统呢?急!!!!!
- struts中使用.js文件出现的问题
- Static Nested Class 和 Inner Class的不同
- 求 jsdk1.5 api docs 下载地址
- 请问哪有将整个网站由简体中文转为繁体中文的JAVA包,或者累试的也行。(50分酬谢)
- java mail问题,请大家帮忙解决!
- 图片上传问题(绝对路径就可以上传 服务器的虚拟路径就传不上去了
- 在本页打开这个页面显示在页面上``
那js可以在jsp页面上产生新的输入框吗?
{
var p, i, foundObj;
if (!theDoc) theDoc = document;
if ((p = theObj.indexOf("?")) > 0 && parent.frames.length)
{
theDoc = parent.frames[theObj.substring(p + 1)].document;
theObj = theObj.substring(0, p);
}
if (!(foundObj = theDoc[theObj]) && theDoc.all)
foundObj = theDoc.all[theObj]; for (i = 0; !foundObj && i < theDoc.forms.length; i++)
foundObj = theDoc.forms[i][theObj]; for (i = 0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
foundObj = findObj(theObj, theDoc.layers[i].document); if (!foundObj && document.getElementById)
foundObj = document.getElementById(theObj); return foundObj;
}
//添加一个参与人填写行
function AddSignRow() { //读取最后一行的行号,存放在txtTRLastIndex文本框中
var txtTRLastIndex = findObj("txtTRLastIndex", document);
/* alert(txtTRLastIndex.value);*/
var rowID = parseInt(txtTRLastIndex.value); var signFrame = findObj("SignFrame", document);
//添加行
var newTR = signFrame.insertRow(signFrame.rows.length);
newTR.id = "SignItem" + rowID; //添加列:序号
var newNameTD = newTR.insertCell(0);
//添加列内容
newNameTD.innerHTML = newTR.rowIndex.toString(); //添加列:checkbox
var newCompanyTD = newTR.insertCell(1);
//添加列内容
newCompanyTD.innerHTML = "<input name='checkbox' id='checkbox" + rowID + "' type='checkbox' value=" + rowID + " size='20' />";
//添加列:username
var newNameTD = newTR.insertCell(2);
//添加列内容
newNameTD.innerHTML = "<input name='username" + rowID + "'id='username" + rowID + "' type='text' size='12' />";
/*newNameTD.innerHTML = "<input name='role" + rowID + "'id='role" + rowID + "' type='checkbox' size='12' />";*/ //添加列:usersex
var newEmailTD = newTR.insertCell(3);
//添加列内容
newEmailTD.innerHTML = "<input name='usersex" + rowID + "' id='usersex" + rowID + "' type='text' size='20' />"; //添加列:userage
var newTelTD = newTR.insertCell(4);
//添加列内容
newTelTD.innerHTML = "<input name='userage" + rowID + "' id='userage" + rowID + "' type='text' size='10' />"; //添加列:usercomment
var newMobileTD = newTR.insertCell(5);
//添加列内容
newMobileTD.innerHTML = "<input name='usercomment" + rowID + " ' id='usercomment" + rowID + "' type='text' size='12' />";
//添加列:删除按钮
var newDeleteTD = newTR.insertCell(6);
//添加列内容
newDeleteTD.innerHTML = "<div align='center' style='width:40px'><a href='javascript:;' onclick=\"DeleteSignRow('SignItem" + rowID + "')\">删除</a></div>"; //将行号推进下一行
// 返回 并保存数据
txtTRLastIndex.value = (rowID + 1).toString();
return rowID;
}
//删除指定行
function DeleteSignRow(rowid) {
var signFrame = findObj("SignFrame", document);
var signItem = findObj(rowid, document); //获取将要删除的行的Index
var rowIndex = signItem.rowIndex; //删除指定Index的行
signFrame.deleteRow(rowIndex); //重新排列序号,如果没有序号,这一步省略
for (i = rowIndex; i < signFrame.rows.length; i++) {
signFrame.rows[i].cells[0].innerHTML = i.toString();
}
}//清空列表
function ClearAllSign() {
if (confirm('确定要清空所有吗?')) {
var signFrame = findObj("SignFrame", document);
var rowscount = signFrame.rows.length; //循环删除行,从最后一行往前删除
for (i = rowscount - 1; i > 0; i--) {
signFrame.deleteRow(i);
} //重置最后行号为1
var txtTRLastIndex = findObj("txtTRLastIndex", document);
txtTRLastIndex.value = "1";
}
}