[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 543
  • Last Modified:

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.
0
matthew016
Asked:
matthew016
  • 2
1 Solution
 
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now