Ghoul
06-16-2005, 04:55 AM
Hi!
I'm developing custom tag. This tag is specialised form element. This tag must accept an attribute that is another tag. And the latter tag does not work at all. :(
The code of tag:
public class FormTag extends TagSupport {
// ***
/*
* Render the beginning of this form.
*
* @exception JspException if a JSP exception has occurred
*/
public int doStartTag() throws JspException {
String result = "";
result = "<form ";
result += "name=\"testForm\" ";
result += "method=\"post\" ";
if(action != null) {
result += " action=\"" + action + "\" ";
}
result += ">";
// Print this value to our output writer
JspWriter writer = pageContext.getOut();
try {
writer.println(result);
} catch(Exception e) {
throw new RuntimeException(e);
}
return (EVAL_BODY_INCLUDE);
}
// ***
}
The corresponding part of jsp:
<p:form action="<portlet:actionURL/>">
<input type="text" name="firstName" value="">
<br>
<input type="submit" value="Submit">
</p:form>
All taglibs are declared. And everything is OK if I use ordinary form element. But a strongly need that custom tag. :cool:
The source of resulting HTML is:
<form name="testForm" method="post" action="<portlet:actionURL/>" >
<input type="text" name="firstName" value="">
<br>
<input type="submit" value="Submit">
</form>
It looks like action attribute is not processed.
Any ideas? :confused:
Thanks
I'm developing custom tag. This tag is specialised form element. This tag must accept an attribute that is another tag. And the latter tag does not work at all. :(
The code of tag:
public class FormTag extends TagSupport {
// ***
/*
* Render the beginning of this form.
*
* @exception JspException if a JSP exception has occurred
*/
public int doStartTag() throws JspException {
String result = "";
result = "<form ";
result += "name=\"testForm\" ";
result += "method=\"post\" ";
if(action != null) {
result += " action=\"" + action + "\" ";
}
result += ">";
// Print this value to our output writer
JspWriter writer = pageContext.getOut();
try {
writer.println(result);
} catch(Exception e) {
throw new RuntimeException(e);
}
return (EVAL_BODY_INCLUDE);
}
// ***
}
The corresponding part of jsp:
<p:form action="<portlet:actionURL/>">
<input type="text" name="firstName" value="">
<br>
<input type="submit" value="Submit">
</p:form>
All taglibs are declared. And everything is OK if I use ordinary form element. But a strongly need that custom tag. :cool:
The source of resulting HTML is:
<form name="testForm" method="post" action="<portlet:actionURL/>" >
<input type="text" name="firstName" value="">
<br>
<input type="submit" value="Submit">
</form>
It looks like action attribute is not processed.
Any ideas? :confused:
Thanks