Pass the context path into a custom tag
843835Feb 18 2003 — edited Feb 24 2003Here is a snapshot of the custom tag:
// setter for tag attribute
public void setAction(String action) {
this.action = action;
}
public int doStartTag() throws JspTagException {
// ...
// print out <form> tag and hidden input for startIndex
try {
JspWriter out = pageContext.getOut();
out.print("<form");
out.print(" method=\"" + request.getMethod() + "\"");
out.println(" action=\"" + action + "\">");
out.println(" <input type=\"hidden\" name=\"" +
listTag.getParamPrefix() + listTag.getStartIndexParam() +
"\" value=\"" +
(listTag.getStartIndex() + listTag.getNumItems()) + "\">");
out.print(" <input type=\"hidden\" name=\"" +
listTag.getParamPrefix() + listTag.getNextParam());
out.println("\" value=\"true\">");
} catch(IOException ioe) {
//Debug
System.out.println("NextFormTag: error printing <form> tag");
}
return(EVAL_BODY_INCLUDE);
}
Now, in a JSP file, I have
<mm:prevForm action='...'>
<td align="left"><input type="submit" value=="previous"/> ></td>
</mm:prevForm>
I need to pass a path <%=request.getContextPath()%>/jsp/quicksearchlist/page.jsp into the action. How can I do it right with the context path?
Thanks,
v.