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)