GeeCON Prague 2014*
The moose likes Servlets and the fly likes JSP and class paths in Websphere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP and class paths in Websphere" Watch "JSP and class paths in Websphere" New topic
Author

JSP and class paths in Websphere

Neha Sharma
Ranch Hand

Joined: Jul 13, 2001
Posts: 126
Hi,
I'm using a bean(SpellCheck)in my JSP(SpellPro.jsp). I've kept the bean class in the 'servlets' direstory and jsp in the 'web' directory of my web application direstory. In the JSP I've written Class = "SpellCheck"
It is giving a error
unhandeled error:
"com.sun.jspException unable to compile Class for JSP"
Can anybody help me with how where should I put the bean class, paths etc.
Thanks
Neha
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
Actually I�m working with WebLogic but I think you shoul�d try to use class=... lower case.
Neha Sharma
Ranch Hand

Joined: Jul 13, 2001
Posts: 126
No that's not working Marcos. I need to know is there anything I need to do other than putting the .JSP file in the web folder and .class files in the servlets folder and then adding the jsp in the web application.
Thanks
Neha
Julio Lopez
Greenhorn

Joined: Nov 14, 2000
Posts: 28
> Can anybody help me with how where should I put the bean class, paths etc.
It seems that you have put everything in the right place. JSP's in the web directory, Servlets and JavaBeans in the servlets directory.
Just some thoughts,
Is SpellCheck inside a package, if it is you will need to state this in the useBean tag.
<jsp:useBean id="spellCheck" type="packageA.SpellCheck" scope="request">

</jsp:useBean>

Make sure that the servlet directory is in the classpath for your web application.
i.e.
c:\WebSphere\AppServer\hosts\default_host\webapp\servlets
I really can't diagnose the problem without more detail.
Julio Lopez
M-Group Systems
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
Hey,
Neha Sharma
If you want you may send me the code for your application than I�ll pachage it in a war file and will test it in WebLogic as soon as I have it working I�ll send to you.
mmaia@linkexpress.com.br
Neha Sharma
Ranch Hand

Joined: Jul 13, 2001
Posts: 126
Hi Julio/Marcos,
Thanks for your help here.
Let me give you all the files I'm using here.
See I have my .JSP(wordpro.jsp) and HTML(spelling.html) files in
C:\websphere\appserver\hosts\default_host\itsoservjsp\web
and I have my .class file for the bean in
C:\websphere\appserver\hosts\default_host\itsoservjsp\servlets directory
Julio I'm writing as well as mailing you the files.
Thanks
---------------------------------------------
JSP file(wordpro.jsp)
<jsp:useBean id="help" scope="session" class="SpellCheck" />
<jsp:setProperty name="help" property="*"/>
<html>
<body>You entered the input, <b> <%= request.getParameter("word") %></b><br>
The processed output is :<br>
<%= Integer.parseInt(request.getParameter("mode"))==1 ? help.reverse() :""+help.check() %>
</body>
</html>
-----------------------------------------------------------------
HTML file(spelling.html)
<HTML>
<HEAD>
<TITLE> Untitled Document</TITLE>
<Body>
<form action = "wordpro.jsp" method = "POST">
Enter word :
<Input type = "text" name = "word">
<select name = "Mode">
<option value = "1" selected>Reverse</option>
<option value = "2" > SpellCheck</option>
</select>
<input type="submit" name= "Go" value = "Submit">
</form>
</HEAD>
</HTML>
----------------------------------------------------------------
bean file SpellCheck.java
/**
* This bean encapsulates the functionality to spell check a String
*/
public class SpellCheck {
private String word;
public SpellCheck() {}
/**
Method to reverse the string uses
@return the reversed String
*/
public String reverse() {
return (new StringBuffer(word).reverse()).toString();
}
/**
Checks the spelling of the word.This method has no body, and just
returns true for the example
@return boolean, true if the spelling is right
*/
public boolean check() {
return true;
}

/**
* Access method for the word property.
*
* @return the current value of the word property
*/
public String getWord() {
return word;
}
/**
* Sets the value of the word property.
*
* @param aWord the new value of the word property
*/
public void setWord(String aWord) {
word = aWord;
}
}

----------------------------------------------------------------
Error I'm getting

Unhandled error! You might want to consider having an error page to report such errors more gracefully
com.sun.jsp.JspException: Compilation failed
at javax.servlet.ServletException.(ServletException.java:49)
at com.sun.jsp.JspException.(JspException.java:29)
at com.sun.jsp.compiler.Main.compile(Main.java:347)
at com.sun.jsp.runtime.JspLoader.compile(JspLoader.java:86)
at com.sun.jsp.runtime.JspLoader.loadJSP(JspLoader.java:210)
at com.sun.jsp.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:126)
at com.sun.jsp.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:137)
at com.sun.jsp.runtime.JspServlet.serviceJspFile(JspServlet.java:505)
at com.sun.jsp.runtime.JspServlet.service(JspServlet.java:615)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:639)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:580)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:160)
at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:287)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:105)
at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:353)
at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:729)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:655)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebApp.java:1269)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebApp.java:1106)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebApp.java:1039)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebGroup.java:646)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:155)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:300)
at com.ibm.servlet.engine.oselistener.SQEventListenerImp$ServiceRunnable.run(SQEventListenerImp.java:230)
at com.ibm.servlet.engine.oselistener.SQEventListenerImp.notifySQEvent(SQEventListenerImp.java:104)
at com.ibm.servlet.engine.oselistener.serverqueue.SQEventSource.notifyEvent(SQEventSource.java:202)
at com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRunnable.notifyService(SQWrapperEventSource.java:347)
at com.ibm.servlet.engine.oselistener.serverqueue.SQWrapperEventSource$SelectRunnable.run(SQWrapperEventSource.java:216)
at com.ibm.servlet.engine.oselistener.outofproc.OutOfProcThread$CtlRunnable.run(OutOfProcThread.java:248)
at java.lang.Thread.run(Thread.java:481)
 
GeeCON Prague 2014
 
subject: JSP and class paths in Websphere