This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
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
Brett B Doehr
Greenhorn
Joined: Jun 04, 2001
Posts: 11
posted
0
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.