• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsp useBean tag

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
iam having a problem with jsp useBean tag.
is the synax <jsp:useBean.. >
</jsp:useBean>
or just <jsp:useBean.... />
i mean which is the correct way of closing
and also is it compulsory to put all set and get propery tags
between the opening and closing useBean tags.
recently when iam trying with jrun it gave me an error when iam
trying to instantiate a bean class through this tag. i've kept the jsp file in the default web application directory and the class file in web-inf/clases folder.
the following is the error iam getting
500 Internal Server Error
/hellouser.jsp:
javax.servlet.ServletException: Compilation error occured:
Found 1 errors in JSP file:
C:\\Program Files\\Allaire\\JRun\\servers\\default\\default-app\\hellouser.jsp:49: Syntax: ";" inserted to complete LocalVariableDeclarationStatement
allaire.jrun.scripting.DefaultCFE:
Errors reported by compiler:C:/Program Files/Allaire/JRun/servers/default/default-app/WEB-INF/jsp/jrun__hellouser2ejspe.java:62:1:62:29: Syntax: ";" inserted to complete LocalVariableDeclarationStatement
at allaire.jrun.scripting.JavaCompilerService.compile(../scripting/JavaCompilerService.java:122)
at allaire.jrun.jsp.JSPServlet.compilePage(../jsp/JSPServlet.java:458)
at allaire.jrun.jsp.JSPServlet.createServlet(../jsp/JSPServlet.java:399)
at allaire.jrun.jsp.JSPServlet.loadPage(../jsp/JSPServlet.java:202)
at allaire.jrun.jsp.JSPServlet.service(../jsp/JSPServlet.java:169)
at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1013)
at allaire.jrun.servlet.JRunSE.runServlet(../servlet/JRunSE.java:925)
at allaire.jrun.servlet.JRunRequestDispatcher.forward(../servlet/JRunRequestDispatcher.java:88)
at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1131)
at allaire.jrun.servlet.JvmContext.dispatch(../servlet/JvmContext.java:330)
at allaire.jrun.http.WebEndpoint.run(../http/WebEndpoint.java:107)
at allaire.jrun.ThreadPool.run(../ThreadPool.java:272)
at allaire.jrun.WorkerThread.run(../WorkerThread.java:75)
can somebody tell me where is the problem
thanks

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Either syntax should work. The syntax I normally use is:
<jsp:useBean class="FooBean" id="foo" scope="session">
</jsp:useBean>
However, the other syntax will also work:
<jsp:useBean class="FooBean" id="foo" scope="session" />
As far as the set and get property tags, put them between
the useBean tags if you want them to execute only when the
bean is first instantiated. If the bean is reused, either
on that page or another one, any set or get property tags
will be ignored. For good general info on useBean, go to:
http://developer.java.sun.com/developer/onlineTraining/JSPIntro/contents.html#JSPIntro11
It's hard to be sure what's causing your error without seeing
the line of code it referenced. My guess it that you have a
declaration statement without a semi-colon at the end:
<%! int i=0 %> instead of <%! int i=0; %>
--Brett.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic