0

i iterate a list of news on a page with two buttons there: edit and view,so i want to set news id to request scope to use it then in edit action, here is the form

<html:form action="NewsAction">
        <div class="news">
            <fieldset>
                <logic:iterate name="newsList" id="news">
                    <legend>
                        <bean:write name="news" property="newsTitle" />
                    </legend>
                    <p>
                        <bean:write name="news" property="newsId"/>
                        <bean:write name="news" property="newsTitle" />

                        <bean:write name="news" property="newsBrief" />
                        <bean:write name="news" property="newsDate" />
                    </p>


                    <html:submit property="method">view</html:submit>
                    <html:submit property="method" value="edit" />
                    <html:submit property="method">delete</html:submit>
                </logic:iterate>

            </fieldset>
        </div>
    </html:form>

i tried <html:hidden property="nnews" value="${news.newsId}" />
and

<jsp:setProperty property="newsId" name="news" param="newsInstanceId" />

using first one i got ${news.newsId} in request parameter, and using second null

DeadKennedy
  • 749
  • 3
  • 14
  • 22

2 Answers2

0

problem is seems to be solved: i declared in web.xml version 2.5 (it was 2.3)

<web-app 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="Your_WebApp_ID"
    version="2.5">

and added to @page isELIgnored="false"

DeadKennedy
  • 749
  • 3
  • 14
  • 22
-1

On your first approach:

Change this line:

<html:hidden property="nnews" value="${news.newsId}" />

To:

 <html:hidden property="nnews" value="<bean:write name="news" property="newsId"/>" />
Susie
  • 5,038
  • 10
  • 53
  • 74
  • got JasperException: equal symbol expected – DeadKennedy Aug 22 '13 at 22:02
  • You cannot nest JSP tags like that. – Dave Newton Aug 23 '13 at 16:15
  • @DaveNewton yes you can. I have done it in my current project. – Susie Aug 23 '13 at 16:35
  • 1
    @Susie Of course you can't; it's neither valid XML nor JSP. There's no double-evaluation of JSP. If you claim to have done it you're either wrong, or your app container is *very* broken and follows *no* reasonable servlet specification. Put a working example of this on github along with your app server info. – Dave Newton Aug 23 '13 at 16:46
  • @DaveNewton You are probably correct about our app container being broken. – Susie Aug 23 '13 at 19:24
  • Not only broken, but fantastically unusual in allowing clearly illegal, and borderline nonsensical, constructs. I'd move off of it as quickly as possible before something goes very, very wrong. I'm curious what container it is. – Dave Newton Aug 23 '13 at 19:25