Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Jstl setting name with c:out ends to null.

843840Sep 9 2010 — edited Sep 10 2010
Hello I am trying to set a name of a form input,a input type of text.If a post my form with a static name it will go to my servlet and be directed as defined.Though when I set my name on the text input to hold a jstl expression it ends with a null exception always.

I have valid data coming out in this form in display.


My page is using JSTL1.1 with a include
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 <c:forEach var="item" items="${requestScope.productsAdd}" varStatus="status">
                        #<c:out value="${status.count}" />
                            <tr>
                                <td> <c:out value="${item.category}" escapeXml="false"/></td>
                                <td> <c:out value="${item.product_code}" escapeXml="false"/></td>
                                <td> <c:out value="${item.product_description}" escapeXml="false"/></td>
                                <td> <c:out value="${item.price}" escapeXml="false"/></td>
                                <td> <td> <input type="text" size="5"  name="<c:out value='${item.product_code}'/>" /> </td>

                                <td class="centerChk">

                                </td>

                            </tr>

                        </c:forEach>

Here>  name="<c:out value='${item.product_code}'/>   is the culprit.
{code}

If if use say name="dukes" it will work.

Is there some escaping needed or should I use a different way?

Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 8 2010
Added on Sep 9 2010
2 comments
669 views