Compilation error in java for struts application.

Hello,
I'm a newbie in java and struts, i was trying a simple struts application given in "struts complete reference".This is my code of its Controller class(Action class):-
package com.jamesholmes.struts;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public final class SearchAction extends Action
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws Exception
EmployeeSearchService service = new EmployeeSearchService();
ArrayList results;
SearchForm searchForm = (SearchForm) form;
//Perform employee search based on what criteria was entered.
String name = searchForm.getName();
if(name != null && name.trim().length() > 0)
results = service.searchByName(name);
else
results = service.searchBySsNum(searchForm.getSsNum().trim());
//place search results in SearchForm for access by jsp.
searchForm.setResults(results);
//Forward control to this Action's input page.
return mapping.getInputForward();
Now problem is when i'm compiling this java file i'm getting error"can not resolve symbol" for the instances i'm creating for SearchForm(view class) and EmployeeSearchService(model class).can any one help me how to resolve this error. I've tried importing those classes explicitly also, but error gets increased this way.

Tht problem is solved, it was a mistake frm my side in compilation precedure.Anyway, now the real error-After i compiled and created the war file of application, i was running it in tomcat and got this Error, it is i guess a server sprcific error which i am unable to understand., can any one now help me solving this out?????Error is this :-
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException
     org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:521)
     org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:436)
     org.apache.struts.taglib.html.LinkTag.calculateURL(LinkTag.java:495)
     org.apache.struts.taglib.html.LinkTag.doStartTag(LinkTag.java:353)
     org.apache.jsp.index_jsp._jspx_meth_html_link_0(index_jsp.java:96)
     org.apache.jsp.index_jsp._jspService(index_jsp.java:69)
     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.27 logs.
Apache Tomcat/5.0.27

