Most of the search form handlers have a requestAttributes property that is used to set the request attributes of the query. This property is a Map that stores each attribute name and its value as a key/value pair. When a JSP that includes a search form handler is loaded, the value of requestAttributes is set by reading in the site defaults from ATG Search. In the page, you can use DSP tags to modify the values of the Map entries for certain attributes, based on user input. When the query is submitted, the entire requestAttributes Map is included. Note, however, that you will typically want to modify the values of only a small subset of the possible attributes; for most attributes, the value submitted will be the same as the site default.

This JSP fragment from the sample application uses a variety of controls (text field, drop-down, checkbox) to set the values of a few of the request attributes:

<c:set var="formHandlerPath"
   value="/atg/search/query/formhandlers/SampleQueryFormHandler"/>

debug [0=8]:
<dspel:input type="text" id="debug"
  name="debug" bean="${formHandlerPath}.requestAttributes.debug" />

RQText:
<dspel:select bean="${formHandlerPath}.requestAttributes.RQText">
     <dspel:option value="question">question</dspel:option>
     <dspel:option value="sparsetree">answer</dspel:option>
   </dspel:select>

sorting:
<dspel:select bean="${formHandlerPath}.requestAttributes.sorting">
     <dspel:option value="score">score</dspel:option>
     <dspel:option value="document">document</dspel:option>
   </dspel:select>

docSetSort:
<dspel:select bean="${formHandlerPath}.requestAttributes.docSetSort">
     <dspel:option value="none">
      none
     </dspel:option>
     <dspel:option value="fulltree">
      fulltree
     </dspel:option>
     <dspel:option value="sparsetree">
      sparsetree
     </dspel:option>
   </dspel:select>

autospell:
<dspel:input type="checkbox"
  bean="${formHandlerPath}.requestAttributes.autospell"/>
Setting the relQuestSettings and responseNumberSettings Attributes

The request attributes for the <query> query type include two important attributes, relQuestSettings and responseNumberSettings, that each comprise many subattributes. In the requestAttributes Map, each of these attributes is stored as a single long String that encodes the values of all of the subattributes.

To simplify the setting of the subattributes, the QueryFormHandler has relQuestSettings and responseNumberSettings properties that correspond to these request attributes. Each of these properties is a Map that stores the subattributes as key/value pairs. When a JSP that includes a QueryFormHandler is loaded, the values in each Map are set by parsing the corresponding String. In the page, you can use DSP tags to modify the values of the Map entries for certain subattributes, based on user input. When the query is submitted, the Map is then used to recreate the entire String and the corresponding request attribute is set to the new String.

The following is an example of setting a responseNumberSettings attribute in a JSP:

responseNumberSettings.ans:
  <dspel:input type="text" bean="${formHandlerPath}.responseNumberSettings.ans"/>
 
loading table of contents...