Tom Bednarz wrote:
I use a form derived from ValidatorActionForm.

If the validator fires a message and redisplays the form, I loose my request params!

I do:

<html:link action="/insertExpense.do?op=new" styleClass="button">

this actions opens a form with a request parameter op set to new.

inside this form I do something like:

    <html:form action="/editExpense" method="post" focus="expenseType">
        <c:if test="${requestScope.op == 'new'}">
            <html:hidden name="op" property="op" value="insert"/>
        </c:if>
        <c:if test="${requestScope.op == 'insert'}">
            <html:hidden name="op" property="op" value="insert"/>
        </c:if>
        <c:if test="${requestScope.op == 'update'}">
                <html:hidden name="op" property="op" value="update"/>
        </c:if>
.....

If the user enters garbage in any field that is validated the form is redisplayed with an error message on the right side of the field.

BUT THE ${requestScope.op} is empty and therefore this information is LOST!! Any idea what I am doing wrong???

I would guess it has to do with how you're setting up the 'op' hidden input. you have name="op" property="op" value="..." which is telling Struts to use the 'op' property of a bean named 'op' in some scope. What does the generated HTML look like?

I would suggest:

a) move the hidden input outside the c:if tests, and just set it unconditionally; b) simplify the html:hidden, or maybe use vanilla HTML instead of the custom action, since you don't need the extra functionality provided by html:hidden in this case.

The result would look like one of:

    <html:hidden name="op" value="${requestScope.op}"/>
    <input type="hidden" name="op" value="${requestScope.op}" />

HTH,

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to