Similar Messages

  • Compile Error in Enhanced For Loop

    I'm learning generic collections and for practice wrote a simple class that uses a HashMap to store data. However, I'm getting a compile error for the code that accesses the HashMap. The error and code for my class follow.
    Can anyone help?
    Thanks...
    =====================
    The compile error:
    =====================
    MapDict.java:37: package Map does not exist for( Map.Entry entry : glossary.entrySet()  )                        ^1 error=======================
    The code for my class:
    =======================
    import java.util.Scanner;
    import java.util.HashMap;
    public class MapDict
         HashMap<String, String> glossary = new HashMap<String, String>();
         public void getEntries()
              Scanner sc = new Scanner( System.in ).useDelimiter("\n");
              String moreEntries = "y";
              String word        = "";
              String definition  = "";
              while ( moreEntries.toUpperCase().equals( "Y") )
                   System.out.print("Enter word: ");
                   word = sc.next();
                   System.out.print("Enter definition: ");
                   definition = sc.next();
                   glossary.put( word, definition);
                   System.out.print("Another glossary item? (y/n) ");
                   moreEntries = sc.next();
         public void displayEntries()
              System.out.println( glossary.size() );
              // Here is where the compile error occurs:
              for( Map.Entry entry : glossary.entrySet()  )
                   System.out.println( "\nWord: " + entry.getKey() + " Definition: " + entry.getValue() );
    }

    import java.util.Scanner;
    import java.util.HashMap;I don't see java.util.Map or java.util.Map.Entry listed here....

  • Compiling error on Java I/O

    My first time to write a very simple Java progam. Any one could help me on this comipling error? Thanks in advance!
    Compiling ERROR:
    ================
    C:\java\class>javac hw01.java
    hw01.java:43: cannot resolve symbol
    symbol : variable in
    location: class hw01
    while((line = in.readLine()) != null ) {
    ^
    1 error
    SOURCE CODE:
    ============
    *     Program name: hw01.java
    *     Author:
    *     Description: Simple I/O and computation
    *     Date: 12/08/2002
    *     compile: javac hw01.java
    *     usage: java hw01 <infile> <utfile>
    *     <infile> - input file
    *     operator operand1 operand2
    *          ex. + 1 1
    * <outfile> - output file
    * operand1 operator operand2 = result
    *          ex. 1 + 1 = 2
    import java.io.*;
    import java.util.*;
    public class hw01 {
         // Open input file and output file
         public static void main(String[] args) throws IOException {
              if (args.length == 2) {
                   // Open File for Reading
                   File inFile = new File(args[0]);
                   FileReader in = new FileReader(inFile);
                   // Open File for Writing
                   File outFile = new File(args[1]);
                   FileWriter out = new FileWriter(outFile);
              } else {
                   System.out.println("java command <arg1> <arg2>");
              // Get operation, operand1 and operand2 for each line
              String line = null;
              while((line = in.readLine()) != null ) {
                   //String op; String op1; String op2; String result;
                   // Get operation and operands
                   //stringTokenizer t = new StringTokenizer(line);
                   //op = t.nextToken().charAt(0);
                   //op1 = Integer.valueOf(t.nextToken()).intValue();
                   //op2 = Integer.valueOf(t.nextToken()).intValue();
                   // Compute math operation
                   //if( op == '+' ) {
                   //     result = op1 + op2;
                   // } else if( op == '-' ) {
                   //     result = op1 - op2;
                   //} else if( op == '*' ) {
                   //     result = op1 * op2;
                   //} else if( op == '/' ) {
                   //     result = op1 / op2;
                   // Print out the result
                   //system.out.println(op1 + op + op2 + "=" + result);
              // Close infile
              // in.close();
              // System.out.println("");
              // Close outFile
              // out.close();

    The compiling error is fixed. The revised working source code hw01.java is provided below. Can someone help the remining question below?
    PROBLEM/Question:
    =================
    The output only goes to the console. How code should be changed to allow output to a specified file from command line.
    SOURCE FILE (without Compiling error):
    =====================================
    *     Program name: hw01.java
    *     Author:
    *     Description: Simple I/O and computation
    *     Date: 12/08/2002
    *     compile: javac hw01.java
    *     usage: java hw01 <infile> <utfile>
    * example: java hw01 hw1data.txt hw1out.txt
    *     <infile> - input file
    *     operator operand1 operand2
    *          ex. + 1 1
    * <outfile> - output file
    * operand1 operator operand2 = result
    *          ex. 1 + 1 = 2
    import java.io.*;
    import java.util.*;
    public class hw01 {
         // Open input file and output file
         public static void main(String[] args) throws IOException {
              FileReader in = null;
              FileWriter out = null;
              BufferedReader br = null;
              System.out.println("input File Name = " + args[0]);
              System.out.println("output File Name = " + args[1]);
              if (args.length == 2) {
                   // Open File for Reading
                   File inFile = new File(args[0]);
                   in = new FileReader(inFile);
                   br = new BufferedReader(in);
                   // Open File for Writing
                   File outFile = new File(args[1]);
                   out = new FileWriter(outFile);
              } else {
                   System.out.println("java command <arg1> <arg2>");
              // Get operation and operands for each line
              String line = null;
         char op;
              int op1, op2;
              int result = 0;
              while((line = br.readLine()) != null ) {
                   // Get operation and operands
                   StringTokenizer t = new StringTokenizer(line);
                   op = t.nextToken().charAt(0);
                   op1 = Integer.valueOf(t.nextToken()).intValue();
                   op2 = Integer.valueOf(t.nextToken()).intValue();
                   // Compute math operation and print result
                   if( op == '+' ) {
                        result = op1 + op2;
                        System.out.println(op1 + " + " + op2 + " = " + result);
                   } else if( op == '-' ) {
                        result = op1 - op2;
                        System.out.println(op1 + " - " + op2 + " = " + result);
                   } else if( op == '*' ) {
                        result = op1 * op2;
                        System.out.println(op1 + " * " + op2 + " = " + result);
                   } else if( op == '/' ) {
                        result = op1 / op2;
                        System.out.println(op1 + " / " + op2 + " = " + result);
              // Close infile
              in.close();
              // Close outFile
              out.close();
    }

  • Older java for specific applications only

    I have 1.5.0 and 1.6.0 java installed on Snow Leopard. If I drag the 32 bit 1.5.0 (aka J2SE 5.0) version to the top of the preferences list for apps, then Fonality HUD works as well as it did before I upgraded to Snow Leopard. If I leave the 64 bit 1.6.0 (aka Java SE 6.0) at the top, it crashes almost immediately. (And the 32 bit 6.0 does not make it work.)
    But I don't want to make the downrev version my default java for all applications!
    I tried uncommenting the 1.5.0 line in the Info.plist for HUD, per the comments there, but that did not work.
    How can I tell this application to use 1.5.0 instead of 1.6.0 without affecting any other java apps I might want to run?
    TIA

    Apparently it runs 1.5 if you install it, for example http://wiki.oneswarm.org/index.php/OSX_10.6_SnowLeopard, which actually references the very application that I'm trying to make work: HUD.
    And it DOES work just fine, following those instructions. I just don't like the idea of running 1.5.0 as my default java for all my applications when most of them will run fine (better!) with the official version of java for Snow Leopard.
    Isn't there a way to tell one application to use a specific version of java? Does JAVA_HOME still do this? I tried that and failed, but maybe I did not set it to the correct value - the java command in 1.5.0 or something else?

  • Junit testcase for struts application

    Hi All,
    can anyone provide me the Junit sample testcase for struts application.

    > can anyone provide me the Junit sample testcase for struts application.
    The test code for the framework is downloadable with the source:
    http://struts.apache.org/download.cgi#struts208
    If you want unit tests for your web app, you'll need to write those yourself. Plenty examples can be found with Google:
    http://www.google.com/search?q=unit+test+struts
    ~

  • Error when running the struts application

    Hi
    i am getting this error when i run my struts application. Do i need to install the xerces parcer and should my local have the ANT. If so how should i confingure ANT
    /JSP/Login.jsp(12,0) Attribute name invalid for tag form according to TLD
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:236)
         org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1200)
         org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:821)
         org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1512)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:489)

    Ya I guess everything is right in both the files. Let me paste the contents :-
    WEB.XML
    <!DOCTYPE web-app PUBLIC
         "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
         "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <display-name>My Inventory</display-name>
    <!-- Standard Action Servlet Configuration -->
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
    <param-name>config</param-name>
    <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <!-- Standard Action Servlet Mapping -->
    <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    <!-- The Usual Welcome File List -->
    <welcome-file-list>
    <welcome-file>Login.jsp</welcome-file>
    </welcome-file-list>
    <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.TLD</taglib-location>
    </taglib>
    </web-app>
    STRUTS-CONFIG.xml
    <!DOCTYPE struts-config PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
    "http://struts.apache.org/dtds/struts-config_1_3.dtd">
    <!--
    Default configuration file for examples application.
    Each module also has its own struts-config under: /WEB-INF/$MODULE/
    @version $Revision: 1.9 $ $Date: 2006-12-03 11:32:52 -0600 (Sun, 03 Dec 2006) $
    -->
    <struts-config>
    <form-beans>
    <form-bean name="Loginform" type = "com.myInventory.Loginform"></form-bean>
    </form-beans>
    <global-exceptions/>
    <global-forwards
    <!-- utilize a custom ActionForward as an example only -->
    </global-forwards>
    <action path="/Login" type="com.myInventory.actions.Loginaction" name="Loginform" input="/Login.jsp">
              <forward name="login_target_success" path="/success.jsp"/>
              <forward name="login_target_failure" path="/login.jsp"/>
              </action>
    </action-mappings>
    <message-resources parameter="MessageResources"/>
    </struts-config>

  • ERROR while devevloping a struts application

    I am new to struts and trying to develop a simplem applicationusing struts,during which i am gettin an expextion of this sort.I have already placed both struts-core 2.2.1 and xcore 2.2.1 in WEB-INF/lib folder.please help
    SEVERE: Exception starting filter struts2
    java.lang.NoClassDefFoundError: org/apache/struts/action/Action
         at java.lang.ClassLoader.defineClass1(Native Method)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1960)
         at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:933)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1405)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1284)
         at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:149)
         at com.opensymphony.xwork2.ObjectFactory.getClassInstance(ObjectFactory.java:107)
         at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:410)
         at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:365)
         at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:479)
         at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:275)
         at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
         at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204)
         at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
         at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
         at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
         at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
         at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:221)
         at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:302)
         at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:78)
         at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3666)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4258)
         at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
         at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
         at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
         at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:980)
         at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:943)
         at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
         at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1203)
         at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:319)
         at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
         at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
         at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
         at org.apache.catalina.core.StandardService.start(StandardService.java:448)
         at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

    I was able to rectify that error by placing the struts-core-1.3.10.jarinto the WEB-INf/lib folder.
    But now i am gettin an exception durin the run time
    java.lang.NoSuchMethodException: manipulation.AdditionAction.execute()
         java.lang.Class.getMethod(Unknown Source)
         org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.getActionMethod(AnnotationValidationInterceptor.java:75)
         org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:47)
         com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
         com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
         com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)
         com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
         com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
         org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
         org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)
         org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
    my jsp pages are:
    addition.jsp:
    <%@taglib uri="/struts-tags" prefix="html" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Sample Application</title>
    </head>
    <body>
    <html:form action="Add">
    <html:textfield name="number1" label="Number1" />
    <html:textfield name="number2" label="Number2" />
    <html:submit value="Add" />
    </html:form>
    </body>
    </html>
    success.jsp:
    <html>
    <head>
    <title>Sample Struts Display Name</title>
    </head>
    <body>
    <table width="80%" border="0">
    <tr>
    <td>Addition: <%= request.getAttribute("sum") %> !!</td>
    </tr>
    </table>
    </body>
    </html>
    struts-config.xml:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts-config PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
    "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
    <struts-config>
    <form-beans>
    <form-bean name="Addform" type="manipulation.Addform"/>
    </form-beans>
    <global-exceptions>
    </global-exceptions>
    <global-forwards>
    <forward name="welcome" path="/Welcome.do"/>
    </global-forwards>
    <action-mappings>
    <action name="Add" class="manipulation.AdditionAction">
    <forward name="success" path="/success.jsp" />
    <forward name="failure" path="/failure.jsp" />
    </action>
    <action path="/Welcome" forward="/welcomeStruts.jsp"/>
    </action-mappings>
    </struts-config>
    Addform.java:
    package manipulation;
    public class Addform extends org.apache.struts.action.ActionForm
         private int number1;
         private int number2;
         private int sum;
         public Addform()
    }public String getSum()
         return("Result:"+sum);
              }public void setSum(int no1,int no2)
         this.number1=no1;
         this.number2=no2;
         sum=no1+no2;
    } public int getnumber1() {
    return number1;
    } public void setNumber1(int number) {
    this.number1 = number;
    } public int getnumber2 (){
    return number2;
    } public void setNumber2(int number) {
    this.number2= number;
    AdditionAction.java:
    package manipulation;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    public class AdditionAction extends org.apache.struts.action.Action
         private static final String SUCCESS = "success";
    public ActionForward execute(ActionMapping mapping,ActionForm form,
    HttpServletRequest request, HttpServletResponse response)throws Exception {
         int no1=0;
         int no2=0;
    if ( form != null )
    // Use the NameForm to get the request parameters
    Addform formadd = (Addform) form;
    no1 =formadd.getnumber1() ;
    no2=formadd.getnumber2();
    // if no mane supplied Set the target to failure
    request.setAttribute("number1", no1);
    request.setAttribute("number2", no2);
              return (mapping.findForward(SUCCESS));
    please help...
    }

  • Console error while deploying a struts application..

    I am getting following exception while deploying a struts application:-
    javax.servlet.ServletException: org/apache/commons/logging/LogFactory
         at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:884)
         at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:848)
         at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:787)
         at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:3252)
         at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppServletContext.java:3197)
         at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:3174)
         at weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServletContext.java:5647)
         at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:869)
         at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer.java:2022)
         at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2063)
         at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.activateContainer(SlaveDeployer.java:2592)
         at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(SlaveDeployer.java:2515)
         at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeployer.java:2317)
         at weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(SlaveDeployer.java:2399)
         at weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDeployer.java:2311)
         at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2479)
         at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:798)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:507)
         at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:465)
         at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    please help me out.

    The ServletException is just a wrapper exception which informs about an underlying failure. When interpreting stacktraces,the bottommost root cause parts is the most important part. I assume that it's just a java.lang.ClassNotFoundException on org/apache/commons/logging/LogFactory. In that case, the exception is self-explaining enough. The mentioned class is missing in the classpath. The solution is also obvious: add the mentioned class (or at least, the JAR file with the mentioned class) to the classpath and you're fine. As the package name already hints, you can download it at [http://commons.apache.org/logging].
    For future java.lang.* exceptions please consult 'New to Java' forum. This is unrelated to Java Servlet.

  • BUG: 10.1.3..36.73 Internal Compile Error with enhanced for loop/generics

    I get the following compiler error when using the Java 5 SE enhanced for loop with a generic collection.
    Code:
    public static void main(String[] args)
    List<Integer> l = new ArrayList<Integer>();
    l.add(new Integer(1));
    printCollection(l);
    private static void printCollection(Collection<?> c)
    for (Object e : c)
    System.out.println(e);
    Error on attempting to build:
    "Error: Internal compilation error, terminated with a fatal exception"
    And the following from ojcInternalError.log:
    java.lang.NullPointerException
         at oracle.ojc.compiler.EnhancedForStatement.resolveAndCheck(Statement.java:2204)
         at oracle.ojc.compiler.StatementList.resolveAndCheck(Statement.java:4476)
         at oracle.ojc.compiler.MethodSymbol.resolveMethod(Symbol.java:10822)
         at oracle.ojc.compiler.RawClassSymbol.resolveMethodBodies(Symbol.java:6648)
         at oracle.ojc.compiler.Parser.resolveMethodBodies(Parser.java:8316)
         at oracle.ojc.compiler.Parser.parse(Parser.java:7823)
         at oracle.ojc.compiler.Compiler.main_internal(Compiler.java:978)
         at oracle.ojc.compiler.Compiler.main(Compiler.java:745)
         at oracle.jdeveloper.compiler.Ojc.translate(Ojc.java:1486)
         at oracle.jdeveloper.compiler.UnifiedBuildSystem$CompileThread.buildGraph(UnifiedBuildSystem.java:300)
         at oracle.jdeveloper.compiler.UnifiedBuildSystem$CompileThread.buildProjectFiles(UnifiedBuildSystem.java:515)
         at oracle.jdeveloper.compiler.UnifiedBuildSystem$CompileThread.buildAll(UnifiedBuildSystem.java:715)
         at oracle.jdeveloper.compiler.UnifiedBuildSystem$CompileThread.run(UnifiedBuildSystem.java:893)

    Install the Service Update 1 patch for JDeveloper (using the help->check for updates), and let us know if this didn't solve the problem.

  • Compiled Error in Xcode for iphone game and other questions

    Dear all,
    Hi, I am a newbie of xcode and objective-c and I have a few questions regarding to the code sample of a game attached below. It is written in objective C, Xcode for iphone4 simulator. It is part of the code of 'ball bounce against brick" game. Instead of creating the image by IB, the code supposes to create (programmatically) 5 X 4 bricks using 4 different kinds of bricks pictures (bricktype1.png...). I have the bricks defined in .h file properly and method written in .m.
    My questions are for the following code:
    - (void)initializeBricks
    brickTypes[0] = @"bricktype1.png";
    brickTypes[1] = @"bricktype2.png";
    brickTypes[2] = @"bricktype3.png";
    brickTypes[3] = @"bricktype4.png";
    int count = 0;`
    for (int y = 0; y < BRICKS_HEIGHT; y++)
    for (int x = 0; x < BRICKS_WIDTH; x++)
    - Line1 UIImage *image = [ImageCache loadImage:brickTypes[count++ % 4]];
    - Line2 bricks[x][y] = [[[UIImageView alloc] initWithImage:image] autorelease];
    - Line3 CGRect newFrame = bricks[x][y].frame;
    - Line4 newFrame.origin = CGPointMake(x * 64, (y * 40) + 50);
    - Line5 bricks[x][y].frame = newFrame;
    - Line6 [self.view addSubview:bricks[x][y]]
    1) When it is compiled, error "ImageCache undeclared" in Line 1. But I have already added the png to the project. What is the problem and how to fix it? (If possible, please suggest code and explain what it does and where to put it.)
    2) How does the following in Line 1 work? Does it assign the element (name of .png) of brickType to image?
    brickTypes[count ++ % 4]
    For instance, returns one of the file name bricktype1.png to the image object? If true, what is the max value of "count", ends at 5? (as X increments 5 times for each Y). But then "count" will exceed the max 'index value' of brickTypes which is 3!
    3) In Line2, does the image object which is being allocated has a name and linked with the .png already at this line *before* it is assigned to brick[x][y]?
    4) What do Line3 and Line5 do? Why newFrame on left in line3 but appears on right in Line5?
    5) What does Line 4 do?
    Thanks
    North

    Hi North -
    macbie wrote:
    1) When it is compiled, error "ImageCache undeclared" in Line 1. ...
    UIImage *image = [ImageCache loadImage:brickTypes[count++ % 4]]; // Line 1
    The compiler is telling you it doesn't know what ImageCache refers to. Is ImageCache the name of a custom class? In that case you may have omitted #import "ImageCache.h". Else if ImageCache refers to an instance of some class, where is that declaration made? I can't tell you how to code the missing piece(s) because I can't guess the answers to these questions.
    Btw, if the png file images were already the correct size, it looks like you could substitute this for Line 1:
    UIImage *image = [UIImage imageNamed:brickTypes[count++ % 4]]; // Line 1
    2) How does the following in Line 1 work? Does it assign the element (name of .png) of brickType to image?
    brickTypes[count ++ % 4]
    Though you don't show the declaration of brickTypes, it appears to be a "C" array of NSString object pointers. Thus brickTypes[0] is the first string, and brickTypes[3] is the last string.
    The expression (count++ % 4) does two things. Firstly, the trailing ++ operator means the variable 'count' will be incremented as soon as the current expression is evaluated. Thus 'count' is zero (its initial value) the first time through the inner loop, its value is one the second time, and two the third time. The following two code blocks do exactly the same thing::
    int index = 0;
    NSString *filename = brickTypes[index++];
    int index = 0;
    NSString *filename = brickTypes[index];
    index = index + 1;
    The percent sign is the "modulus operator" so x%4 means "x modulo 4", which evaluates to the remainder after x is divided by 4. If x starts at 0, and is incremented once everytime through a loop, we'll get the following sequence of values for x%4: 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, ...
    So repeated evaluation of (brickTypes[count++ % 4]) produces the sequence: @"bricktype1.png", @"bricktype2.png", @"bricktype3.png", @"bricktype4.png", @"bricktype1.png", @"bricktype2.png", @"bricktype3.png", @"bricktype4.png", @"bricktype1.png", @"bricktype2.png", ...
    3) In Line2, does the image object which is being allocated has a name and linked with the .png already at this line *before* it is assigned to brick[x][y]?
    Line 2 allocs an object of type UIImageView and specifies the data at 'image' as the picture to be displayed by the new object. Since we immediately assign the address of the new UIImageView object to an element of the 'bricks' array, that address isn't stored in any named variable.
    The new UIImageView object is not associated with the name of the png file from which its picture originated. In fact the UIImage object which inited the UIImageView object is also not associated with that png filename. In other words, once a UIImage object is initialized from the contents of an image file, it's not possible to obtain the name of that file from the UIImage object. Note when you add a png media object to a UIImageView object in IB, the filename of the png resource will be retained and used to identify the image view object. But AFAIK, unless you explicitly save it somewhere in your code, that filename will not be available at run time.
    4) What do Line3 and Line5 do? Why newFrame on left in line3 but appears on right in Line5?
    5) What does Line 4 do?
    In Line 2 we've set the current element of 'bricks' to the address of a new UIImageView object which will display one of the 4 brick types. By default, the frame of a UIImageView object is set to the size of the image which initialized it. So after Line 2, we know that frame.size for the current array element is correct (assuming the image size of the original png file was what we want to display, or assuming that the purpose of [ImageCache loadImage:...] is to adjust the png size).
    Then in Line 3, we set the rectangle named newFrame to the frame of the current array element, i.e. to the frame of the UIImageView object whose address is stored in the current array element. So now we have a rectangle whose size (width, height) is correct for the image to be displayed. But where will this rectangle be placed on the superview? The placement of this rectangle is determined by its origin.
    Line 4 computes the origin we want. Now we have a rectangle with both the correct size and the correct origin.
    Line 5 sets the frame of the new UIImageView object to the rectangle we constructed in Lines 3 and 4. When that object is then added to the superview in Line 6, it will display an image of the correct size at the correct position.
    - Ray

  • Class with objects compile error in Java 1.5.0 and 1.4.2.05

    Hi, I have some problems with creating objects to my java program.
    See below:
    JAVA, creating new class object.
    class AccountTest {
         public static void main(String[]args) {
         Account olesAccount = new Account(123456676756L, "Ole Olsen", 2300.50);
         olesAccount.deposit(1000.0); //Input of 1000$ to account
         double balance = olesAccount.findBalance(); //Ask object about balance!
         System.out.println("Balance: " +balance);
    ERRORS, from compiler (javac):
    AccountTest.java:7: cannot find symbol
    symbol : class Account
    location: class AccountTest
    Account olesAccount = new Account(123456676756L, "Ole Olsen", 2300.50);
    ^
    AccountTest.java:7: cannot find symbol
    symbol : class Account
    location: class AccountTest
    Account olesAccount = new Account(123456676756L, "Ole Olsen", 2300.50);
    ^
    2 errors
    This error occurs with both java 1.5.0 RC and 1.4.2.05
    */

    Assuming you haven't forgotten to compile the Account class, tt seems to be a problem with visibility. Are you sure your classpath is set up correctly and that the class Account is visible to the AccountTest driver?
    I'd try moving the Account out of whatever package it's in right now and making it public. Then, restrict acces from there.

  • [ SOLVED ] Compile Error with Java Fonts & IntelliJ

    Hi All
    I have now got a new problem when i compile a flex project.  Yesterday inorder to get the IJ Interface font smoothing sorted, i had to add this line to my ~/.bashrc file
    _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on
    But now when i go to run a flex project, i get the following error message
    Information:Using built-in compiler shell, up to 4 parallel threads
    See compiler settings at File | Settings | Compiler | Flex Compiler page
    Information:Starting Flex compiler:
    /opt/java/jre/bin/java -Dapplication.home=/home/julian/SDK/flex_sdk_4.5.0.17855 -Xmx384m -Dsun.io.useCanonCaches=false -Duser.language=en -Duser.region=en -Xmx1024m -classpath /opt/idea-IU-98.311/plugins/flex/lib/flex-compiler.jar:/home/julian/SDK/flex_sdk_4.5.0.17855/lib/flex-compiler-oem.jar com.intellij.flex.compiler.FlexCompiler 48936
    Information:Compilation completed with 2 errors and 0 warnings
    Information:2 errors
    Information:0 warnings
    Error:Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on
    Error:java.net.SocketException: Socket closed
    Error:java.net.ConnectException: Connection refused
    Error:     at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
         at java.net.Socket.connect(Socket.java:529)
         at java.net.Socket.connect(Socket.java:478)
         at java.net.Socket.<init>(Socket.java:375)
         at java.net.Socket.<init>(Socket.java:218)
         at com.intellij.flex.compiler.FlexCompiler.openSocket(FlexCompiler.java:35)
         at com.intellij.flex.compiler.FlexCompiler.main(FlexCompiler.java:70)
    Any suggestions, besides disabling the _JAVA_OPTION again ?
    Many Thanks
    Last edited by whitetimer (2010-11-14 17:24:11)

    -Dawt.useSystemAAFontSettings=on needs to be added to the end of file
    idea.vmoptions

  • Compiler Error on Linux for jni.h, any solution?

    Hi all,
    i am using jni.h file provided by sun to compile my code on linux, but it gives me compile error. though it compiles properly on Windows and AIX.
    what could be the reason?
    jni.h:202: error: expected &apos;)&apos; before &apos;*&apos; token
    jni.h:204: error: expected &apos;;&apos; before &apos;jclass&apos;
    jni.h:1877: error: expected &apos;)&apos; before &apos;*&apos; token
    jni.h:1879: error: expected &apos;;&apos; before &apos;jint&apos;
    and many more !!!

    i am using jni.h file provided by sun to compile my code on linuxAre you sure about that? Check that it isn't the one provided with GNU CLASSPATH. If it is, delete GNU CLASSPATH altogether. It isn't Java, and the incompatibility of jni.h is one of many reasons why not.

  • Flex 2 configuration for Struts application

    Hello everyone,
    Good afternoon.
    I have some questions regarding the Flex 2 and Struts. I use
    struts for long time already but just touch the Flex 2 since last
    week. As I know, we can use Flex 2 to build our front end and
    Struts for the Control and the back-end process for
    Web-Application. I already read the article "Flex 2 Tag Library for
    JSP" but still cannot get it correctly. Can anyone kindly help me
    to setup and make it works.
    I already downloaded and installed the following:
    1. Struts 1.2.7 (I am using the struts-blank as my base
    application)
    2. Flex Builder 2 (With Flex SDK)
    3. Flex Data Service 2.0.1
    I followed what is writen in the web-site. But cannot make it
    right. Please help me.
    Thank you and Good day,

    Hi,
    You may go through this link to get the overview of the database level requirements for Siebel 8.1 database:
    http://download.oracle.com/docs/cd/E11886_01/V8/CORE/SRSP_81/SRSP_81_DBPlatforms2.html#wp1013211
    The Siebel Bookshelf available at edelivery.oracle.com will give you a complete and in depth picture.
    For Development instance, ensure that you have binary sort order set.
    It is recommended to use AL32UTF8 as the codepage for Dev enviornment multi lingual enviornment.
    Thanks and Regards,
    Tanmay Jain

  • Effectv don't compile. error: conflicting types for 'trunc'

    hello all.
    i'm full newbie, so please, be kind
    I try to install effectv from AUR, but when i try to 'make' - i receive error:
    error: conflicting types for 'trunc'
    then i download sources and try to compile them - and again receive this error.
    Please advice, what should i do to correct this error?
    Thank you and sorry for my english.

    Please contact the author of the PKGBUILD to have it changed in the AUR. This fixes your issues:
    PKGBUILD
    # Contributor: Luiz Ribeiro <luizribeiro>
    pkgname=effectv
    pkgver=0.3.11
    pkgrel=1
    pkgdesc="EffecTV is a real-time video effector. You can watch TV or video through amazing effectors."
    url="http://effectv.sourceforge.net/"
    depends=('sdl')
    makedepends=('nasm')
    conflicts=()
    license=
    install=
    source=('http://jaist.dl.sourceforge.net/sourceforge/effectv/effectv-0.3.11.tar.gz'
    'gcc.patch' 'timedist.patch')
    md5sums=('71570b71009df0f1ff53e31de6f50cee')
    build() {
    cd $startdir/src/$pkgname-$pkgver
    patch -Np0 < $startdir/src/gcc.patch || return 1
    patch -Np0 < $startdir/src/timedist.patch || return 1
    sed -i -e 's_/usr/local_/usr_g' config.mk
    make || return 1
    mkdir -p $startdir/pkg/usr/bin
    mkdir -p $startdir/pkg/usr/man/man1
    make install INSTALL=/bin/install -c DESTDIR=$startdir/pkg || return 1
    gcc.patch : fixes compile problem
    --- utils.c.orig 2006-02-14 15:06:17.000000000 +0100
    +++ utils.c 2006-08-30 22:47:19.514145536 +0200
    @@ -26,7 +26,7 @@
    * HSI color system utilities
    -static int trunc(double f)
    +static int trunc_color(double f)
    int i;
    @@ -44,9 +44,9 @@
    Gv=1+S*sin(H);
    Bv=1+S*sin(H+2*M_PI/3);
    T=255.999*I/2;
    - *r=trunc(Rv*T);
    - *g=trunc(Gv*T);
    - *b=trunc(Bv*T);
    + *r=trunc_color(Rv*T);
    + *g=trunc_color(Gv*T);
    + *b=trunc_color(Bv*T);
    timedist.patch : fixes bug
    This is a quick fix for bugs of effectv-0.3.11. TimeDistortion has a border
    crossing bug and a buffer uninitializing bug.
    Index: effects/timedist.c
    ===================================================================
    --- effects/timedist.c (revision 478)
    +++ effects/timedist.c (working copy)
    @@ -27,7 +27,16 @@
    static int plane;
    static int *warptime[2];
    static int warptimeFrame;
    +static int bgIsSet;
    +static int setBackground(RGB32 *src)
    +{
    + image_bgset_y(src);
    + bgIsSet = 1;
    +
    + return 0;
    +}
    +
    effect *timeDistortionRegister(void)
    effect *entry;
    @@ -70,6 +79,7 @@
    plane = 0;
    image_set_threshold_y(MAGIC_THRESHOLD);
    + bgIsSet = 0;
    state = 1;
    return 0;
    @@ -94,6 +104,9 @@
    int *p, *q;
    memcpy(planetable[plane], src, PIXEL_SIZE * video_area);
    + if(!bgIsSet) {
    + setBackground(src);
    + }
    diff = image_bgsubtract_update_y(src);
    p = warptime[warptimeFrame ] + video_width + 1;
    @@ -109,7 +122,7 @@
    q += 2;
    - q = warptime[warptimeFrame ^ 1] + video_width + 1;
    + q = warptime[warptimeFrame ^ 1];
    for(i=0; i<video_area; i++) {
    if(*diff++) {
    *q = PLANES - 1;

Maybe you are looking for

  • Payroll Query

    Hi Members, My Query is on payroll.  I have created payroll area and tried to create a control record with rectroactive accounting date as jan 2011 and Payroll period date as Aug 2011.  When Iam trying to save the record it is showing error as Payrol

  • Using PrincipalValidator in WLS 8.1

    In Weblogic 8.1 Instantiating Default Weblogic PrincipalValidator gives problem

  • Message Tracking Results

    Hello, I have a email enabled "Universal" security group called "AllStaff" that has over 2000 members. When I use the command: get-messagetrackinglog -ResultSize Unlimited -Recipients:[email protected] -Server "MailServer" -Message ID "<[email protec

  • Windows 8.1 socket forwarding not working

    At one of our customers we had to add an enhanced generic Client application with the vpn socket forwarding mode. With this application we were able to open a special website on one internal server. Last week we updated to SP4 and saw that the socket

  • What is an alternative for flash player for iPad please

    I want to be able to watch plus7 shows but it says I have to download flash player is there an alternative