Servlet and Actions - Apache Struts !

Hi,
i defined an ActionServlet in the web.xml and some "Actions" in the struts-config.xml.
If all the requests are managed by the servlet defined in the web.xml, in case i had a lot of requests would it be better defined more ActionServlet in the web.xml which refers to different struts-config.xml ?
I think that having more servlet is much better to manage the load of the entire application.
Any suggestions ?
Cheers.
Stefano

No need creating more than one ActionServlet : Servlets are Threads so each request made by a client is handled by a different Thread!

Similar Messages

  • Javax.servlet.UnavailableException: org.apache.struts.tile.TilesRequestProc

    hi
    I attached the tiles. jar file to tomcat lib folder
    that jar file is having the source
    when I run the project the following error is coming
    SEVERE: Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown, so marking the servlet as unavailable. Most likely, this is due to an incorrect or missing library dependency.
    javax.servlet.ServletException: org.apache.struts.tile.TilesRequestProcessor
         at org.apache.struts.tiles.TilesPlugin.initRequestProcessorClass(TilesPlugin.java:351)
         at org.apache.struts.tiles.TilesPlugin.init(TilesPlugin.java:133)
         at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869)
         at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
         at javax.servlet.GenericServlet.init(GenericServlet.java:211)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
         at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
         at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4201)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
         at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
         at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
         at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
         at org.apache.catalina.core.StandardService.start(StandardService.java:450)
         at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
         at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
         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:294)
         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)

    hi karthik
    SEVERE: Can't set TilesRequestProcessor: bad class name 'org.apache.struts.tile.TilesRequestProcessor'.
    Dec 6, 2007 3:08:15 PM org.apache.struts.action.ActionServlet init
    SEVERE: Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown, so marking the servlet as unavailable. Most likely, this is due to an incorrect or missing library dependency.
    javax.servlet.ServletException: org.apache.struts.tile.TilesRequestProcessor
         at org.apache.struts.tiles.TilesPlugin.initRequestProcessorClass(TilesPlugin.java:351)
         at org.apache.struts.tiles.TilesPlugin.init(TilesPlugin.java:133)
         at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869)
         at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336)
         at javax.servlet.GenericServlet.init(GenericServlet.java:211)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
         at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
         at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4201)
         at org.apache.catalina.core.StandardContext.reload(StandardContext.java:2990)
         at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:403)
         at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1277)
         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
         at java.lang.Thread.run(Unknown Source)
    Dec 6, 2007 3:08:15 PM org.apache.catalina.core.ApplicationContext log
    INFO: Marking servlet action as unavailable
    Dec 6, 2007 3:08:15 PM org.apache.catalina.core.StandardContext loadOnStartup
    SEVERE: Servlet /Testingtiles threw load() exception
    javax.servlet.UnavailableException: org.apache.struts.tile.TilesRequestProcessor
         at org.apache.struts.action.ActionServlet.init(ActionServlet.java:368)
         at javax.servlet.GenericServlet.init(GenericServlet.java:211)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
         at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:932)
         at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3917)
         at org.apache.catalina.core.StandardContext.start(StandardContext.java:4201)
         at org.apache.catalina.core.StandardContext.reload(StandardContext.java:2990)
         at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:403)
         at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1277)
         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
         at java.lang.Thread.run(Unknown Source)
    Dec 6, 2007 3:08:34 PM org.apache.catalina.core.StandardWrapperValve invoke
    INFO: Servlet action is currently unavailable

  • Servlets and Tomcat/Apache

    Okay,
    Tomcat 4.1 running with Apache.
    Installed mod_jk, piece of cake.
    JSPs run through Apache like a dream.
    Tomcat examples ( jsp and servlets) run through Apache perfectly ( that is no :8080 business).
    My JSP's run through Apache no problem. Works great.
    My SERVLETS WILL NOT RUN THROUGH APACHE FOR ANYTHING.
    My context looks like this in server.xml:
    <Context path="/nuweb" docBase="/home/shared/nuweb" debug="0"
    reloadable="true" crossContext="true">
    <Logger className="org.apache.catalina.logger.FileLogger"
    prefix="nuweb" suffix=".log"
    timestamp="true"/>
    </Context>
    Note: that I am not under <TOMCAT_HOME>/webapps.
    The reason is that I will, in production not be the Unix admin on the server. I will only have priviledges within my directory. I will not be able to drop war files in the webapps directory. I will not be able
    to start and stop tomcat or apache ( there are 100 diffrent apache contexts on that machine and someday many of them will be going through tomcat for jsp and servlet support).
    My servlets will only run if I put :8080/nuweb/servlet/HelloServlet in the URL. Take off the 8080 and I get Page not found. Not the tomcat 404 page, the Browswer 404 errror.
    Here is my web.xml which lives in the WEB-INF directory of of /home/shared/nuweb
    <?xml version="1.0" encoding="UTF-8"?>
    <!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>
    <servlet>
    <servlet-name>HelloServlet</servlet-name>
    <servlet-class>org.nu.servlet.HelloServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloServlet</servlet-name>
    <url-pattern>/hello</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
    </web-app>
    In devlopment I am on a system that is very close to what the production server will look like ( Tomcat 4.1 same version of Apache, same Unix ). In development I can restart all the servers edit server.xml etc. On the production I would have to schedule that stuff. I want to be able to compile classes and drop them in the WEB-INF/classes... directory and have them run. Is that too much to ask?

    Hi,
    I am also facing same error.
    I am not able to view my servlets via apache web server.
    ie when i do "http://localhost/enlighta/logon"
    I get http 404 page not found error
    but when I do http://localhost:8080/enlighta/logon
    all works fine
    I am using apache 2 and tomcat 4.5
    This is I have done:
    1.I have http server running on port 80
    2. appserver on port 8080
    3. I have a war file enlighta.war deployed on webserevr
    4. The static content like images and html page I have moved to webserver
    5. The servlet context of the app on the app server is /enlighta
    6. In the web.xml I have defined all the servlet maping.
    the port 8009 has the connecter is running/listening.
    the configuration
    sever.xml on tomcat
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009"
    enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
    <Host name="localhost" appBase="webapps"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">
    httpd.conf on apache
    # Load mod_jk
    LoadModule jk_module modules/mod_jk.so
    # Configure mod_jk
    JkWorkersFile conf/workers.properties
    JkLogFile logs/mod_jk.log
    JkLogLevel info
    # First Virtual Host.
    <VirtualHost 192.168.1.2:8080>
    ServerAdmin [email protected]
    DocumentRoot /enlighta/
    ServerName localhost
    ErrorLog logs/enlighta_error_log
    TransferLog logs/enlighta_access_log
    JkMount /enlighta/* ajp13
    </VirtualHost>
    workers.properties
    worker.list=ajp13
    # Defining a worker named ajp13w and of type ajp13
    # Note that the name and the type do not have to match.
    worker.ajp13.type=ajp13
    worker.ajp13.host=localhost
    worker.ajp13.port=8009
    Now I feel I am doing something wrong on defining virtual host.
    Or may be something else is wrong.
    I have gone thru the previous thread but I dont have mod_jk.conf file.
    Please help!!!
    Thanks
    Sachin

  • Servlets and Actions

    Hi,
    i defined an ActionServlet in the web.xml and some "Actions" in the struts-config.xml.
    If all the requests are managed by the servlet defined in the web.xml, in case i had a lot of requests would it be better defined more ActionServlet in the web.xml which refers to different struts-config.xml ?
    I think that having more servlet is much better to manage the load of the entire application.
    Any suggestions ?
    Cheers.
    Stefano

    "...If all the requests are managed by the servlet defined in the web.xml, in case i had a lot of requests would it be better defined more ActionServlet in the web.xml which refers to different struts-config.xml ?..."
    No. Using a single, multi-threaded servlet is the most efficient way to process multiple requests. Only one instance of the ActionServlet is required for the whole app. Bottom line - multiple threads are more efficient than multiple instances.

  • Org.apache.struts.action.ActionServlet not found in web-application

    Dear All,
    I am new to ADF environment. I tried to create a simple page to show the records from
    a table . I followed the sample application which is available in "Building Oracle ADF Applications: Workshop".
    When i run my action from Struts Page Flow. It is giving error like
    500 Internal Server Error
    Servlet error: Error instantiating servlet 'action'. Servlet class org.apache.struts.action.ActionServlet not found in web-application EmpMaintanance-ViewController-webapp
    anybody can suggest me What i missed?
    Thanks in advance...

    Hi,
    you need to register libraries with th OC4J configuration files. However, you can also deploy the Struts library with you application (see OC4J documentation which is accessible on OTN via Oracle As documentation), in which case they are available from the application classpath
    Frank

  • Help With Integrating Servlet and JSP Page?

    Hello There
    --i made jsp page that contain name and description fields and add button
    --and i made servlet that contain the code to insert name and description in the database
    --and i want to make that when the user hit the add button
    -->the entered name and description is sent to the servlet
    and the servlet sent them to database?
    here's what i 've done:
    the jsp code:
    <html:html locale="true">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>
            Categories Page
           </title>
            <html:base/>
        </head>
        <body style="background-color: white">
        <form action="jpage.jsp" method="get">
            <h1>
                <center>
    categories Operations
                </center>
            </h1>
            <h3>
                 <label>Name</label>
            <input type="text" name="name" value="" size="10" />
                 <label>Description</label>
             <input type="text" name="description" value="" size="10" />
             <input type="submit" value="Add" name="button" />
           </h3>
       </form>
        </body>
    </html:html>the servlet code:
    import java.io.*;
    import java.util.Enumeration;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.net.*;
    class NewServlet1 extends HttpServlet{
         Connection conn;
         private ServletConfig config;
    public void init(ServletConfig config)
      throws ServletException{
         this.config=config;
    public void service (HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException {
       HttpSession session = req.getSession(true);
       res.setContentType("text/html");
    try{
         Class.forName("com.mysql.jdbc.Driver");
       conn = DriverManager.getConnection("jdbc:mysql://localhost/struts", "root", "");
         PreparedStatement ps;
       ps = conn.prepareStatement ("INSERT INTO categories (Name, Description) VALUES(?,?)");
          ps.setString (1, "aa");
          ps.setString (3, "bb");
          ps.executeUpdate();
          ps.close();
          conn.close();
      }catch(Exception e){ e.getMessage();}
      public void destroy(){}
    }

    The JSP Code:
    <html:html locale="true">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>
            Categories Page
           </title>
            <html:base/>
        </head>
        <body style="background-color: white">
        <form action="actionServlet.do?action=Additem" method="*post*">
            <h1>
                <center>
    categories Operations
                </center>
            </h1>
            <h3>
                 <label>Name</label>
            <input type="text" name="name" value="" size="10" />
                 <label>Description</label>
             <input type="text" name="description" value="" size="10" />
             <input type="button" value="Submit">
           </h3>
       </form>
        </body>
    </html:html>The Servlet Code:
    import java.io.*;
    import java.util.Enumeration;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.net.*;
    public class NewServlet1 extends HttpServlet implements SingleThreadModel {
        public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException {
            doPost(request,response);
        public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException,IOException {
              String action = request.getParameter("action"); // action = "Additem"
              if (action.equals("Additem")) {
                   String name = request.getParameter("name");
                   String description = request.getParameter("description");
                         RequestDispatcher reqDisp = null;
                   try{
                  Connection conn;
                  PreparedStatement ps;
         Class.forName("com.mysql.jdbc.Driver");
       conn = DriverManager.getConnection("jdbc:mysql://localhost/struts", "root", "");
       ps = conn.prepareStatement ("INSERT INTO categories (Name, Description) VALUES(?,?)");
          ps.setString (1, name);
          ps.setString (3, description);
          ps.executeUpdate();
          ps.close();
          conn.close();
          reqDisp= request.getRequestDispatcher("./index.jsp");
          reqDisp.forward(request, response);
                   catch (Exception ex){
                        System.out.println("Error: "+ ex);
    }The web.xml code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
        <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>
            <init-param>
                <param-name>debug</param-name>
                <param-value>2</param-value>
            </init-param>
            <init-param>
                <param-name>detail</param-name>
                <param-value>2</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
            </servlet>
        <servlet>
            <servlet-name>NewServlet1</servlet-name>
            <servlet-class>NewServlet1</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>action</servlet-name>
            <url-pattern>*.do</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>NewServlet1</servlet-name>
            <url-pattern>/NewServlet1</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>index.jsp</welcome-file>
            </welcome-file-list>
            <servlet>
         <servlet-name>actionServlet</servlet-name>
         <servlet-class>com.test.servlet.NewServlet1</servlet-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>actionServlet</servlet-name>
         <url-pattern>*.do</url-pattern>
    </servlet-mapping>
        </web-app>

  • Java.lang.NullPointerException at org.apache.struts.taglib.tiles.InsertTag

    I am using tiles with JSF.
    my starting page is template.jsp which is like this..
    <f:view>
    <f:subview id="header">
    <tiles:insert attribute="header" flush="false"/>
    </f:subview>
    <f:subview id="menu">
    <tiles:insert attribute="menu" flush="false"/>
    </f:subview>
    </f:view>
    when ever the page is rendered, im not getting the value for attribute header or content. its throwing java.lang.NullPointerException at org.apache.struts.taglib.tiles.InsertTag.processAttribute(InsertTag.java:689)
    Below is my faces-config.xml
    <?xml version="1.0"?>
    <!DOCTYPE faces-config PUBLIC
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
    "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
    <faces-config>
    <application>
    <view-handler>org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl</view-handler>
    </application>
    </faces-config>
    Below is my web.xml
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <init-param>
    <param-name>javax.faces.application.CONFIG_FILES</param-name>
    <param-value>/ApplianceMgr/conf/faces-config.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>Tiles Servlet</servlet-name>
    <servlet-class>org.apache.struts.tiles.TilesServlet</servlet-class>
    <init-param>
    <param-name>tiles-definitions</param-name>
    <param-value>/ApplianceMgr/conf/tiles.xml</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
    </context-param>
    Below is my tiles.xml
    <tiles-definitions>
    <definition name="main.template" path="/template/template.jsp" >
    <put name="header" value="test from template" />
    <put name="menu" value="test from template" />
    </definition>

    Please post the tiles-config.xml, layout and tiles.
    Please refer
    http://www.oracle.com/technology/pub/articles/vohra_tiles.html

  • Error can't load Servlet org.apache.struts.action.ActionServlet

    Hi,
    I have SAP J2EE 6.20 installed on linux machine. I am trying to deploy struts framework based application and while deploying it..... I am getting error message:
    Error can't load Servlet org.apache.struts.action.ActionServlet : java.lang.NoClassDefFoundError: org/xml/sax/SAXException
    07 19:27:48 -  ***********************************************************
    08/10/07 19:27:48 -  Applying user role management mappings.
    08/10/07 19:27:48 -  Start updating EAR-file...D:\SAPJ2EE Client\deploying\sambodh\sambodh.ear
    08/10/07 19:28:26 -  Temp files deleted...
    08/10/07 19:28:26 -  Ear-file updated successfully for 37860ms.
    08/10/07 19:28:27 -  Start deploying ...
    08/10/07 19:30:35 -  Ear-file uploaded to server for 128047ms.
    08/10/07 19:30:37 -  Successfuly deployed! Deployment took 1953ms.
    08/10/07 19:30:37 -  WARNING : Deploy service return folowing WARNINGs:
                         Error can't load Servlet org.apache.struts.action.ActionServlet : java.lang.NoClassDefFoundError: org/xml/sax/SAXException
                          Deployment took 1953ms.
    08/10/07 19:30:37 -  ***********************************************************
    First time when I got this error, I added struts.jar in my server's <inst_dir>/alone/additional_libs/...... but then also error still exists... Do I have to start  SAP J2EE instance once again and then deploy my application?
    Can anyone help me out in this as this is very very very imp.
    regards

    Hi,
    As per your actions above I believe you have already found SAP Note 435363.
    Basically for a struts application there are no special requirements other than
    1. Make a reference to the inqmyxmltoolkit from the application that is going to use struts before the deployment
    2. Put the struts library into WEB-INF/lib of the application (struts can't be shared among applications)
    3. Deploy the application
    For making the reference you can:
    1. Telnet to the Engine (if you run it as a service and do not have access to its shell directly)
    If telnet port on the Engine dispatcher is 2323
    telnet localhost 2323
    2. Jump to the server node
    for example if the application node's cluster id is 4001
    jump 4001
    3. Execute the commands
    add deploy
    changeref -m  MyApplication library:inqmyxml
    So if it does not work, then I see two reasons possible:
    1. You are using a really old version of the 6.20 Engine - check if you are on PL41.
    2. You have misspelled the name of your application in the reference. The names are case sensitive so you need to be careful. MyApplication is not the same as myApplication or myapplication.
    Regards,
    Iavor

  • The import org.apache.struts.action.ActionError cannot be resolved

    Hai anyone,. I' a newbie to struts and want to learn more. I download the example code, and run it. Hey, it work. But when I try to create it by myself by following the tutorial, I got stuck with my all java file when i want to try to compile it with eclipse.It say:
    The import org.apache.struts.action.ActionError cannot be resolved
    What' wrong?
    this is one of the example code, i bolded the error line:
    package dummies.struts.music;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionError;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.validator.DynaValidatorForm;
    * @author Mike Robinson
    public class LoginAction extends Action
         * Handles request from user
         * @param mapping
         * @param form
         * @param request
         * @param response
         * @throws Exception
         public ActionForward execute(      ActionMapping mapping,
                                                 ActionForm form,
                                                 HttpServletRequest request,
                                                 HttpServletResponse response)
                                                 throws Exception
              // did the user click the Join button?
              Boolean bCancel = (Boolean)request.getAttribute("org.apache.struts.action.CANCEL");
              if(bCancel != null)
                   if(bCancel.booleanValue())
                        return (mapping.findForward("join"));
              // create a new LoginBean passing the datasource
              LoginBean lb = new LoginBean(getDataSource(request, "musiccollection"));
              // check to see if this user/password combination are valid
              // will return a non-null UserDTO if valid
              UserDTO user = lb.validateUser((String)((DynaValidatorForm)form).get("email"),
                                                 (String)((DynaValidatorForm)form).get("password"));
              if(user != null)
                   // save UserDTO in session
                   request.getSession().setAttribute("user",user);
                   return (mapping.findForward("success"));
              else     // username/password not validated
                   // create ActionError and save in the request
                   ActionErrors errors = new ActionErrors();
                   ActionError error = new ActionError("error.login.invalid");
                   errors.add("login",error);
                   saveErrors(request,errors);
                   return (mapping.findForward("failure"));
    }

    Hi i try to build a dynamic web project in eclipse europa version.so i have opned my eclipse editor then right click selected the dynamic web project.onceit is done i wated to add the servelt so i have selcted the sevlet pressed ok then given name for it,next create servlet here iam getting the error lke this
    "An error occured when create servlet is finished" and in deatils it displyainf like thi
    "java.lang.Error: Unresolved compilation problems:
         The import org.eclipse.jst.j2ee.internal cannot be resolved
         CreateServletTemplateModel cannot be resolved to a type
         CreateServletTemplateModel cannot be resolved to a type
         at org.eclipse.jst.j2ee.web.ServletTemplate.<init>(ServletTemplate.java:3)"
    can any one help me here i have been stuck from morning doing nothing try to solve this problem
    thank u in advance
    vijay

  • Java.util.HashMap cannot be cast to org.apache.struts.action.ActionForm

    Hi!
    anybody could help me?
    i am getting java.util.HashMap cannot be cast to org.apache.struts.action.ActionForm error when I run my jsp...
    heres my code :
    CommentAction.java
    package com.provintl.rmis.actions;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Date;
    import java.util.HashMap;
    import java.util.Map;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    import javax.sql.DataSource;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import com.provintl.rmis.forms.CommentForm;
    public class CommentAction extends Action {
         Statement stmt = null;
         Connection con = null;
         javax.sql.DataSource dataSource;
         PreparedStatement ps = null;
         ResultSet rs=null;
         byte updFlg = 0;
         Map commentlist = new HashMap();
         /* (non-Javadoc)
         * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         @Override
         public ActionForward execute(ActionMapping mapping, ActionForm form,
                   HttpServletRequest request, HttpServletResponse response)
         throws Exception {
              CommentForm commentForm = new CommentForm();
              Date date = commentForm.getDaterecord();
              String comment = commentForm.getComment();
              //TODO : temporary 1 == rose
              int userID =1;
              int appID =1;
              String SelectQry = "SELECT "+
                                       "APPLICANT_TBL.CHFNAME, "+
                                       "APPLICANT_TBL.CHLNAME, "+
                                       "APPLICANT_TBL.INTAPPID, "+
                                       "USERHST_TBL.CHCOMMENT, "+
                                       "USERHST_TBL.DTDATECREATED, "+
                                       " USERHST_TBL.INTHSTID "+
                                       "FROM "+
                                       "APPLICANT_TBL "+
                                       "INNER JOIN USERHST_TBL ON (APPLICANT_TBL.INTAPPID = USERHST_TBL.INTAPPID) " +
                                       "WHERE APPLICANT_TBL.CHFNAME ='"+request.getParameter("first")+"' " +
                                                 "AND APPLICANT_TBL.CHLNAME ='"+request.getParameter("last")+"'";
              try {
                   dataSource = (DataSource)getDataSource(request, "RMIS");
                   con = dataSource.getConnection();
                   con.setAutoCommit(false);
                   stmt = con.createStatement();
                   System.out.println("database connected");
                   rs = stmt.executeQuery(SelectQry);
                   System.out.println("database connected");
                   int ctr = 1;
                   while(rs.next()){
                        commentlist.put(ctr,new CommentForm(rs.getString("CHFNAME"),rs.getDate("DTDATECREATED")));
                        ctr++;
                   if(updFlg !=0){
                        String insQry = "INSERT INTO RECRUIT.USERHST_TBL (CHCOMMENT, INTUSERID, INTAPPID)" +
                        "VALUES ('"+comment+"',"+userID+","+appID+")";
                        stmt.executeUpdate(insQry);
                        con.commit();
                        updFlg = 0;
                   HttpSession session = request.getSession();
                   session.setAttribute("commentlist", commentlist);
                   //con.setAutoCommit(true);
              } catch (SQLException se) {
                   System.out.println("We got an exception while preparing a statement:" +
                   "Probably bad SQL.");
                   System.out.println(SelectQry);
                   se.printStackTrace();
                   //System.exit(1);
              finally {
                   try {
                        rs.close();
                        stmt.close();
                        con.close();
                   } catch (SQLException e) {
                        e.printStackTrace();
              return mapping.findForward("comment");
    commentform.jsp
    =============
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html"     prefix="html"%>
    <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
    <%@ taglib uri="http://java.sun.com/jstl/sql_rt" prefix="sql"%>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <script>
    function putLabel(lbl, formName){
    if (opener && !opener.closed){
    opener.document.addapp.jobposition.value=lbl;
    window.close();
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>List of open positions</title>
    </head>
    <body>
    <h2>Job Positions Available</h2>
    <%
    int ctr = 1; %>
    <logic:iterate id="myString" name="commentlist" scope="session">
    <table width="100%" border="0">
    <%
    String bakcolor;
    if((ctr % 2) == 0){
         bakcolor = "WHITE";
         ctr++;
    else{
         bakcolor = "SILVER";
         ctr++;
    %>
    <tr><td bgcolor="<%= bakcolor %>">
    <bean:write name="myString" property="value" />
    </td></tr>
    ${commentlist}
    </table>
    </logic:iterate>
    </body>
    </html>
    thank you in advance!

    Shilnag wrote:
    Hello guys,
    I am new to java... I am trying to develop a web application using
    1.Struts1.2
    2.tomcat 5.5
    3.eclipse 3.2.2Big mistake. Nobody new to Java should jump straight into webapps, let alone using a framework like Struts. Debatably, even Eclipse should be left alone.
    It's precisely because of this that you're having problems. Presumably you're following a tutorial or something, but - as demonstrated - as soon as it goes wrong, you're stuck. Learn some core Java first, trust me

  • Javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts.taglib

    Hi
    i have a form from which i am gettin values and i am using struts to get those values and perform actions in my DAO,
    i am able to retrieve values from DAO but the value is not gettin printed in front end.. its throwing
    "javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts.taglib.html.BEAN" in any scope" error
    got any suggestions
    thankx

    Got the solution,. i had closed my <html:form> before closing one of my <html:form>
    thankx

  • Cannot find message resources under key org.apache.struts.action.MESSAGE ?

    Hi All,
    I am getting the following error.. while running a simple application in struts.
    Cannot find message resources under key org.apache.struts.action.MESSAGE ?
    As I have searched in google but could not find the concreate example so please help and give me a proper answer..
    my struts-config.xml file is as .....
    <code>
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE struts-config PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
    "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
    <struts-config>
    <!-- ========== Form Bean Definitions ============ -->
    <form-beans>
         <form-bean name="login" type="test.struts.LoginForm" />
    </form-beans>
    <!-- ========== Global Forward Definitions ========= -->
    <global-forwards>
    </global-forwards>
    <!-- ========== Action Mapping Definitions ======== -->
    <action-mappings>
    <action
         path="/login"
         type="test.struts.LoginAction"
         name="login"
         input="/jsp/LoginView.jsp"
         validate="true">
         <forward name="valid" path="/jsp/MainMenu.jsp" />
         <forward name="invalid" path="/jsp/LoginView.jsp" />
         </action>
    </action-mappings>
    <message-resources null="false" parameter="test.struts.MessageResources"/>
    </struts-config>
    </code>
    And my LoginView.jsp file is as:
    <code>
    <!-- LoginView.jsp -->
    <%@ taglib uri="/struts/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/struts/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/struts/WEB-INF/struts-logic.tld" prefix="struts" %>
    <HTML>
    <HEAD><TITLE><bean:message key="title.login" /></TITLE></HEAD>
    <BODY>
    <bean:message key="heading.login" />
    <html:errors />
    <html:form action="/login">
         <p>
         <bean:message key="label.userId" />:
         <html:text property="userId" size="10" />
         <br>
         <bean:message key="label.passWord" />:
         <html:password property="passWord" size="10" />
         <br><br>
         <html:submit>
              <bean:message key="button.submit" />
         </html:submit>
    </html:form>
    </BODY>
    </HTML>
    </code>
    MessageResources.properties is as :
    <code>
    button.submit=Send for Verification
    error.no.userId=<li>User ID is a required field</li>
    error.no.passWord=<li>Password is a required field</li>
    error.invalid.login=<li>The User ID and/or Password are invalid. Please try again.</li>
    errors.footer=</ul><hr>
    errors.header=<h3><font color="red">Validation Error</font></h3>You must correct the following error(s) before proceeding:<ul>
    label.userId=User ID
    label.passWord=Password
    heading.login=<H2>Enter your user information</H2>
    title.login=Login Screen
    title.mainmenu=Welcome
    heading.mainmenu=<H1>Welcome!</H1>
    label.userType=<H2>You are authorized to use this system as a</H2>
    </code>
    Please reply soon.
    Thanks in advance
    Amitindia

    Hi All,
    I am getting the following error.. while running a simple application in struts.
    Cannot find message resources under key org.apache.struts.action.MESSAGE ?
    As I have searched in google but could not find the concreate example so please help and give me a proper answer.. my struts-config.xml file is as .....
    <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE struts- 
      config PUBLIC "-//Apache Software Foundation//DTD Struts
    Configuration 1.0//EN" "http://jakarta.apache.org/struts/dtds/struts-
    config_1_0.dtd"> <struts-config> <!-- ========== Form Bean
    Definitions ============ --> <form-beans> <form-bean name="login"
    type="test.struts.LoginForm" /> </form-beans> <!-- ========== Global Forward Definitions ========= --> <global-forwards> </global-
    forwards> <!-- ========== Action Mapping Definitions ======== --> <action-mappings> <action path="/login" type="test.struts.LoginAction" name="login" input="/jsp/LoginView.jsp" validate="true"> <forward name="valid" path="/jsp/MainMenu.jsp" /> <forward name="invalid" path="/jsp/LoginView.jsp" /> </action> </action-mappings> <message-resources null="false" parameter="test.struts.MessageResources"/> </struts-config>
    And my LoginView.jsp file is as:
    <!-- LoginView.jsp --> <%@ taglib uri="/struts/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/struts/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/struts/WEB-INF/struts-logic.tld" prefix="struts" %> <HTML> <HEAD><TITLE><bean:message key="title.login" /></TITLE></HEAD> <BODY> <bean:message key="heading.login" /> <html:errors /> <html:form action="/login">
    <bean:message key="label.userId" />: <html:text property="userId" size="10" /> <br> <bean:message key="label.passWord" />: <html:password property="passWord" size="10" /> <br><br> <html:submit> <bean:message key="button.submit" /> </html:submit> </html:form> </BODY> </HTML>
    MessageResources.properties is as :
    button.submit=Send for Verification error.no.userId=<li>User ID is a required field</li> error.no.passWord=<li>Password is a required field</li> error.invalid.login=<li>The User ID and/or Password are invalid. Please try again.</li> errors.footer=</ul><hr> errors.header=<h3><font color="red">Validation Error</font></h3>You must correct the following error(s) before proceeding:<ul> label.userId=User ID label.passWord=Password heading.login=<H2>Enter your user information</H2> title.login=Login Screen title.mainmenu=Welcome heading.mainmenu=<H1>Welcome!</H1> label.userType=<H2>You are authorized to use this system as a</H2>
    Please reply soon. Thanks in advance Amitindia                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Proxying servlets and JSPs with apache

    We have a couple of servlets within our application, the rest of it
    being JSPs.
    We are having a problems maintaining the session state across links from
    the JSPs to the servlets. It works fine with WL as the web server when
    the servlet picks up the same session as the JSPs, but when we are using
    the apache bridge, the servlet seems to have a new session.
    We are using WL5.1.0 SP6 on solaris.
    The JSPs are proxied by extension, and the servlets by location -
    everything under the servlet directory being directed to a servlet.
    Is there anything we need to do in the configuration to allow this to
    work?
    Thanks,
    Steve

    Core Servlets is pretty good. I have both parts.
    One day I'm actually going to read them.you mean these two right?
    Core Servlets and Javaserver Pages: Core Technologies, Vol. 2 (2nd Edition) (Core) by Marty Hall, Larry Brown, and Yaakov Chaikin
    Core Servlets and JavaServer Pages, Vol. 1: Core Technologies, Second Edition by Marty Hall and Larry Brown
    I should buy the Vol 1 first right?

  • Difference between Java Server Faces and Apache Struts

    Hi ,
    I'm quite new to Java Server Faces and Apache Struts. I wonder are they two comparable Frameworks for web presentation?
    And can anybody elaborate please, if they differ in what aspects?
    Thanks
    Jaffar Shaikh

    Here are slides from a presentation by Craig McClanahan that compares them (I believe you can search for other articles on this topic): http://www.baychi.org/calendar/files/Struts-And-Faces/Struts-And-Faces.pdf

  • Apache web server / run Servlets and JSP

    Hello. I need to know how to run servlets and JSP's with Apache web server

    install Tomcat and use it alongise of apache. Apache cannot serve either servlets or jsp's on its own

Maybe you are looking for

  • Itunes wont let me download 11 to connect my iphone

    trying to connect my iphone 4G S and it tells me to download ituens 11 and i get half way thro and tells me to close ituens to complet but says there is an eror

  • So slow, want to return it so badly

    Hello, Does anyone have a remedy for my Blackberry Torch? It is extremely slow and browsing websites is impossible (so slow you just want to turn it off).  Do you know anything about the warranty? Giving it to service to renew the phone or return it?

  • Display Connection Problems?

    My Macbook Pro (15", Early 2011) does not seem to recognize my screen. Specifically, the Display Connecter status in System Profiler reads "No Display Connected" for BOTH the AMD Radeon card and the Intel HD Graphics card. Curiously the Color LCD sta

  • QuickTime X and iTune pauses.

    WHY QuickTime X and iTUNE PAUSES RANDOMLY?? Is this a bug or what? When i try to watch movie, it just pause randomly for about 3 - 5 seocnds. Now even my google chrome is pausing. This is totally painful and ridiculous. Why apple do not release and u

  • Where to download Adobe Document Services Patch?

    Dear all,     Where do i download the Adobe Document Services Patch ? Thank you Regards, Joan