lundi 25 mai 2020

Get value from JSP textbox to a jsp variable on same page

I have a newbie question. On my jsp page, I have currently a TextArea filled with a value. I do not need that TextArea but I need its content to handle it inside a 'if' statement. Seems simple, yet for me I can't figure it out. I tried to set the value with < c : set ...." ,but the problem is it seems not have a link to the content.

What if have :

<tr>
            <td><bean:message key="systematiccontrol.search.status" /></td>
            <td>
                <textarea id="OverruleStatusField" name="status" rows="2" cols="60"></textarea>                 
            </td>
        </tr>

This actualy shows the correct status in the textarea ('AUTO_PROCESSED'), but I want this in a var, I don't want the textarea. What I tried (but does not work) :

<tr>
            <td><bean:message key="systematiccontrol.search.status" /></td>
            <td>

                <c:set var="status" scope="session" value="status"/>
                <p>${status}</p>
                <c:if test="${status=='AUTO_PROCESSED'}"> <p>Auto</p> </c:if>
                <c:if test="${status!='AUTO_PROCESSED'}"> <p>${status}Not Auto</p> 
            </td>
        </tr>

Main problem is I can't figure out how to access my session variable set by the java backend.

Extra info, not sure if you need it : The statusvalues are coming from an enum. When I code :

<c:set var="systematicControlStatus" scope="request" value="${sessionScope.systematiccontrolstates}"/>
<p>look ${systematicControlStatus}</p>

I get a array list with all the possible values in the enum.

Hope someone can help

Aucun commentaire:

Enregistrer un commentaire