菜鸟高分求教如何在JSP文件中写个函数返回值

cnhuai 2009-03-30 07:53:28
详细问题如下:JSP文件内容是下面的 ,能否帮我返回 "lovValues"

<!-- processRefreshLOV.jsp -->
<%@ include file="incStartpage.jsp" %>

<jsp:useBean id="objPromptsBean" class="com.businessobjects.adv_ivcdzview.Prompts" scope="page" />

<%
response.setDateHeader("expires", 0);
if (!isAlive)
{
objUtils.invalidSessionDialog(out);
return;
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script language="javascript">
<%
try
{
objPromptsBean.onStart(requestWrapper);
String strEntry = requestWrapper.getQueryParameter("sEntry", true);
String strViewerID = requestWrapper.getQueryParameter("iViewerID", true);
String strSrcLovID = requestWrapper.getQueryParameter("sLovID", true);
String strAction = requestWrapper.getQueryParameter("sAction", true);
String strGlobalIndex = requestWrapper.getQueryParameter("gIndex", true);
String strPromptIndex = requestWrapper.getQueryParameter("iPrompt", true);
int iPrompt = Integer.parseInt(strPromptIndex);
String strParamName = requestWrapper.getQueryParameter("sParamName", true);
String strSetNP = requestWrapper.getQueryParameter("setNP", false, "no");
String strLovType = requestWrapper.getQueryParameter("sLovType", false, "");
LovType lovType = null;
if (strLovType.equals("DataSource"))
lovType = LovType.DATA_SOURCE;
else if (strLovType.equals("Cube"))
lovType = LovType.CUBE;
else
lovType = LovType.LOV_OBJECT;
String strSearchSensitive = requestWrapper.getQueryParameter("sCaseSensitive", false, "no");
boolean bMatchCase=false;
if ( strSearchSensitive.equals("yes") )
bMatchCase=true;

DocumentInstance doc = reportEngines.getDocumentFromStorageToken(strEntry);

Lov objLOV = doc.getLOV(strSrcLovID, lovType);

out.println("arrPrompts=new Array(1);");
out.println("arrNbLovItems=new Array(1);");
out.println("arrSelectedValues=new Array(1);");
out.println("arrLovTexts=new Array(1);");
out.println("arrLovValues=new Array(1);");
out.println("arrLovIndexes=new Array(1);");
out.println("arrNbBatchLovItems=new Array(1);");
out.println("arrBatchLovTexts=new Array(1);");
out.println("arrBatchLovSelValue=new Array(1);");

String strTxtSearch = requestWrapper.getQueryParameter("L" + strParamName + "_searchVal", false, "");
String mustFillNestedPrompts = "false";
if (!strAction.equals("B"))
{
if (strAction.equals("R"))
{
if (strSetNP.equals("yes"))
objLOV = objPromptsBean.setNestedPrompts(objLOV,iPrompt);
else
{
objLOV.refresh();
if (objLOV.mustFillNestedPrompts())
mustFillNestedPrompts = "true";
}
}
else if (strAction.equals("F"))
{
if (strSetNP.equals("yes"))
objLOV = objPromptsBean.setNestedPrompts(objLOV,iPrompt);
if (objLOV.mustFillNestedPrompts())
mustFillNestedPrompts = "true";
}
}
if (strAction.equals("R"))
strTxtSearch="";
if (!strTxtSearch.equals(""))
objLOV.setSearchMode(true);
else
objLOV.setSearchMode(false);
objLOV.setSearchPattern(strTxtSearch);
objLOV.setSearchMatchCase( bMatchCase );
out.println("p=arrPrompts[0]=new Array(15);");
out.println("p[7]=false;");
if (!strAction.equals("B"))
{
boolean blnHasBatchList = objPromptsBean.getBatchLOV(1, objLOV, out);
if (!blnHasBatchList)
out.println("arrNbBatchLovItems[0]=0;");
}
boolean blnHasLovItems = objPromptsBean.getLovValues(1, objLOV, out);
if (!blnHasLovItems)
out.println("arrNbLovItems[0]=0;");
if (mustFillNestedPrompts.equals("false"))
{
strEntry = doc.getStorageToken();
objUtils.setSessionStorageToken(strEntry, strViewerID, session);
}
%>
</script>
<script language="javascript">


var p=parent;
p.strEntry="<%=strEntry%>";
var strAction="<%=strAction%>";
var bNestedPrompt=<%=mustFillNestedPrompts%>;
function reloadLOV(gIndex)
{
if (p.updateLovAfterSubmitAction)
p.updateLovAfterSubmitAction(gIndex,self);
else if (p.updateBatchAndLov)
{
if (bNestedPrompt)
p.frameReload(p)
else
p.updateBatchAndLov(strAction, arrBatchLovTexts[0],arrLovTexts[0],arrLovIndexes[0]);
p.hideBlockWhileWaitWidget();
}
else if (p.advPromptsFrame)
{
p=p.advPromptsFrame;
if (p.updateLovAfterSubmitAction)
p.updateLovAfterSubmitAction(gIndex,self);
}
else
p.hideBlockWhileWaitWidget();
}
</script>
</head>
<body onLoad="reloadLOV(<%=strGlobalIndex%>)">
</body>
</html>
<%
}
catch(Exception e)
{
out.println("if (typeof(parent.displayWaitCursor)!=\"undefined\")");
out.println(" parent.displayWaitCursor.show(false);");
out.println("</script>");
objUtils.displayErrorMsg(e, "_ERR_LOV", false, out, session);
}
%>


...全文
212 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
cnhuai 2009-05-19
  • 打赏
  • 举报
回复
本具体问题就不要解决了
没实际意义
不过要知道在jsp文件中写函数返回值的方法
ccyingfu 2009-03-30
  • 打赏
  • 举报
回复
<%! public Object function(){return new Object();} %>
Da侠饶命 2009-03-30
  • 打赏
  • 举报
回复
额。。。不用把 BEAN 也贴出来嘛?(我是菜鸟)
huangan0301 2009-03-30
  • 打赏
  • 举报
回复
头晕ing~~~
mike_24 2009-03-30
  • 打赏
  • 举报
回复
顶一个.
cnhuai 2009-03-30
  • 打赏
  • 举报
回复
不好意思 上面返回的值写错了 是返回 "objLOV"

81,077

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