public Object formComponent(IFormVisitorParticipant formComponent) { FormComponent<?> component = (FormComponent<?>)formComponent; if (getParametersForNextRequest().containsKey(component.getInputName()) == false) { getParametersForNextRequest().put(component.getInputName(), new String[] { component.getDefaultModelObjectAsString() }); } return IVisitor.CONTINUE_TRAVERSAL; } });
/** * Set formComponent's value into request parameter, this method overwrites existing parameters. * * @param formComponent * a <code>FormComponent</code> * @param value * a value to add */ private void setFormComponentValue(FormComponent<?> formComponent, String value) { baseWicketTester.getParametersForNextRequest().put(formComponent.getInputName(), new String[] { value }); baseWicketTester.getServletRequest().setParameter(formComponent.getInputName(), value); }
getParametersForNextRequest().put(((FormComponent<?>)c).getInputName(), new String[] { value.toString() }); getParametersForNextRequest().put(c.getPath(), new String[] { value.toString() });
getParametersForNextRequest().put(((FormComponent)c).getInputName(), value); getParametersForNextRequest().put(c.getPath(), value);
@Override public void onFormComponent(FormComponent<?> formComponent) { /* * It is important to don't add every button input name as an request parameter to * respect the submit origin */ if (!(formComponent instanceof RadioGroup) && !(formComponent instanceof CheckGroup) && !(formComponent instanceof Button) && formComponent.isVisibleInHierarchy() && formComponent.isEnabledInHierarchy()) { if (!((formComponent instanceof IFormSubmittingComponent) && (component instanceof IFormSubmittingComponent)) || (component == formComponent)) { String name = formComponent.getInputName(); String value = formComponent.getValue(); // Set request parameter with the field value, but do not modify an existing // request parameter explicitly set using FormTester.setValue() if (!getServletRequest().getParameterMap().containsKey(name) && !getParametersForNextRequest().containsKey(name)) { getServletRequest().setParameter(name, value); getParametersForNextRequest().put(name, new String[] { value }); } } } } });
getParametersForNextRequest().put(pageRelativePath, "x"); submitForm(submitLink.getForm().getPageRelativePath());
getParametersForNextRequest().put(pageRelativePath, new String[] { "x" });