i in situation importing jsp page in turn imports 2 other pages based on parameters of import. problem when try use parameters in url of 2 imports on page imported, invalid url. if hard code parameters url loads no problem. how code is:
//the following first import <c:import url="/blahblah/index.jsp"> <c:param name="sectionid" value="3" /> <c:param name="apageid" value="5" /> <c:param name="bpageid" value="2" /> </c:import> // following (index.jsp) page imported , imports other pages based on parameters int sectionid = request.getparameter("sectionid"); int apageid = request.getparameter("apageid"); int bpageid = request.getparameter("bpageid"); <c:import url="/blahblah/blah.jsp?sectionid=<%=sectionid%>&page_id=<%=apageid%>" /> <c:import url="/blahblah/blah.jsp?sectionid=<%=sectionid%>&page_id=<%=bpageid%>" />
am outputting parameters incorrectly? doesn't work if hard code variables like:
int bpageid = 3;
it work if write 3 in c:import this:
<c:import url="/blahblah/blah.jsp?sectionid=3&page_id=2" />
there error in code.in java request.getparameter(string name)
method returns string
in code assign int
.you must parse int
int sectionid = integer.valueof(request.getparameter("sectionid")); int apageid = integer.valueof(request.getparameter("apageid")); int bpageid = integer.valueof(request.getparameter("bpageid"));
Comments
Post a Comment