JSP syntax error

Hello

Why does this not work ? :

<html:hidden property="userId" value="<%= request.getAttribute("reference") %>"/>


I have the folowing error :
The attribute reference has no value.   org.apache.jasper.compiler.ParseException


Tough if I comment the line and I try this it returns the correct value.:
<%   System.err.println(request.getAttribute("reference"));    %>


Thank you.
LVL 9
matthew016Asked:
Who is Participating?
 
TimYatesCommented:
Just to check, does this work:

<% v = request.getAttribute("reference") ; %>
<html:hidden property="userId" value="<%= v %>"/>

?
0
 
matthew016Author Commented:
I changed to this :

      <% String ref = (String) request.getAttribute("reference") ; %>
      <html:hidden property="userId" value="<%= ref %>"/>

It works now ....

Any explanation ?
0
 
TimYatesCommented:
it could be a problem with double quotes in the attribute ( value=" ) and the request call ( Attribute(" )

See this thread here:

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg20489.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.