tiddi rastogi
tiddi rastogi

Reputation: 526

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

I have following code in my jsp page

<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);

%>

Now I want to pass variables s_date ,e_date and ref_name ingto another jsp page .For this I did code as

 <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: [=] is not a hexadecimal digit

** How to pass these variables in another jsp?

Upvotes: 1

Views: 532

Answers (2)

user3835327
user3835327

Reputation: 1204

Perhaps you can try this, it's similar as @tiddi rastogi mentioned.

<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>

Upvotes: 1

tiddi rastogi
tiddi rastogi

Reputation: 526

I did by using param as

<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>

Upvotes: 1

Related Questions