SIMPLEST servlet example please

Hi,
I was wondering if someone could post a java servlet example that accepts a string array (let's say we pass "A" and "B") and returns back a string array (let's say "1" and "2") without having to use a doGet or doPost. This would simply be passed as a value as one normally might, using a procedure or function.
Help on this is greatly appreciated. I am using this to access DB information, and already have the rest of the code finished, however I must implement this as a servlet.
Thanks...

Hello lafnjack,
A servlet is a kind of plugin-class that is connected to a HTTP-server to handle HTTP requests by interpreting the request itself and generating the response.
Therefore, a servlet is called through methods that are in parallel to the HTTP requests GET, POST and in some cases the other variants. Having said this, it should be obvious that a servlet has no more options for functioning than implementing doGet/doPost etc functions.
Silvio Bierman

Similar Messages

  • Am getting the following error while running the servlet example

    Hi,
    am getting the following error while running the servlet example
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    java.lang.NullPointerException
         edu.dao.StudentDao.insertStudent(StudentDao.java:18)
         edu.servlet.StudentServlet.doGet(StudentServlet.java:25)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.
    Thanks
    //sreekanth

    Hi,
    the following code i have written in StudentDao
    package edu.dao;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    import org.apache.commons.dbutils.DbUtils;
    import edu.model.Student;
    import edu.util.DBUtil;
    public class StudentDao {
         public void insertStudent(Student student) {
              String stuQuery = "INSERT INTO STUDENT VALUES(?,?)";
              Connection connection = DBUtil.getConnection();
              PreparedStatement preparedStatement = null;
              try {
                   preparedStatement = connection.prepareStatement(stuQuery);
                   preparedStatement.setString(1,student.getStudentNo());
                   preparedStatement.setString(2, student.getStudentName());
                   preparedStatement.executeUpdate();
              } catch(SQLException e){
                   System.out.println("..Sql exception......");
              }finally {
                   DbUtils.closeQuietly(connection,preparedStatement,null);
    }

  • J2EE tutorial (June 17 '04) servlet example compilation error

    This is a copy of my previous post on the same topic, but this one has a more self-desriptive subject line. Apologies for duplication.
    I am trying the first servlet example in the J2EE tutorial, June 17, 2004, pgs 443 - 448. I have completed all the steps as described. However, the URL results in the following error. I would like to point out that I am using the URL http://localhost:8081/bookstore1/bookstore (instead of port 8080 because the admin console suggests that port 8081 is an available http port):
    Assistance would be appreciated.
    HTTP Status 404 - /bookstore1/bookstore
    type Status report
    message /bookstore1/bookstore
    description The requested resource (/bookstore1/bookstore) is not available.
    Sun-Java-System/Application-Server-PE-8.0
    I looked at the logviewer and there are 3 severe errors in the log:
    1. Application Server
    Log Entry Detail
    Details
    Timestamp: Aug 6, 2004 14:36:28.375
    Log Level: SEVERE
    Logger: javax.enterprise.system.container.web
    Name-Value Pairs:
    _ThreadID=12;
    Record Number: 754
    Message ID: WebModule[bookstore1]Exception sending context initialized event to listener instance of class listeners.ContextListener java.lang.NoClassDefFoundError
    Complete Message
    exception/OrderException
    at listeners.ContextListener.contextInitialized(Unknown Source)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3679)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4140)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:873)
    at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:171)
    at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:193)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:855)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:623)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:947)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:729)
    at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:147)
    at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:224)
    at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:488)
    at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:475)
    at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:302)
    at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:107)
    at com.sun.enterprise.admin.server.core.mbean.config.ManagedServerInstance.multicastEvent(ManagedServerInstance.java:3880)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.sun.enterprise.admin.server.core.jmx.Introspector.invokeMethodOn(Introspector.java:181)
    at com.sun.enterprise.admin.server.core.mbean.config.AdminBase.invoke(AdminBase.java:86)
    at com.sun.enterprise.admin.server.core.mbean.config.ConfigMBeanBase.invoke(ConfigMBeanBase.java:680)
    at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:221)
    at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:228)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:823)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:792)
    at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:54)
    at $Proxy1.invoke(Unknown Source)
    at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:282)
    at com.sun.enterprise.deployment.phasing.DeploymentService.multicastEvent(DeploymentService.java:341)
    at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:284)
    at com.sun.enterprise.deployment.phasing.StartPhase.runPhase(StartPhase.java:115)
    at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:74)
    at com.sun.enterprise.deployment.phasing.DeploymentService.executePhases(DeploymentService.java:233)
    at com.sun.enterprise.deployment.phasing.DeploymentService.deploy(DeploymentService.java:150)
    at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.deploy(ApplicationsConfigMBean.java:275)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:287)
    at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:280)
    at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:221)
    at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:228)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:823)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:792)
    at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:54)
    at $Proxy1.invoke(Unknown Source)
    at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:282)
    at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:38)
    at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:92)
    at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:69)
    at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:94)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:768)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
    at sun.reflect.GeneratedMethodAccessor78.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:289)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
    at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:311)
    at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:205)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
    at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:102)
    at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:192)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:261)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:215)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:583)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:200)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:180)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:582)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
    at com.sun.enterprise.webservice.EjbWebServiceValve.invoke(EjbWebServiceValve.java:134)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
    at com.sun.enterprise.security.web.SingleSignOn.invoke(SingleSignOn.java:254)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
    at com.sun.enterprise.web.VirtualServerValve.invoke(VirtualServerValve.java:209)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:161)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
    at com.sun.enterprise.web.VirtualServerMappingValve.invoke(VirtualServerMappingValve.java:166)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:979)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:692)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:647)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:691)
    at java.lang.Thread.run(Thread.java:534)
    2. Application Server
    Log Entry Detail
    Details
    Timestamp: Aug 6, 2004 14:36:28.375
    Log Level: SEVERE
    Logger: tomcat.server./bookstore1.Context
    Name-Value Pairs:
    _ThreadID=12;
    Record Number: 755
    Message ID:
    Complete Message
    Error listenerStart
    3. Application Server
    Log Entry Detail
    Details
    Timestamp: Aug 6, 2004 14:36:28.375
    Log Level: SEVERE
    Logger: tomcat.server./bookstore1.Context
    Name-Value Pairs:
    _ThreadID=12;
    Record Number: 756
    Message ID:
    Complete Message
    Context startup failed due to previous errors

    I had the same problem. It was caused by not including \j2eetutorial14\examples\web\bookstore\dist\bookstore.jar in the bookstore1.war. You may need to build the bookstore.jar file first if you haven�t already.

  • XML example please

    hi,
    i've read lots of threads about storing data in xml file but all i saw was links to tutorials and some advices. Could somebody post at least a small example, please?
    And what i need to store in my xml file is data from several comboboxes and textfields.
    Thanx in advance.

    plz, provided xml using java standalone application source codes.

  • Clearing Rule example PLEASE!

    Hi guys: Below is my business situation.
    When I post an entry using F-04, I want to transfer the data in ref key 1 of the cleared item to the item that is being created as a residual item.
    I was thinking I could use Clearing Rules. Can someone please help me? Does anyone have an example please? Or is there any other way to do this?
    thanks
    Brian

    hi,
    You can map it through clearing rules. Clearing rules are used for automatic clearing. You specify whci all field should be considered for automatic clearing. For eg, PO number, referance field. etc if any match is found then it will clear.
    In you case you can try substitution.
    Thanks,
    Sujai C

  • Compiled Tomcat Servlet Example & got JAR, not WAR?

    Is there a basic reference on how to create a simple servlet with NetBeans 4.1 and deploy it to Tomcat?
    When I created the project I chose Samples->Web->Tomcat Servlet Example, and yet it does not create a WAR file on compilation.
    And of course once I'm past that I have to figure out how to edit the XML file, I gather.
    I need a reference that will hold me by the hand and walk me through it once to kick start me.
    After that I think I can make it without having to ask such newbie questions.

    Hi,
    not sure to what extent you are clear in build.xml file (done thru ant).
    what i can tell you is, ant creates any archive file (be it .jar, .war, .ear) with the tasks named "jar" (<jar jarfile="yourfilename.jar"..>), "war" and "ear". But both war and ear are the extensions of the jar only.
    You can achieve creation of any archive file with the jar task itself.
    you need to take care of the following...
    (1) you can /should edit the extension of the files at every stage.. first .jar and then .war and then .ear (if necessary) => basic flow
    (2) at every step, you have to have a file inclusion inside the corresponding archive file..
    say for example, for a .jar file you should include all the compiled .class files, and ejb-jar.xml (incase you use ejbs) and other built-in jar files....
    In case of .war files (web archive) you should include the web.xml file, any static files (html, jsp etc), any tld files - it goes with your application's nature and requirement.....
    fyi, i m including a sample build.xml file which i use for a webapplication, so it deals with war...
    <?xml version="1.0" encoding="UTF-8"?>
    <project name="ServletsReqDispFwd" default="deploy">
         <property name="top" value="."/>
         <property name="webinf" value="${top}/WEB-INF"/>
         <property name="lib" value="${webinf}/lib"></property>
         <property name="classes" value="WEB-INF/classes"/>
         <property name="jboss.dir" value="D:\jboss-3.2.2RC3\server\default\deploy"></property>
         <property name="tomcat.dir" value="D:\jakarta-tomcat-4.1.27\webapps"></property>
         <property name="warfile" value="ServletsReqDispFwd.war"></property>
         <property name="src" value="${top}/src"/>
         <property name="web.xml" value="WEB-INF/web.xml"/>
         <target name="package">
              <javac srcdir="${src}" destdir="${classes}"
                     listfiles="true" debug="true"  verbose="true"
                          classpath="${lib}/*.jar"/>
              <war warfile="${warfile}" webxml="${web.xml}">
                   <webinf dir="${top}">
                        <include name="**/*web*.xml"/>
                        <include name="**/*application*.xml"/>
                        <exclude name="src/**/*.xml"/>
                   </webinf>
                   <lib dir="${lib}">
                        <include name="*.jar"/>
                   </lib>
                   <fileset dir="." includes="**/*.html"/>                    
                   <classes dir="${classes}" includes="**/*.class"></classes>                         
              </war>
         </target>
         <target name="deploy" depends="clean,package">
              <copy file="${warfile}" todir="${tomcat.dir}" overwrite="true"></copy>
         </target>
         <target name="clean">
                <delete dir="${classes}">
                     <filename name="*.class"/>
              </delete>
              <delete>
                   <fileset dir="${top}" includes="${warfile}"/>
              </delete>
              <delete>
                   <fileset dir="${tomcat.dir}" includes="${warfile}"/>
              </delete>
         </target>
    </project>hope this contribues to a certain extent to help you edit the buildfile (xml file as you go) to meet your requirement.....

  • Should I use a servlet? - please help

    Hi,
    This is my problem:
    I have a class (say, DBClass) that connects to the database - it has general functions for insertion, updation, and deletion.
    I have some other classes that use the DBClass to perform insert, update, delete operations on different tables.(e.g., User.java is the class that uses DBClass to add users to the UserMaster table)
    Now, I have a JSP that has a form (to accept user information). Is it right in instaniate a User object in the jsp itself, and call the addUser method (which will use the 'insert' method in DBClass and add it to the database), or will it be right to post the data to a servlet, and do the whole thing there?
    Which is the right way to do it?
    Please help. I am new to the JSP technology..
    Thank you,
    sangita

    Hi sangita,
    It is always recommended that for insertion in the database, u should use a Servlet and for retrieval of data, u should use a Java bean. U can write a DBClass, where u will write one method for returning the database connection and another for closing the connection. These methods u can access from your servlet as well as your bean.
    Hope it will help. Let me know.
    atanu

  • Sample Servlet Project Please...

    Dear All,
    Can u please send me a sample code using JSP,SERVLET & JAVABEAN with DB Connection Code.
    with only one attribute called USERNAME.
    While submitting, it will have to store in the DB and Display the username in the another JSP.
    It will make me more sense & help me to understanding the concept.
    Please help me.
    Thanks in Advance.
    Regards,
    sprani.kmraj

    Help you to understand, or help you to get homework done without having to do anything? If you blatantly ask for code, you should describe it in a less questionable way.

  • Trouble compiling servlet example

    Hi All, I am trying out an example for servlets and I ran into trouble compiling the the file called "FormProcessingServlet.java" in tutorial located here: http://developer.java.sun.com/developer/onlineTraining/Servlets/Fundamentals/magercises/FormPostingAndProcessing/index.html
    The exact problem happens in this line:
    isStructure = context.getResourceAsStream(paramStructureFile[0]);
    The error says:
    FormProcessingServlet.java:127: cannot resolve symbol
    symbol : method getResourceAsStream (java.lang.String)
    location: interface javax.servlet.ServletContext
    isStructure = context.getResourceAsStream(paramStructureFile[0]);
    anyone else ran into this problem? How do I fix this? Thanks.

    "cannot resolve symbol" means that the JVM can't find a particular class.
    Adjust your systems classpath variable to include all the jar files that you use, I also add "." to include files in the current directory I'm working from.

  • JWSDP Tutorial - Servlet Example

    I am trying to run the bookstore example in the Servlet section of the JWSDP on Red Hat 7.3.I am also getting confused over ANT and the Tomcat Manager.
    I need to build the bookstore example and the instructions read: (for those who know the tutorial)
    1. In a terminal window, go to /docs/tutorial/examples/web/bookstore1
    2. Run ant build - The build target will spawn any necessary compilations and copy files to the docs/tutorial/examples/web/bookstore1/build directory.
    3. Make sure Tomcat is started.
    4. Run ant install - The install target notifies Tomcat that the new context is available.
    5. Start the Pointbase database server and populate the database if you have not done so already
    6. Open the bookstore URL http://localhost:8080/bookstore1/enter
    On the command line I can run ANT BUILD fine, but ANT INSTALL fails. (It also fails in Tomcat Manager...but not sure whether I can use this instead of ANT INSTALL?)
    I know this is sketchy but does anyone have any idea?
    Regards
    Scott

    Hi Scott,
    Thank you any way.
    Last time, I met it and carried the tutorial on by compiling and copying manually. Then, I came back to set the ant.jar into path&classpath, and it worked.(ant build)
    Today, I'm trying on "hello1" example, but can't get though.
    Maybe it's still classpath and path issue, as I can't compile two servlet classes by javac from command line, but from Forte, it passed.
    Cheers!
    Zhan

  • Servlet Example

    Sir,
    Based on bug 7313163; the documentation example http://youngcow.net/doc/oracle10g/appdev.102/b14259/xdb23jv1.htm#i1045379 is for a non-existing feature.
    Thread Re: javax.naming.* classes don't work inside the database to load XMLDB doc talks about this.
    Mark Drake said: "demo that shows how to write some JNDI wrappers over JDBC to get some (not all) of the JNDI methods working", I need this example plz.
    Islam.

    Please download the latest version of the XFiles demo from the XML DB page on OTN.

  • JSP and Servlet - help please

    Hello,
    I am making this feedback for fun and a bit of learning too. I have an INDEX.JSP page, where the user selects the very first option. Depending upon the selected option he is moved another page PRODUCTFEEDBACK.JSP (so far I have completed this). Here as usual there are many fields to be filled in. As a spams protection i have done this;
    I have a AdditionClass, which is a seperate class where two number are generated at random. This numbers are called by PRODUCTFEEDBACK.JSP. The user is then asked to perform the addition. The completed form is then sent to ProductFeedback servlet.
    When I compile my PRODUCTFEEDBACK.JSP I get this error. Can you please tell whats wrong?
    PRODUCTFEEDBACK.JSP
          *<td>Please help us to prevent Spams by performing this simple mathematical Calculation. We appreciate your effort </td>*
        *</tr>*
      *</table>*
      *<jsp:useBean id = "AddTest" class = "go.AdditionClass" />*
      *<table width="53%"  border="0" align="center">*
        *<tr>*
          *<td><div align="center">*
      *<input name="textfield8" type="text" size="3" value ="<jsp:getProperty name="AddTest" property = "randNum1" />">*
    *  + * 
      *<input name="textfield9" type="text" size="3" value="<jsp:getProperty name="AddTest" property = "randNum2" />">*
    *  = *
    *<input name="_total" type="text" size="5">*
          </div></td>
        </tr>
        <tr>
          <td> </td>
        </tr>
      </table>
      <br>
      <table width="37%" height="23"  border="0" align="center">
        <tr>
          <td width="33%"> </td>
          <td width="67%"><input type="submit" name="Submit" value="Click here to send us this form"></td>
    AdditionalClass.java
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package go;
    import java.util.Random;
    * @author MAC
    public class AdditionClass {
        Random generator = new Random();
        int randNum1; // First Random Number
        int randNum2; // Second Random Number
        public void SetNum1(){
            randNum1 = generator.nextInt(10); // Generate First Random Number
        public int getNum1(){
            return randNum1; //Return First Random Number
        public void SetNum2(){
            randNum2 = generator.nextInt(10); // Generate Second Random Number
        public int getNum2(){
            return randNum2; // Return Second Random Number
        // send the Random Numbers to ProductFeedback class
        public void productFeedbackRandNum1(){
            ProductFeedback productfeedback = new ProductFeedback();
            productfeedback.randomNumber1(randNum1);
        public void productFeedbackRandomNum2(){
            ProductFeedback productfeedback = new ProductFeedback();
            productfeedback.randomNumber2(randNum1);
    }Erros that I am getting:
    org.apache.jasper.JasperException: Cannot find any information on property 'randNum1' in a bean of type 'go.AdditionClass'
    C:\Documents and Settings\MAC\My Documents\NetBeansProjects\FeedBack\nbproject\build-impl.xml:462: The following error occurred while executing this line:
    C:\Documents and Settings\MAC\My Documents\NetBeansProjects\FeedBack\nbproject\build-impl.xml:440: Java returned: 1
    BUILD FAILED (total time: 1 second)

    Thank you for replying. I modified my Bean class then what is posted above, so thought to repost the code again and seek help. There seems to be no error now but it just dont generate any random numbers, All i get very time is 0. I am wondering, is my code generating 0 as random number, every time :-)
    package go;
    import java.util.Random;
    public class AdditionBean {
        int randNum1; // First Random Number
        int randNum2; // Second Random Number
        public void generateRandomNum1(){
            Random generator = new Random();
            int num1 = generator.nextInt(10);
            SetRandNum1(num1);
            // Send num1 value to ProductFeedback.java
            ProductFeedback productfeedback = new ProductFeedback();
            productfeedback.randomNumber1(num1);
        } // End of generaeRandomNum1
        public void generateRandomNum2(){
            Random generator = new Random();
            generator = new Random();
            int num2 = generator.nextInt(10);
            SetRandNum2(num2);
            // Send num1 value to ProductFeedback.java
            ProductFeedback productfeedback = new ProductFeedback();
            productfeedback.randomNumber2(num2);
        } // End of generateRandomNum2
        public void SetRandNum1(int num1){
            randNum1 = num1;
        public int getRandNum1(){
            return randNum1; //Return First Random Number
        public void SetRandNum2(int num2){
            randNum2 = num2;
        public int getRandNum2(){
            return randNum2; // Return Second Random Number
    }// End of classThank you,

  • Stateless Session EJB Bean Example please

    Dear Friends,
    Develop a stateless session EJB bean and deploy it in WebLogic 8.1
    Please proivde me a weblogic8.1 example along with the deployment steps.
    Also mention the supporting softwares needed.
    I have weblogic 8.1, JDK 1.5
    Advance Thanks.
    Rengaraj.R

    Hi Rahul,
    Please paste the files here if they are small in size.
    IDfLoginInfo li = new DfLoginInfo(); //this is where the error occurs as when i remove this line. i dont get an error
    Have you checked this as I have mentioned something regarding this in my mail?
    Regards
    Vicky

  • Dde server examples please

    could any of you helpful folks who have example code communicating with the dde server of another application please post some 'generic' example code here? (or any related tips) -6.0.2-
    Thanks, Paul.S

    Have you looked here and at the Access DDE example that ships with LabVIEW?

  • Need an example, Please

    Hi
    i have to implement an neural network. but unfortunately i have no idea how to implement or how to start implementing it.
    if anyone can please tell me how to start or send me a simple example of implementing any simple neural network or any evolutionary algorithm. it will be a great help.
    with regards Sarmad

    Hi
    i have to implement an neural network. but
    unfortunately i have no idea how to implement or how
    to start implementing it.
    if anyone can please tell me how to start or send me
    a simple example of implementing any simple neural
    network or any evolutionary algorithm. it will be a
    great help.
    with regards Sarmadyou just don't have the right API
    it's not OpenSource and you can't get it for free
    it will cost you lots of money and you can't use it yourself
    the oligarchs are the only ones that know about it. and how to use it

Maybe you are looking for