This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes custom tag SetProperty: Mandatory attribute property missing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "custom tag SetProperty: Mandatory attribute property missing" Watch "custom tag SetProperty: Mandatory attribute property missing" New topic
Author

custom tag SetProperty: Mandatory attribute property missing

Charessa Reilly
Ranch Hand

Joined: May 26, 2011
Posts: 39
Ok, first some code. Here's the contents of my displayCollection.tag:


Here's the JSP I'm calling it from (myq.jsp):


Here's the java class for irCollection (used in the tag file):


And finally, here's the error I get when i try to run myq.jsp:
org.apache.jasper.JasperException: /WEB-INF/tags/displayCollection.tag(7,2) SetProperty: Mandatory attribute property missing
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:198)
org.apache.jasper.compiler.JspUtil.checkAttributes(JspUtil.java:174)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:595)
org.apache.jasper.compiler.Node$SetProperty.accept(Node.java:1150)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:647)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1182)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434)
org.apache.jasper.compiler.Node$Root.accept(Node.java:475)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1789)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:216)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:372)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:352)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:339)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
org.apache.jasper.servlet.JspServletWrapper.loadTagFile(JspServletWrapper.java:231)
org.apache.jasper.compiler.TagFileProcessor.loadTagFile(TagFileProcessor.java:577)
org.apache.jasper.compiler.TagFileProcessor.access$000(TagFileProcessor.java:48)
org.apache.jasper.compiler.TagFileProcessor$TagFileLoaderVisitor.visit(TagFileProcessor.java:642)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1539)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434)
org.apache.jasper.compiler.Node$Root.accept(Node.java:475)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
org.apache.jasper.compiler.TagFileProcessor.loadTagFiles(TagFileProcessor.java:660)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:228)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:372)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:352)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:339)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:344)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


as far as I can tell, the attribute mgr is set in myq.jsp when it invokes displayCollection.tag, and displayCOllection.tag's only attribute (required) is mgr. so uhm... what do I misunderstand?
Charessa Reilly
Ranch Hand

Joined: May 26, 2011
Posts: 39
edited to correct a typo i made during code copy/paste
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

I'd say the error is pretty clear. You omitted a required attribute.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Charessa Reilly
Ranch Hand

Joined: May 26, 2011
Posts: 39
yes, but, WHAT attribute? There's only one attribute in the tag "mgr" and I set that, didn't I?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

It's not complaining about your tag, but the setProperty tag on line 7. Actually read the error message:

org.apache.jasper.JasperException: /WEB-INF/tags/displayCollection.tag(7,2) SetProperty: Mandatory attribute property missing

Mike Zal
Ranch Hand

Joined: May 04, 2011
Posts: 144

The setProperty tag has three attributes

1) name: value that matches the id of the useBean tag
2) property: the name of the bean's property to set
3) value: the value to set

You combined the name and property value into one attribute. It does not like when you do that.


OCJP6, OCWCD5
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

P.S. I'd recommend following established conventions and starting class name with a capital letter.
Charessa Reilly
Ranch Hand

Joined: May 26, 2011
Posts: 39
thanks, Mike. I knew it would be newbie, but I didn't know where I was falling.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: custom tag SetProperty: Mandatory attribute property missing