How to call the JSP function and send the parameter using the function -
i have 2 files form.jsp , util.jsp
what want want substitute <%=stype%>
attribute function call name checkparam
, pass parameter
form.jsp
stype variable
stype=request.getparameter("type")!=nullrequest.getparameter("type").tostring():""; <form name="myfrm" method=post action="frmaction.jsp?type=<%=checkparam(stype)%>">
util.jsp
public string checkparam(string mparam) { //mycode }
<%=stype%>"> jsp code, right? why in .html file? jsp files rendered server , since can process java code, hence name java server pages. html files served resources , no such rendering done on server side. if want form configured dynamically use either .jsp file reside form or use ajax call , javascript/jquery set action parameter manually.
even if used .jsp render form think code should written place holder.
<form name="myfrm" method=post action="frmaction.jsp?type=${stype}">
if using jsp use standard tag libraries. coding <%=stype%> bad practice, of understanding.
according edit think statement should
stype=(request.getparameter("type")!=null) ? request.getparameter("type").tostring():"";
Comments
Post a Comment