We help IT Professionals succeed at work.

JSP syntax error

matthew016
matthew016 asked
on
559 Views
Last Modified: 2013-11-24
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.
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2004
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
I changed to this :

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

It works now ....

Any explanation ?
CERTIFIED EXPERT
Top Expert 2004

Commented:
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
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.