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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -