簡體   English   中英

通過jsp:include標記將變量從一個jsp傳遞到另一個jsp頁面時出錯

[英]Error in passing variables from one jsp to another jsp page through jsp:include tag

我的jsp頁面中有以下代碼

<body>
<jsp:useBean id="ref" class="comp_Mps.Comp_Mps_hs"/>
<%
   String s_date= request.getParameter("startdate");
   pageContext.setAttribute("s_date", s_date);
   String e_date= request.getParameter("enddate");
   pageContext.setAttribute("e_date", e_date);
   ref.refarray_vac1(s_date,e_date);
   ref.ClosestToMultiplesOfTen_User(s_date,e_date);
   %>

<%
   String ref_name= request.getParameter("ref_logtime");
   pageContext.setAttribute("ref_name", ref_name);
   ref.FindClosestToMultiplesOfTen(ref_name);
   ref.refernece(ref_name);

%>

現在我想將變量s_date,e_date和ref_name傳遞給另一個jsp頁面。為此,我將代碼編寫為

 <jsp:include page="Comp_Mps_Hs.jsp?ref_logtime=<%=ref_name%>;&startdate=<%=s_date%>;&&enddate=<%=e_date%>"></jsp:include>

I want to pass above said variable sin Comp_Mps_Hs.jsp page.But when I run it ,then I get an error that

**

java.lang.IllegalArgumentException:[=]不是十六進制數字

**如何在另一個jsp中傳遞這些變量?

我通過使用param作為

<jsp:include page="Comp_Mps_Hs.jsp">
<jsp:param value="startdate" name="s_date"/>
<jsp:param value="enddate" name="e_date"/>
<jsp:param value="ref_logtime" name="ref_name"/>
</jsp:include>

也許您可以嘗試一下,就像提到的@tiddi rastogi一樣。

<jsp:include page="Comp_Mps_Hs.jsp">   
<jsp:param name="ref_logtime" value="<%=ref_name%>" />
<jsp:param name="startdate" value="<%=s_date%>" />
<jsp:param name="enddate" value="<%=e_date%>" />
</jsp:include>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM