943,877 Members | Top Members by Rank

Ad:
  • JSP Discussion Thread
  • Marked Solved
  • Views: 2285
  • JSP RSS
Aug 1st, 2008
0

Using Beans in jsp....PLEASE HELP ME STUCK BADLY From 9 days

Expand Post »
Hi ,everybody i am trying to use beans in jsp.....but i am stucked in first step...
i have copied code from somewhere ......here beans uses a package .Beans is compiled successfully and called bean by this tag in jsp

<jsp:useBean id="MyConnectionBean" scope="session" class="UserPack.ConnectionBean"/>

Here UserPack is package of bean
now i placed this jsp and a folder Userpack containig ConnectionBean.class in Root of Tomcat 6.0
Now when running this jsp file from browser it shows some errors......
First time it shows these errors
----------------------------------------------------
org.apache.jasper.JasperException: org.apache.jasper.JasperException: /MainPage.jsp(9,0) The value for the useBean class attribute UserPack.ConnectionBean is invalid org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:565)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:354)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

org.apache.jasper.JasperException: /MainPage.jsp(9,0) The value for the useBean class attribute UserPack.ConnectionBean is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:406)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:147)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1200)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1155)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2392)
org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336)
org.apache.jasper.compiler.Generator.generate(Generator.java:3397)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:210)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:314)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.2 logs.

On refreshing the page it shows
----------------------------------------------------
org.apache.jasper.JasperException: org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to load class for JSP
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:565)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:354)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

org.apache.jasper.JasperException: org.apache.jasper.JasperException: Unable to load class for JSP
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:160)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:326)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

org.apache.jasper.JasperException: Unable to load class for JSP
org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:600)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:148)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:326)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

java.lang.ClassNotFoundException: org.apache.jsp.MainPage_jsp
java.net.URLClassLoader$1.run(Unknown Source)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(Unknown Source)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:598)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:148)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:326)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.2 logs.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Harsimran is offline Offline
1 posts
since Aug 2008
Aug 2nd, 2008
-1

Re: Using Beans in jsp....PLEASE HELP ME STUCK BADLY From 9 days

@now i placed this jsp and a folder Userpack containig ConnectionBean.class in Root of Tomcat 6.0

Wrong placement. Web project structure under Tomcat is as follows
PATH_TO_TOMCAT_FOLDER/webapps/YOUR_PROJECT_NAME/
  • *.html, *.jsp
  • can have folder img (for images) and css (for cascading style sheets)
  • WEB-INF
    • web.xml
    • lib - for all additional JAR files required by your project
    • classes
      • beans
Therefore you place your UserPack folder in place of beans folder and put that ConnectionBean inside that folder

More documentation can be found on Tomcat website
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 873
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004
Aug 7th, 2008
0

Re: Using Beans in jsp....PLEASE HELP ME STUCK BADLY From 9 days

hey dont put the beans folder...
instead put the folder naming same as ur package...

--classes
----|--package_name (folder)
--------|--class files
--------|--java files

try this it would definitly work..
Last edited by nikhildoomra; Aug 7th, 2008 at 4:24 am.
Reputation Points: 10
Solved Threads: 2
Newbie Poster
nikhildoomra is offline Offline
8 posts
since Aug 2008
Aug 7th, 2008
-1

Re: Using Beans in jsp....PLEASE HELP ME STUCK BADLY From 9 days

The name of the folder that holds Beans does not matter, it is by your preferences!
Leaving Java files in folder after server deployment is irresponsible of you...
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 873
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004
Aug 7th, 2008
0

Re: Using Beans in jsp....PLEASE HELP ME STUCK BADLY From 9 days

u r running on ur own server , i suppose not...
i think u r running it on local server, so dnt try to act smart...
that i mentioned at the time of compilation...
Reputation Points: 10
Solved Threads: 2
Newbie Poster
nikhildoomra is offline Offline
8 posts
since Aug 2008
Aug 7th, 2008
-1

Re: Using Beans in jsp....PLEASE HELP ME STUCK BADLY From 9 days

1) Start using proper English it is one of the forum rules
2) You did not mention anything, just went on rants that the poster should not put his content in bean folder
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 873
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004
Aug 7th, 2008
0

Re: Using Beans in jsp....PLEASE HELP ME STUCK BADLY From 9 days

i think i used proper english ...
if u didnt understand then go to primary school to learn english...
nd for ur kind information if u would do what i stated ... then u wont face ny problem...
Reputation Points: 10
Solved Threads: 2
Newbie Poster
nikhildoomra is offline Offline
8 posts
since Aug 2008
Aug 7th, 2008
-1

Re: Using Beans in jsp....PLEASE HELP ME STUCK BADLY From 9 days

Personal attacks on forum members are not tolerated
Sort your dictionary as there are no English words as u, nd, ur, ny, dnt, r but for sure you, and, your, any, don't, are
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 873
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004
Aug 7th, 2008
0

Re: Using Beans in jsp....PLEASE HELP ME STUCK BADLY From 9 days

just cut the crap off... these are short forms... there is sumthing named as voice... nd these short forms are based on voice.. so try to recognize the sounds.. i was just here to solve ur prob nt to argue with u...
instead of thanking u r arguing..
Reputation Points: 10
Solved Threads: 2
Newbie Poster
nikhildoomra is offline Offline
8 posts
since Aug 2008
Aug 7th, 2008
-1

Re: Using Beans in jsp....PLEASE HELP ME STUCK BADLY From 9 days

Please read the whole post. It was not my problem but other member's! I just provided solution.
Please read the forum rules
Quote ...
We strongly encourage all posts to be in full-sentence English. Please do not use "leet" speak or "chatroom" speak.
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 873
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JSP Forum Timeline: URL in address bar,didnt change but the view is correct
Next Thread in JSP Forum Timeline: updating daily news in a webpage





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC