The structuredStatements
property of the StructuredQueryFormHandler
is an array of StructuredStatement
objects. When the form handler submits a query, it uses each object in the array to create a separate <statement>
tag for the query. The attributes of the tag are set from the properties of the StructuredStatement
object.
In the JSP, you create the individual StructuredStatement
objects by setting the properties of each object through form fields. For example, the following page fragment creates a four-row table where each row represents an individual <statement>
tag:
<c:set var="formHandlerPath" value="/atg/search/query/formhandlers/SampleStructQueryFormHandler"/> <c:set var="tagname" value="structquery"/> <dspel:importbean var="formHandler" bean="${formHandlerPath}"/> <!-- StructuredStatement --> <table border="1" width="100%"> <tr bgcolor="LIGHTBLUE"> <td>name</td> <td>query text (body)</td> <td>op</td> <td>mode</td> <td>strategy</td> <td>weight (0-100)</td> <td>threshold (0-100)</td> <td>mutex</td> </tr> <c:forEach begin="0" end="3" var="index"> <tr> <td> <dspel:input type="text" bean="${formHandlerPath}.statement[${index}].name"/> </td> <td> <dspel:input type="text" bean="${formHandlerPath}.statement[${index}].queryText"/> </td> <td> <dspel:select bean="${formHandlerPath}.statement[${index}].op"> <dspel:option value="">default</dspel:option> <dspel:option value="required">required</dspel:option> <dspel:option value="negative">negative</dspel:option> <dspel:option value="optional">optional</dspel:option> </dspel:select> </td> <td> <dspel:select bean="${formHandlerPath}.statement[${index}].mode"> <dspel:option value="">default</dspel:option> <dspel:option value="required">nlp</dspel:option> <dspel:option value="negative">boolean</dspel:option> </dspel:select> </td> <td> <dspel:select bean="${formHandlerPath}.statement[${index}].strategy"> <dspel:option value="">default</dspel:option> <dspel:option value="normal">normal</dspel:option> <dspel:option value="everything">everything</dspel:option> <dspel:option value="expand">expand</dspel:option> <dspel:option value="restrict">restrict</dspel:option> <dspel:option value="exact">exact</dspel:option> </dspel:select> </td> <td> <dspel:input type="text" bean="${formHandlerPath}.statement[${index}].weight"/> </td> <td> <dspel:input type="text" bean="${formHandlerPath}.statement[${index}].threshold"/> </td> <td> <dspel:input type="checkbox" bean="${formHandlerPath}.statement[${index}].mutex"/> </td> </tr> </c:forEach> </table>