Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can property be given as * in jsp:getProperty

 
Anoopriya Muthuswaami
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me what happens for the following code

<jsp:getProperty name="beanName" property="*"/>

Will it give translation error that it cannot find getter method with *?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Anoop",
Welcome to the ranch. It seems that you did not read the Naming Policy[/url] properly the last time you were warned. Please read it carefully and change your name accordingly (you need to set both first and last names). Thank you.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will it give translation error that it cannot find getter method with *?

No. The container sets whatever it can. If it does not find a setter corresponding to a request parameter name, it ignores it.
 
Anoopriya Muthuswaami
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Christophe Verre:

No. The container sets whatever it can. If it does not find a setter corresponding to a request parameter name, it ignores it.


I tried by giving * in getProperty. It threw the following error

org.apache.jasper.JasperException: Cannot find any information on property '*' in a bean of type 'example.Person'
org.apache.jasper.runtime.JspRuntimeLibrary.getReadMethod(JspRuntimeLibrary.java:836)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1015)
org.apache.jasper.compiler.Node$GetProperty.accept(Node.java:1063)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2222)
org.apache.jasper.compiler.Node$Root.accept(Node.java:457)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
org.apache.jasper.compiler.Generator.generate(Generator.java:3324)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Anoo, I misread getProperty with setProperty. You cannot use "*" with getProperty.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic