java - parameters are not passed in jsp -
i'm developing breadcrumb on website, use following code in jsp:
<form action="envelope"> <input type="hidden" id="id" name="id" value=""> <input type="hidden" name="q" value="${fn:escapexml(param.q)}"> <button type="submit" id="back" class="btn btn-sm btn-primary"> <span class="fa fa-chevron-left"></span> </button> <ol class="breadcrumb"> <li id="file"><a href="envelope.jsp?id=${envlev0}">file</a></li> <li id="format"><a href="envelope.jsp?id=${envlev1}">format</a></li> <li id="batch"><a href="envelope.jsp?id=${envlev2}">batch</a></li> <li id="payment" class="active">payment</li> </ol> </form>
i use following code resolve parameters in detailscontrollerservlet:
@override public void service(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { string index = request.getparameter(field_index); string type = request.getparameter(field_type); string id = request.getparameter(field_id); map<string, object> map = searchdetails(index, id); (map.entry<string, object> entry : map.entryset()) { string key = entry.getkey(); object value = entry.getvalue(); if(field_business_data.equals(key)) { value = xml_utils.tohtml((string)value); } request.setattribute(key, value); if(logger.isdebugenabled()) { logger.debug("added '" + key + "'='" + value + "' request."); } } request.setattribute(field_index, index); request.setattribute(field_id, id); string detailspage; switch (type) { case "fileenvelope": case "formatenvelope": case "batchenvelope": detailspage = envelope_jsp; break; case "payment": detailspage = payment_jsp; request.setattribute("envlev0", 1); request.setattribute("envlev1", 2); request.setattribute("envlev2", 3); break; default: detailspage = details_jsp; } getservletcontext().getrequestdispatcher(detailspage).forward(request, response); }
when choose payment type,i'm navigated payment screen, id resolved, envelope levels not. going wrong?
i think problem lies in detailspage. using request.getparameter()
or request.getattribute()
. should using later.
Comments
Post a Comment