On Sat, 2 Jun 2001, Bruno Antunes wrote:
> Hi. In previous releases of struts we have the tag <struts:parameter
> name="paramName"> that will render a request parameter, encoding special
> HTML characters.
>
> We can do this without a tag with (i am ignoring null pointer exception)
>
> <%= ResponseUtils.filter( request.getParameter("paramName")) %>
>
> Is this tag being removed from 1.0?
>
It sounds like you are still using the Struts 0.5 tags (from TLD file
/WEB-INF/struts.tld). You should be converting your programs to use the
1.0-compatible tag libraries (struts-bean.tld, struts-html.tld,
struts-logic.tld, and struts-template.tld).
The 1.0 approach to this requirement would be:
<bean:parameter id="bean" name="paramName" value="defaultvalue"/>
<bean:write name="bean"/>
Besides setting a default value (if the parameter is missing) as I did
above, you can also avoid null pointer exceptions by using logical
comparisons to detect the presence or absence of request parameters:
<logic:present parameter="paramName">
... The parameter is present ...
</logic:present>
<logic:notPresent parameter="paramName">
... The parameter is not present ...
</logic:notPresent>
> --
> Bruno Antunes,
> Java Software Engineer
>
Craig McClanahan