Upgarding to struts 1.3.8

Hi all,
I am quite new to struts and have, perhaps a quite stupid error.
Until now a used Struts 1.2.9 (because my IDE had it onboard). Now I
want to use some features of the version 1.3.8 and moved to this version
that for.
But now I have a strange error while starting Jboss server
The error looks like:
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.
java.lang.NoClassDefFoundError:
org/apache/commons/chain/config/ConfigParser
at
org.apache.struts.action.ActionServlet.initChain(ActionServlet.java:1680)
Can anyone help me to solve this problem?
Thanks

Thanx for that link :-)
I have added commons-chain_1.1.jar. But now i can another error
org.apache.jasper.JasperException: java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProcessor
I googled it some users said to add <Loader delegate="true"/> in CONTEXT.xml but this did not help me. And in another site some one had mentioned to remove the catlina.jar from the web application and have it only in the tomcat server. In my case it is only in the tomcat/lib folder.
Can u suggest me what are the other possiblities

Similar Messages

  • Using a variable in Struts config, to redirect

    In the struts-config file,
    to redirect to a different site, I can use
    redirect="true"
    and mention full path, in my <forward path=
    variable.
    1. Is there a better way to do it?
    2. Since I have to do it in multiple places, is it possible to use a variable? I mean, something like this
    <forward
    name="success"
    path="URL/abc.html" />
    Where URL is a variable name that the site path? This way, I can reuse the variable to redirect to other pages too (xyz.html, for example)

    Hi there,
    I don't know...is there only one URL you are using ore are there more than one? Because if it's the same path everytime you can try using this:
    <forward
    name="success"
    path="./abc.html" />
        ./               // This is the shortcut for the directory you are currently using.
        ../              // This is the shortcut for the directory above the one you are currently using.This code should do it. If not, try to create a var named for example "vpath" and put it like this:
    <forward
    name="success"
    path=vpath+"abc.html" />Try and tell if it worked ;)
    X--spYro--X

  • J2EE Struts - Database connection failed - help???:(

    Hello,
    I have built a little web application and it works without any problems. In the next step I tried to add a database connection but I have already worked on it for at least one day and I could not fix the problem with the database connection.
    I downloaded the MySQL Server 5.0 and installed it, furthermore I have downloaded the jdbc driver mysql-connector-java-3.1.11.zip and extracted it to the MySQL Server 5.0 directory. Furthermore I have added under system settings - system - etended - system variables the whole path to the driver -> C:\Programme\MySQL\MySQL Server 5.0\mysql-connector-java-3.1.11\mysql-connector-java-3.1.11-bin.jar to the CLASSPATH systemvariable.
    Then I have startet the SQL Server 5.0 with mysqld --console from the command line.
    Furthermore I have added under Project-Properties-Java Build Path - Libraries - Add External JARs in Eclipse the mysql-connector-java-3.1.11-bin.jar to my Struts WebProject.
    To test the whole thing I have added to the existing test-database from mysql a table named owner and wanted to test the database connection in the Action-class with the following statements - I quote the whole execute method of the OwnerAction class:
    public ActionForward execute(
                     ActionMapping mapping,
                     ActionForm form,
                     HttpServletRequest request,
                     HttpServletResponse response)
                     throws Exception {
                   OwnerForm ownerForm = (OwnerForm) form;
                   String greet = ownerForm.getGreet();
                   String name = ownerForm.getName();
                   request.setAttribute("name", name);
                   request.setAttribute("greet", greet);
                   String address = ownerForm.getAddress();
                   String email = ownerForm.getEmail();
                   int tel = ownerForm.getTel();
                   Connection conn = null;
                   Statement stmt = null;
                   ResultSet rs = null;
                   DriverManager.registerDriver(new org.gjt.mm.mysql.Driver());
                   conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","sa");
                   try {
                         //conn = dataSource.getConnection();
                         stmt = conn.createStatement();
                         int id = 0;
                         rs = stmt.executeQuery("select max(id) as counter from owner");
                         while(rs.next()){
                            id = rs.getInt("counter");
                         id += 1;
                         stmt.executeUpdate("insert into owner values("+id+", '"+greet+"', '"+name+"', '"+email+"', '"+address+"', "+tel+")");
                         rs.close();
                         stmt.close();
                         conn.close();
                      catch(SQLException e){
                         throw new SQLException("database error");
                      // Forward control to the specified success target
                      return (mapping.findForward("success"));
          }But when I execute the WebApplication and the Action will be called the following error message appears in the browser:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Servlet execution threw an exception
         org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
    root cause
    java.lang.NoClassDefFoundError: org/gjt/mm/mysql/Driver
         com.asprise.struts.action.OwnerAction.execute(OwnerAction.java:72)
         org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5 logs.
    It must depend with anything that the driver was not found but I have defined it in the CLASSPATH variable and added it to the Web-Project in eclispe.
    Has anybody an idea what I have else made wrong or have forgotten??:(:(:(
    thanks in advance
    lg
    pat

    One thing I have forgotten - I have also copied the mysql-connector-java-3.1.11-bin.jar in the WebRoot\WEB-INF\lib directory of my EasyStruts WebApplication.
    Can anything else be wrong??:(:((
    regards

  • Why dynamic table creation with struts working only for JDK1.3.1_02 version

    Row
    import java.util.Vector;
    public class Row
    private static int colsize;
    private Column[] columns;
    public void setColumns(Column[] columns)
    System.out.println("SetColumns");
    this.columns = columns;
    public void setColumn(int i, Column column)
         System.out.println("setting"+ i+"th column"+column);
    public Column[] getColumns()
    return null;
    public Column getColumns(int i)
    System.out.println("Column"+i);
    System.out.println("Colsize"+colsize);
    if(columns == null)
    columns= new Column[colsize];
    if(columns[i] == null)
    columns[i] = new Column();
    return columns;
    public int getColsize()
         return colsize;
    public static void setColsize(int size)
         colsize = size;
    Column:
    public class Column
    private String value;
    public void setValue(String value)
    System.out.println("Value="+value);
    this.value = value;
    public String getValue()
    return value;
    ApplicationResources:
    button.cancel=Cancel
    button.confirm=Confirm
    button.reset=Reset
    button.save=Save
    database.load=Cannot load database from {0}
    error.database.missing=<li>User database is missing, cannot validate logon credentials</li>
    error.fromAddress.format=<li>Invalid format for From Address</li>
    error.fromAddress.required=<li>From Address is required</li>
    error.fullName.required=<li>Full Name is required</li>
    error.host.required=<li>Mail Server is required</li>
    error.noSubscription=<li>No Subscription bean in user session</li>
    error.password.required=<li>Password is required</li>
    error.password2.required=<li>Confirmation password is required</li>
    error.password.match=<li>Password and confirmation password must match</li>
    error.password.mismatch=<li>Invalid username and/or password, please try again</li>
    error.replyToAddress.format=<li>Invalid format for Reply To Address</li>
    error.transaction.token=<li>Cannot submit this form out of order</li>
    error.type.invalid=<li>Server Type must be 'imap' or 'pop3'</li>
    error.type.required=<li>Server Type is required</li>
    error.username.required=<li>Username is required</li>
    error.username.unique=<li>That username is already in use - please select another</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>
    errors.ioException=I/O exception rendering error messages: {0}
    heading.autoConnect=Auto
    heading.subscriptions=Current Subscriptions
    heading.host=Host Name
    heading.user=User Name
    heading.type=Server Type
    heading.action=Action
    index.heading=MailReader Demonstration Application Options
    index.logon=Log on to the MailReader Demonstration Application
    index.registration=Register with the MailReader Demonstration Application
    index.title=MailReader Demonstration Application (Struts 1.0-b1)
    index.tour=A Walking Tour of the Example Application
    linkSubscription.io=I/O Error: {0}
    linkSubscription.noSubscription=No subscription under attribute {0}
    linkUser.io=I/O Error: {0}
    linkUser.noUser=No user under attribute {0}
    logon.title=MailReader Demonstration Application - Logon
    mainMenu.heading=Main Menu Options for
    mainMenu.logoff=Log off MailReader Demonstration Application
    mainMenu.registration=Edit your user registration profile
    mainMenu.title=MailReader Demonstration Application - Main Menu
    option.imap=IMAP Protocol
    option.pop3=POP3 Protocol
    prompt.autoConnect=Auto Connect:
    prompt.fromAddress=From Address:
    prompt.fullName=Full Name:
    prompt.mailHostname=Mail Server:
    prompt.mailPassword=Mail Password:
    prompt.mailServerType=Server Type:
    prompt.mailUsername=Mail Username:
    prompt.password=Password:
    prompt.password2=(Repeat) Password:
    prompt.replyToAddress=Reply To Address:
    prompt.username=Username:
    registration.addSubscription=Add
    registration.deleteSubscription=Delete
    registration.editSubscription=Edit
    registration.title.create=Register for the MailReader Demostration Application
    registration.title.edit=Edit Registration for the MailReader Demonstration Application
    subscription.title.create=Create New Mail Subscription
    subscription.title.delete=Delete Existing Mail Subscription
    subscription.title.edit=Edit Existing Mail Subscription
    LogonForm
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionError;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    public class LogonForm extends ActionForm
    private String username;
    private String password;
    private String errors;
    public String getUsername()
    return username;
    public void setUsername(String username)
    this.username = username;
    public void setPassword(String password)
    this.password = password;
    public String getPassword()
    return password;
    public String getErrors()
         return errors;
    public void setErrors(String errors)
         this.errors = errors;
    public ActionErrors validate(ActionMapping mapping,
    HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();
    if ((username == null) || (username.length() < 1))
    errors.add("username", new ActionError("error.username.required"));
    if ((password == null) || (password.length() < 1))
    errors.add("password", new ActionError("error.password.required"));
    return errors;
    TableForm
    import org.apache.struts.action.ActionForm;
    import java.util.Vector;
    public class TableForm extends ActionForm
    private static int rowsize;
    private Row[] rows;
    public Row getRows(int i)
    System.out.println("Row"+i);
    System.out.println("Rowsize"+rowsize);
    if(rows == null)
    rows = new Row[rowsize];
    if(rows[i] == null)
    rows[i] = new Row();
    return rows[i];
    public Row[] getRows()
         return null;
    public void setRows(Row[] rows)
         System.out.println("SetRows");
         // this.rows=rows;
    public static void setRowsize(int size)
         rowsize = size;
    public int getRowSize()
         return rowsize;
    LogonAction
    import java.io.IOException;
    import java.util.Hashtable;
    import java.util.Locale;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpSession;
    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.action.ActionServlet;
    import org.apache.struts.util.MessageResources;
    public class LogonAction extends Action
    public ActionForward execute(ActionMapping mapping,
                        ActionForm form,
                        HttpServletRequest request,
                        HttpServletResponse response)
         throws IOException, ServletException {
    LogonForm logonForm = (LogonForm) form;
    System.out.println(logonForm);
    System.out.println(logonForm.getUsername());
    System.out.println(logonForm.getPassword());
    if(logonForm.getUsername().equals("test") && logonForm.getPassword().equals("test"))
    //TableForm tform = new TableForm();
    //tform.setRowsize(2);
    //tform.getRows(0).setColsize(2);
    //tform.getRows(1).setColsize(2);
    //request.getSession().setAttribute("tableForm",tform);
         System.out.println("Table Form setRowSize");
    TableForm.setRowsize(2);
         System.out.println("Table Form set ColSize");
    Row.setColsize(2);
         System.out.println("Returning success");
    return mapping.findForward("success");
    else
              ActionErrors errors = new ActionErrors();
              errors.add("password",
    new ActionError("error.password.mismatch"));
    saveErrors(request, errors);
    //logonForm.setErrors("LoginError");
    return mapping.findForward("failure");
    <?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">
    <!--
    This is the Struts configuration file for the example application,
    using the proposed new syntax.
    NOTE: You would only flesh out the details in the "form-bean"
    declarations if you had a generator tool that used them to create
    the corresponding Java classes for you. Otherwise, you would
    need only the "form-bean" element itself, with the corresponding
    "name" and "type" attributes.
    -->
    <struts-config>
    <form-beans>
    <!-- Logon form bean -->
    <form-bean name="logonForm"
    type="LogonForm"/>
    <form-bean name="tableForm"
    type="TableForm"/>
    <form-bean name="profileForm"
    type="ProfileForm"/>
    </form-beans>
    <global-forwards>
    <forward name="success" path="/Profile.jsp"/>
    </global-forwards>
    <!-- ========== Action Mapping Definitions ============================== -->
    <action-mappings>
    <!-- Edit user registration -->
    <action path="/logon"
    type="LogonAction"
    name="logonForm"
    scope="request"
    validate="false"
    input="/Test.jsp">
    <forward name="success" path="/Table.jsp"/>
    <forward name="failure" path="/Test.jsp"/>
    </action>
    <action path="/table"
    type="TableAction"
    name="tableForm"
    scope="request"
    validate="false">
    <forward name="success" path="/Bean.jsp"/>
    <forward name="failure" path="/Table.jsp"/>
    </action>
    <action path="/profile"
    type="ProfileAction"
    name="profileForm"
    scope="request"
    validate="false"
    parameter="method">
    <forward name="edit" path="/EditProfile.jsp"/>
    <forward name="show" path="/Profile.jsp"/>
    </action>
    </action-mappings>
    </struts-config>
    Test.jsp
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <html:html locale="true">
    <html:form action="/logon" >
    <center>
    <table>
    <tr>
    <td> Username </td>
    <td> <html:text property="username" size="16" maxlength="16"/> </td>
    <td> <html:errors property="username" /> </td>
    </tr>
    <tr>
    <td> Password </td>
    <td> <html:password property="password" size="16" maxlength="16"
    redisplay="false"/> </td>
    <td><html:errors property="password" /> </td>
    </tr>
    </table>
    </center>
    <center> <html:submit property="submit" value="Submit"/> </center>
    </html:form>
    </html:html>
    Table.jsp
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <html:html locale="true">
    <html:form action="/table" >
    <center>
    <table>
    <tr>
    <td> <html:text property="rows[0].columns[0].value" /> </td>
    <td> <html:text property="rows[0].columns[1].value" /></td>
    </tr>
    <tr>
    <td> <html:text property="rows[1].columns[0].value" /> </td>
    <td> <html:text property="rows[1].columns[1].value" /></td>
    </tr>
    </table>
    </center>
    <center> <html:submit property="submit" value="Submit"/> </center>
    </html:form>
    </html:html>

    The above application runs only with JDK1.3.1_02 and not with any other version. This application is creating dynamic table using struts.
    Can anybody help me on the same
    also appending web.xml contents:
    <?xml version="1.0" ?>
    <!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>
    <!-- Action Servlet Configuration -->
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
    <param-name>application</param-name>
    <param-value>ApplicationResources</param-value>
    </init-param>
    <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>
    <init-param>
    <param-name>validate</param-name>
    <param-value>true</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
    </servlet>
    <!-- Action Servlet Mapping -->
    <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    <!--Welcome file list starts here -->
    <welcome-file-list>
    <welcome-file>
    /test.jsp
    </welcome-file>
    </welcome-file-list>
    <!-- Struts Tag Library Descriptors -->
    <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
    </taglib>
    </web-app>
    validate-rules.xml
    <!DOCTYPE form-validation PUBLIC
    "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
    "http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
    <!--
    This file contains the default Struts Validator pluggable validator
    definitions. It should be placed somewhere under /WEB-INF and
    referenced in the struts-config.xml under the plug-in element
    for the ValidatorPlugIn.
    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,
    /WEB-INF/validation.xml"/>
    </plug-in>
    These are the default error messages associated with
    each validator defined in this file. They should be
    added to your projects ApplicationResources.properties
    file or you can associate new ones by modifying the
    pluggable validators msg attributes in this file.
    # Struts Validator Error Messages
    errors.required={0} is required.
    errors.minlength={0} can not be less than {1} characters.
    errors.maxlength={0} can not be greater than {1} characters.
    errors.invalid={0} is invalid.
    errors.byte={0} must be a byte.
    errors.short={0} must be a short.
    errors.integer={0} must be an integer.
    errors.long={0} must be a long.
    errors.float={0} must be a float.
    errors.double={0} must be a double.
    errors.date={0} is not a date.
    errors.range={0} is not in the range {1} through {2}.
    errors.creditcard={0} is an invalid credit card number.
    errors.email={0} is an invalid e-mail address.
    -->
    <form-validation>
    <global>
    <validator name="required"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateRequired"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    msg="errors.required">
    <javascript><![CDATA[
    function validateRequired(form) {
    var isValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oRequired = new required();
    for (x in oRequired) {
         var field = form[oRequired[x][0]];
    if (field.type == 'text' ||
    field.type == 'textarea' ||
    field.type == 'file' ||
    field.type == 'select-one' ||
    field.type == 'radio' ||
    field.type == 'password') {
    var value = '';
                                  // get field's value
                                  if (field.type == "select-one") {
                                       var si = field.selectedIndex;
                                       if (si >= 0) {
                                            value = field.options[si].value;
                                  } else {
                                       value = field.value;
    if (trim(value).length == 0) {
         if (i == 0) {
         focusField = field;
         fields[i++] = oRequired[x][1];
         isValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return isValid;
    // Trim whitespace from left and right sides of s.
    function trim(s) {
    return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
    ]]>
    </javascript>
    </validator>
    <validator name="requiredif"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateRequiredIf"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    org.apache.commons.validator.Validator,
    javax.servlet.http.HttpServletRequest"
    msg="errors.required">
    </validator>
    <validator name="minlength"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateMinLength"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.minlength">
    <javascript><![CDATA[
    function validateMinLength(form) {
    var isValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oMinLength = new minlength();
    for (x in oMinLength) {
    var field = form[oMinLength[x][0]];
    if (field.type == 'text' ||
    field.type == 'textarea') {
    var iMin = parseInt(oMinLength[x][2]("minlength"));
    if ((trim(field.value).length > 0) && (field.value.length < iMin)) {
    if (i == 0) {
    focusField = field;
    fields[i++] = oMinLength[x][1];
    isValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return isValid;
    }]]>
    </javascript>
    </validator>
    <validator name="maxlength"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateMaxLength"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.maxlength">
    <javascript><![CDATA[
    function validateMaxLength(form) {
    var isValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oMaxLength = new maxlength();
    for (x in oMaxLength) {
    var field = form[oMaxLength[x][0]];
    if (field.type == 'text' ||
    field.type == 'textarea') {
    var iMax = parseInt(oMaxLength[x][2]("maxlength"));
    if (field.value.length > iMax) {
    if (i == 0) {
    focusField = field;
    fields[i++] = oMaxLength[x][1];
    isValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return isValid;
    }]]>
    </javascript>
    </validator>
    <validator name="mask"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateMask"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.invalid">
    <javascript><![CDATA[
    function validateMask(form) {
    var isValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oMasked = new mask();
    for (x in oMasked) {
    var field = form[oMasked[x][0]];
    if ((field.type == 'text' ||
    field.type == 'textarea') &&
    (field.value.length > 0)) {
    if (!matchPattern(field.value, oMasked[x][2]("mask"))) {
    if (i == 0) {
    focusField = field;
    fields[i++] = oMasked[x][1];
    isValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return isValid;
    function matchPattern(value, mask) {
    return mask.exec(value);
    }]]>
    </javascript>
    </validator>
    <validator name="byte"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateByte"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.byte"
    jsFunctionName="ByteValidations">
    <javascript><![CDATA[
    function validateByte(form) {
    var bValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oByte = new ByteValidations();
    for (x in oByte) {
         var field = form[oByte[x][0]];
    if (field.type == 'text' ||
    field.type == 'textarea' ||
    field.type == 'select-one' ||
                                  field.type == 'radio') {
                                  var value = '';
                                  // get field's value
                                  if (field.type == "select-one") {
                                       var si = field.selectedIndex;
                                       if (si >= 0) {
                                            value = field.options[si].value;
                                  } else {
                                       value = field.value;
    if (value.length > 0) {
    if (!isAllDigits(value)) {
    bValid = false;
    if (i == 0) {
    focusField = field;
    fields[i++] = oByte[x][1];
    } else {
         var iValue = parseInt(value);
         if (isNaN(iValue) || !(iValue >= -128 && iValue <= 127)) {
         if (i == 0) {
         focusField = field;
         fields[i++] = oByte[x][1];
         bValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return bValid;
    }]]>
    </javascript>
    </validator>
    <validator name="short"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateShort"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.short"
    jsFunctionName="ShortValidations">
    <javascript><![CDATA[
    function validateShort(form) {
    var bValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oShort = new ShortValidations();
    for (x in oShort) {
         var field = form[oShort[x][0]];
    if (field.type == 'text' ||
    field.type == 'textarea' ||
    field.type == 'select-one' ||
    field.type == 'radio') {
    var value = '';
                                  // get field's value
                                  if (field.type == "select-one") {
                                       var si = field.selectedIndex;
                                       if (si >= 0) {
                                            value = field.options[si].value;
                                  } else {
                                       value = field.value;
    if (value.length > 0) {
    if (!isAllDigits(value)) {
    bValid = false;
    if (i == 0) {
    focusField = field;
    fields[i++] = oShort[x][1];
    } else {
         var iValue = parseInt(value);
         if (isNaN(iValue) || !(iValue >= -32768 && iValue <= 32767)) {
         if (i == 0) {
         focusField = field;
         fields[i++] = oShort[x][1];
         bValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return bValid;
    }]]>
    </javascript>
    </validator>
    <validator name="integer"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateInteger"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.integer"
    jsFunctionName="IntegerValidations">
    <javascript><![CDATA[
    function validateInteger(form) {
    var bValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oInteger = new IntegerValidations();
    for (x in oInteger) {
         var field = form[oInteger[x][0]];
    if (field.type == 'text' ||
    field.type == 'textarea' ||
    field.type == 'select-one' ||
    field.type == 'radio') {
    var value = '';
                                  // get field's value
                                  if (field.type == "select-one") {
                                       var si = field.selectedIndex;
                                  if (si >= 0) {
                                       value = field.options[si].value;
                                  } else {
                                       value = field.value;
    if (value.length > 0) {
    if (!isAllDigits(value)) {
    bValid = false;
    if (i == 0) {
         focusField = field;
                                  fields[i++] = oInteger[x][1];
    } else {
         var iValue = parseInt(value);
         if (isNaN(iValue) || !(iValue >= -2147483648 && iValue <= 2147483647)) {
         if (i == 0) {
         focusField = field;
         fields[i++] = oInteger[x][1];
         bValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return bValid;
    function isAllDigits(argvalue) {
    argvalue = argvalue.toString();
    var validChars = "0123456789";
    var startFrom = 0;
    if (argvalue.substring(0, 2) == "0x") {
    validChars = "0123456789abcdefABCDEF";
    startFrom = 2;
    } else if (argvalue.charAt(0) == "0") {
    validChars = "01234567";
    startFrom = 1;
    } else if (argvalue.charAt(0) == "-") {
    startFrom = 1;
    for (var n = startFrom; n < argvalue.length; n++) {
    if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false;
    return true;
    }]]>
    </javascript>
    </validator>
    <validator name="long"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateLong"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.long"/>
    <validator name="float"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateFloat"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.float"
    jsFunctionName="FloatValidations">
    <javascript><![CDATA[
    function validateFloat(form) {
    var bValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oFloat = new FloatValidations();
    for (x in oFloat) {
         var field = form[oFloat[x][0]];
    if (field.type == 'text' ||
    field.type == 'textarea' ||
    field.type == 'select-one' ||
    field.type == 'radio') {
         var value = '';
                                  // get field's value
                                  if (field.type == "select-one") {
                                       var si = field.selectedIndex;
                                       if (si >= 0) {
                                       value = field.options[si].value;
                                  } else {
                                       value = field.value;
    if (value.length > 0) {
    // remove '.' before checking digits
    var tempArray = value.split('.');
    var joinedString= tempArray.join('');
    if (!isAllDigits(joinedString)) {
    bValid = false;
    if (i == 0) {
    focusField = field;
    fields[i++] = oFloat[x][1];
    } else {
         var iValue = parseFloat(value);
         if (isNaN(iValue)) {
         if (i == 0) {
         focusField = field;
         fields[i++] = oFloat[x][1];
         bValid = false;
    if (fields.length > 0) {
    focusField.focus();
    alert(fields.join('\n'));
    return bValid;
    }]]>
    </javascript>
    </validator>
    <validator name="double"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateDouble"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.double"/>
    <validator name="date"
    classname="org.apache.struts.validator.FieldChecks"
    method="validateDate"
    methodParams="java.lang.Object,
    org.apache.commons.validator.ValidatorAction,
    org.apache.commons.validator.Field,
    org.apache.struts.action.ActionErrors,
    javax.servlet.http.HttpServletRequest"
    depends=""
    msg="errors.date"
    jsFunctionName="DateValidations">
    <javascript><![CDATA[
    function validateDate(form) {
    var bValid = true;
    var focusField = null;
    var i = 0;
    var fields = new Array();
    oDate = new DateValidations();
    for (x in oDate) {
    var value = form[oDate[x][0]].value;
    var datePattern = oDate[x][2]("datePatternStrict");
    if ((form[oDate[x][0]].type == 'text' ||
    form[oDate[x][0]].type == 'textarea') &&
    (value.length > 0) &&
    (datePattern.length > 0)) {
    var MONTH = "MM";
    var DAY = "dd";
    var YEAR = "yyyy";
    var orderMonth = datePattern.indexOf(MONTH);
    var orderDay = datePattern.indexOf(DAY);
    var orderYear = datePattern.indexOf(YEAR);
    if ((orderDay < orderYear && orderDay > orderMonth)) {
    var iDelim1 = orderMonth + MONTH.length;
    var iDelim2 = orderDay + DAY.length;
    var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
    var delim2 = datePattern.substring(iDelim2, iDelim2 + 1);
    if (iDelim1 == orderDay && iDelim2 == orderYear) {
    dateRegexp = new RegExp("^(\\d{2})(\\d{2})(\\d{4})$");
    } else if (iDelim1 == orderDay) {
    dateRegexp = new RegExp("^(\\d{2})(\\d{2})[" + delim2 + "](\\d{4})$");
    } else if (iDelim2 == orderYear) {
    dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})(\\d{4})$");
    } else {
    dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})[" + delim2 + "](\\d{4})$");
    var matched = dateRegexp.exec(value);
    if(matched != null) {
    if (!isValidDate(matched[2], matched[1], matched[3])) {
    if (i == 0) {
    focusField = form[oDate[x][0]];
    fields[i++] = oDate[x][1];
    bValid = false;
    } else {
    if (i == 0) {
    focusField = form[oDate[x][0]];
    fields[i++] = oDate[x][1];
    bValid = false;
    } else if ((orderMonth < orderYear && orderMonth > orderDay)) {
    var iDelim1 = orderDay + DAY.length;
    var iDelim2 = orderMonth + MONTH.length;
    var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
    var delim2 = datePattern.substring(iDelim2, iDelim2 + 1);
    if (iDelim1 == orderMonth && iDelim2 == orderYear) {
    dateRegexp = new RegExp("^(\\d{2})(\\d{2})(\\d{4})$");
    } else if (iDelim1 == orderMonth) {
    dateRegexp = new RegExp("^(\\d{2})(\\d{2})[" + delim2 + "](\\d{4})$");
    } else if (iDelim2 == orderYear) {
    dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})(\\d{4})$");
    } else {
    dateRegexp = new RegExp("^(\\d{2})[" + delim1 + "](\\d{2})[" + delim2 + "](\\d{4})$");
    var matched = dateRegexp.exec(value);
    if(matched != null) {
    if (!isValidDate(matched[1], matched[2], matched[3])) {
    if (i == 0) {
    focusField = form[oDate[x][0]];
    fields[i++] = oDate[x][1];
    bValid = false;
    } else {
    if (i == 0) {
    focusField = form[oDate[x][0]];
    fields[i++] = oDate[x][1];
    bValid = false;
    } else if ((orderMonth > orderYear && orderMonth < orderDay)) {
    var iDelim1 = orderYear + YEAR.length;
    var iDelim2 = orderMonth + MONTH.length;
    var delim1 = datePattern.substring(iDelim1, iDelim1 + 1);
    var delim2 = datePattern.substring(iDelim2, iDelim2 + 1);
    if (iDelim1 == orderMonth && iDelim2 == orderDay) {
    dateRegexp = new RegExp("^(\\d{4})(\\d{2})(\\d{2})$");
    } else if (iDelim1 == orderMonth) {
    dateRegexp = new RegExp("^(\\d{4})(\\d{2})[" + delim2 + "](\\d{2})$");
    } else if (iDelim2 == orderDay) {
    dateRegexp = new RegExp("^(\\d{4})[" + delim1 + "](\\d{2})(\\d{2})$");
    } else {
    dateRegexp = new Reg

  • URGENT! Need help to portalize a Strut JSP App for Portal!

    Hi,
    I have create a little application using Strut ADF. This application only have one page. Can someone tell me how to portalize this in order to deployed it in Portal. I have create my DataSource in OEM and the only thing left is to portalize this jsp.
    I have read the "How to create a Struts Portlet" but I don't understand it.
    Please help me deployed this app to Portal. Is there any tutorial about this?
    Thank you!

    try this article
    http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/articles/pdkstruts/portletize-your-app.html
    You will also need to download the relevant tag library for the pdk-struts extensions.
    You can also download the java portlet wizard as an add-in for jdeveloper. This makes the creation of the files (for example provider.xml) required by portal easier.

  • STRUTS - Cannot retrieve definition for form bean null -aaaarrrrgh

    Hi Folks,
    my head hurts and i become crazy... i know that a lot of people asked this question before, but i did not found any suitable solution.
    I have simple a jsp page, containing a form which should be handled by struts. I tried everything, but i did not found my mistake.
    Can anyone help me please?
    JSP:
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <%@ page contentType="text/html;charset=windows-1252"%>
    <html:html locale="true">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Anmeldung f?r GOLEM Quickplayout</title>
    </head>
    <body>
    <html:errors/>
    <html:form action="checkLogin.do">
      <table cellspacing="3" cellpadding="2" border="0" width="100%" align="left">
        <tr>
          <td>
            <bean:message key="prompt.username"/>
          </td>
          <td>
            <html:text property="username"/>
          </td>
        </tr>
        <tr>
          <td>
            <bean:message key="prompt.password"/>
          </td>
          <td>
            <html:text property="password"/>
          </td>
        </tr>
      </table>
    </html:form>i tryed a lot for the FORM -Tag, for instance:
    <html:form action="checkLogin.do"> or
    <html:form action="/checkLogin.do"> or
    <html:form action="/checkLogin"> but all throws the same exception. :(
    struts-config.xml
      <form-beans>
        <form-bean name="loginForm" type="de.orb.quick.view.LoginForm"/>
      </form-beans>
      <action-mappings>
      <action path="/login" type="de.orb.quick.view.LoginAction" name="loginForm" input="/login.jsp" scope="session" unknown="true">
        <forward name="success" path="/showData.jsp"/>
      </action>
        <action path="/checkLogin" type="de.orb.quick.view.CheckLogonAction" unknown="false" input="/login.jsp">
          <forward name="success" path="/storeRequestData.do"/>
          <forward name="failure" path="/login.do"/>
        </action>
    Exception:
    javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null
         at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:831)
         at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
         at _login._jspService(login.jsp:11)     [/login.jsp]
    LoginAction:
      public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        return mapping.findForward("success");
    LoginForm:
    public class LoginForm extends ActionForm  {
      private String password = "";
      private String username = "";
      public void reset(ActionMapping mapping, HttpServletRequest request) {
        super.reset(mapping, request);
      public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        return super.validate(mapping, request);
      public String getPassword() {
        return password;
      public void setPassword(String password) {
        this.password = password;
      public String getUsername() {
        return username;
      public void setUsername(String username) {
        this.username = username;
      }Sorry for this stupid question, but how can i avoid this exception while using struts TagLibs?
    I tried to face the jsp with another action, but this does not change anything.
    Thank you in advance
    Mirko

    javax.servlet.jsp.JspException: Cannot retrieve definition for form bean myfrom
         at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:831)
         at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
         at jsp_servlet.__index._jspService(__index.java:155)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6291)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:97)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3575)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2573)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)

  • New to Struts - logic:if error - am I not properly defining a bean?

    I am going through what are for the most part simple Struts examples and tutorials on my company's Intranet. The example below should be testing against the pre-defined <logic:if> and <logic:or> statement values and spitting out either the 'one or more conditions are true' or 'none of the conditions are true' depending.
    That said, I am getting an error with the following block of code (at line 11) just before the first logic:if statement and I am hoping for help in determining where I have gone astray.
    <%@ page contentType="text/html; charset=UTF-8" %>
    <%@ taglib uri="/tlds/marketmaker.tld" prefix="abc" %>
    <%@ taglib uri="/tlds/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/tlds/struts-logic.tld" prefix="logic" %>
    <%@ taglib uri="/tlds/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/tlds/jdo.tld" prefix="jdo" %>
    <%@ taglib uri="/tlds/string.tld" prefix="str" %>
    <abc:page>
         <h3>logic:if</h3>
           <logic:if name="calendarBean" property="month" op="equal" value="March">
           <logic:or name="calendarBean" property="year" op="lessEqual" value="2012"/> <!-- Note self-closing -->
           <logic:or name="calendarBean" property="day" op="equal" value="Friday"/>
             <logic:then>
                <p>At least one condition above is true.</p>
              </logic:then>
              <logic:else>
                <p>None of the conditions are true.</p>
              </logic:else>
           </logic:if>
    </abc:page>Again, the error is at line 11, occurring at or just before the <logic:if> statement. I presume it is because a bean must be properly defined.
    I tried the following variations of <bean:define> and keep coming up with the same error.
    <bean:define id="calendarBean" name="myCalendarBean" value="March" />
    <bean:define id="calendarBean" name="calendarBean" value="March" />
    <bean:define id="calendarBean" name="calendarBean"/>
    <bean:define id="calendarBean" name="myCalendarBean"/>
    <bean:define id="myCalendarBean" name="calendarBean"/>
    <bean:define id="calendarBean" value=""/>
    <bean:define id="calendarBean" value="false"/>
    <bean:define id="calendarBean"/>Am I right about defining a bean first? If yes, what am I doing incorrectly in the aforementioned <bean:define> declarations listed above?
    If you see something entirely different (and wrong) please do let me know.
    Edited by: 924359 on Mar 29, 2012 1:03 PM

    Try a Struts forum. This isn't one. Locking.

  • Struts: getting multiple selected values from a select element

    Hi Friends,
    I am a total newbie with struts,I have manage to run a simple login script,
    Now I was wonderingif there is a select box and user has the ability to select multiple values from it how do I get those values in the *Form class
    my select tag looks like this
    <html:select property="listboxValue" mulitple="mulitple">
    ...options--
    </html:select>
    in the ****Form extends ActionForm{....I have setter and getters for getting the value  from select box as below
    public void setListboxValue(String value){
    this.listboxValue = value;
    and the getter is
    public String getListboxValue(){
    return this.listboxValue ;
    please never mind the missing brackets and such.
    What I was hoping to get to work was something like this
    public void setListboxValue(String[] value){
    this.listboxValue = value;
    but that does not work...If I have the an array being passed,it seems like this method is no even envoked
    Please guide me
    Thanks

    I'm having trouble to get in the ActionForm all the selected values in my multiple select. I select all the values by setting to true the selected attribute of all the options in a javascript function. In the ActionForm the variable is String[]. I'm not getting any ClassCastException, but I only receive the first value selected (String array with just one element).
    Select definition:
    <html:select name="detalleConsultaForm" property="destinatarios" multiple="true" size="8" >
    Javascript function:
    function validalistarelacion(campo)
    {   if (campo.length < 1)
    alert("Campo sin valores");
    campo.select();
    return false;
    for (var i = 0; i < campo.length; i++)
    campo.options.selected = true;
    return true;
    ActionForm:
    String[] destinatarios;
    public String[] getDestinatarios() {
    return destinatarios;
    public void setDestinatarios(String[] destinatarios) {
    this.destinatarios = destinatarios;
    What I get:
    2006-03-30 12:54:19,899 [ExecuteThread: '10' for queue: 'weblogic.kernel.Default'] DEBUG BeanUtils - setProperty(es.tme.apl.mante
    nimientosPlanificados.form.DetalleConsultaForm@59def5, destinatarios, [2320])
    2006-03-30 12:54:19,899 [ExecuteThread: '10' for queue: 'weblogic.kernel.Default'] DEBUG ConvertUtils - Convert String[1] to class
    'java.lang.String[]'
    Thnx

  • How can I get the context-parm from a web.xml file using struts?

    Hello:
    I need get the context-param from the web.xml file of my web project using struts. I want configurate the jdbc datasource connection pooling here. For example:
    <context-param>
    <param-name>datasource</param-name>
    <param-value>jdbc/formacion</param-value>
    <description>Jdbc datasource</description>
    </context-param>
    and then from any Action class get this parameter.
    Similar using a simple server can be:
    /** Initiates new XServlet */
    public void init(ServletConfig config) throws ServletException {
              for (Enumeration e = config.getInitParameterNames(); e.hasMoreElements();) {
                   System.out.println(e.nextElement());
              super.init(config);
              String str = config.getInitParameter("datasource");
              System.out.println(str);
         public void doPost(HttpServletRequest req, HttpServletResponse res)
              throws ServletException, IOException {
              // res.setContentType( );
              System.out.println("Got post request in XServlet");
              PrintWriter out = res.getWriter();
              out.println("nada");
              out.flush();
              out.close();
    but only this works for init-params, if I use
    <servlet>
         <servlet-name>MyServlet</servlet-name>
         <display-name>MyServlet</display-name>
         <servlet-class>myExamples.servlet.MyServlet</servlet-class>
         <init-param>
         <param-name>datasource</param-name>
         <param-value>jdbc/formacion</param-value>
    </init-param>
    </servlet>
    inside my web.xml. I need something similar, but using struts inside the action class for that I can get the context-params and call my database.
    Thank you

    To get context parameters from your web.xml file you can simply get the ActionServlet object from an implementing action object class. In the perform (or execute) method make the following call.
    ServletContext context = getServlet().getServletContext();
    String tempContextVar =
    context.getInitParameter("<your context param >");

  • Values from JSP to Struts Action Class

    Dear All,
    Am working on a small struts project, i want to get values from JSP in the Action class, i tried with sending variables using request through URL, it works fine, any other way is there to send the values from JSP to action class. Am not having any input fields in the JSP.I have links.
    Thanks,
    vyrav.

    I have a dispatch action for that am calling the action like this viewfiles.do?parameter=edit, and i have to send a variable ID from the same page, so am doing like this through java script, viewfiles.do?parameter=edit&id=10. Am able to get the id in the dispatch action edit, but when i start tomcat with security manager its not calling the action itself and its giving accesscontrol exception, but when i directly type viewfiles.do in URL its calling the action.
    I dont know wats the problem, tomcat security manager not allowing this. Please help me.
    Thanks,
    vyrav.

  • I have Struts 1.1 working in the portal

    Hello all,
    I was having the same problem you have all seen. The long:
    com.bea.netuix.nf.UIControlException: No ActionResult returned for action [/Home] in Struts module []. Please ensure that both module and action are correct in portlet StrutsContent element.
    Here's how you solve it. Follow the "Integrating Struts Applications" tutorial, except realize the following: Workshop creates a Java Page Flow (JPF) application for you when you create a new Portal Web Project. JPF is a proprietary extension to struts by BEA. You cannot have a JPF application and a struts application in the same "module". So you are all probably doing exactly what I did and putting all your struts app's JSP's, images, html files, etc. in the root of the web application folder. This won't work because the root folder is a "module" that already is owned by JPF.
    Instead create a sub folder in the web app root. Call it whatever you want, like "strutsModule" for example. Put all your struts applications jsp's, etc. that you would normally put in the web root in there instead. Still put all your source for the action classes, etc. in the web-inf/src folder like normal. Put your struts config in the web-inf folder but call it struts-auto-config-strutsModule.xml. Then when you create the "portlet" in step 4 specify "/strutsModule" as your "module" uri, and the first struts action your app should run as the struts action.
    Everything will magically work now.
    Good luck
    Rob
    Rob Butler
    Architect @ chariot solutions
    e-mail: rbutler at chariotsolutions.com

    Hi Rob,
    I am fresher in as far as portal is concerned and i am
    using weblogic portal. I want to deploy Simplae struts application in
    weblogic portal but i m not able to do that. I have seen ur post in forum
    http://forums.bea.com/bea/thread.jspa?threadID=200076096&messageID=202412291#202412291
    but i still want more clarification abt directory structure(where to
    store which file??) and changes necessary in web.xml and all things
    related to struts-config.xml.
    Will u help me please??
    Regards,
    Mitesh Soni

  • Issues with Deploying Struts application on Weblogic Server 10.3.3

    We are trying to deploy a web application on Weblogic 10.3 server domain. The configuration is we have 2 physical boxes with one box running an Admin Server and one managed Server and the other box running only a Managed server. Both these servers are in one cluster. When we deploy a Struts 2 web application on this domain, it works as expected on the managed server running on the same box and Admin server. However, when we do the same action on the managed server, we get an error. In the application we are using Interceptor and the error we see in the log file is Action Interceptor Result ---exception.
    Any help would be greatly appreciated as we have been struggling with this for a few days.
    Thank you
    Sam

    Sounds to me as if you are saving the users' uploaded images somewhere in your application's directory structure - which is going to get blown away each time you redeploy. Why not store uploaded images in a database (there are blogs showing how to upload and display images to/from a DB in ADF if you don't know how). If you search {forum:id=83}, you can find them easily.
    John

  • Problem with html:select or html:options tags using struts,jsp and tomcat

    Hi
    I'm updating a Struts-Project to a new layout and therefore rework all jsp Sites.
    I'm also using a new Folder-Structure and update therefore my struts-config file.
    My Problem now is:
    Till now, we had a select-field with a code like this:
    < html:form action="/timetableAction" method="POST">
    < table width="53%" border="0">
    < tr>
    < td>< html:radio property="dauer" value="semester"
    /></ td>
    < html:select property="semester" size="1">
    < htmlptions name="semesterList" />
    </ html:select>
    </ html:form>
    The problem now is, that whenever I use any <html:xy> tag, the tomcat server I use can not show the page, he shows just the headers of the template, but not the
    content.-jsp-File where the form would be in. He stops right in the middle of the html page, when he notices the <html:xy> tags.
    And the funny thing is, that he has no problem to show a page when there is a <html:errors> within it? Why could this be? the struts-html.tld File is well included and teh Tomcat Server shows no exceptions.
    Waiting for you answers and thanks

    Thank you, I already got the answer in another forum

  • Problem with Validation in Struts

    Dear All,
    I am facing a proble with validation in struts.
    I have got this code in my action class
    //Initial Code...
    ArrayList branches=new ArrayList();
    branches.add("B01", "Main Branch");
    branches.add("B02", "Second Branch");
    branches.add("B03", "Third Branch");
    DynaValidatorForm memberForm=(DynaValidatorForm)form;
    memberForm.set(branches);
    //Finalizing code.....This form is getting validated in validation.xml.
    This action is being forwarded to folllowing JSP.
    //Initial Code...
            <tr>
                <td align="right"><strong>Branch Name </strong></td>
                <td> </td>
                <td align="left">
                    <html:select property="branid">
                        <html:optionsCollection name="memberForm" property="branches" value="key" label="value"/>
                    </html:select>
                </td>
            </tr>
    //Later code...I have action mapping as..
            <action path="/member/save" input="member.page" name="memberForm" validate="true"
            scope="request" type="com.mlm.action.MemberAction" parameter="action">
                <forward name="success" path="/show.do?action=member" redirect="true"/>
            </action>Now, the problem is that when the form doesn't pass the validation then it gives an exception that..
    Can't find collection 'branches' in bean

    sauanu wrote:
    Ok, now I am giving full code of my module...
    Form-bean
    <form-beans>
    <form-bean name="memberForm" type="org.apache.struts.validator.DynaValidatorForm">
    <form-property name="id" type="java.lang.String"/>
    <form-property name="membname" type="java.lang.String"/>
    <form-property name="address" type="java.lang.String"/>
    <form-property name="branid" type="java.lang.String"/>
    <form-property name="branches" type="java.util.ArrayList"/>
    </form-bean>
    </form-beans>Validation is being done for all fileds except "branches". Validation type is "requried"
    My Jsp....
    <html:form action="/member/save?action=save">
    <html:hidden property="id"/>
    <tr>
    <td align="right"><strong>Member Name </strong></td>
    <td> </td>
    <td align="left">
    <html:text property="membname"/>
    </td>
    </tr>
    <tr>
    <td align="right"><strong>Address</strong></td>
    <td> </td>
    <td align="left">
    <html:text property="address"/>
    </td>
    </tr>
    <tr>
    <td align="right"><strong>Branch Name </strong></td>
    <td> </td>
    <td align="left">
    <html:select property="branid">
    <html:optionsCollection name="memberForm" property="branches" />
    </html:select>
    </td>
    </tr>
    <tr>
    <td align="right">
    <html:submit/>
    </td>
    <b><td>   </td></b>
    <td>
    <html:button value="Cancel" onclick="javascript:history.go(-1)" property="cancel"/>
    </td>
    </tr>
    </html:form>This is the code..
    I tried to find out the problem and I found that.. when the form does not pass the validation its input page gets displayed..
    Now, when the input is getting displayed.. "branches" field of the form contains null???Why?
    Edited by: sauanu on ?? ??????, ???? ??:?? ?????????Forget,about Validations.
    Who is forwarding the control to this JSP page or view ??
    Is it Action method code which metioned earlier doing it ??
    Or some other Action is involved if it is some other action please intialize Values of branches component in the respective action.
    Also,
    Also,
    ArrayList branches=new ArrayList();
    branches.add("B01", "Main Branch");
    branches.add("B02", "Second Branch");
    branches.add("B03", "Third Branch"); I believe you need to get a good understanding of Java Collection classes aswell.
    You can add things as entities in the above case lets create a simple java bean named Option.
    public class Option implements Serializable{
        private String label;
        private String value;
        public void setValue(String value){this.value = value;};
        public String getValue(){return this.value;}
        public void setLabel(String label){this.label = label;}
        public String getLabel(){return this.label;}
    } and inside the action which is forwarding to the respective view
    ArrayList branches=new ArrayList();
    Option option = new Option();
    option.setValue("B01");
    option.setLabel("Main Branch");
    branches.add(option);
    option = new Option();
    option.setValue("B02");
    option.setLabel("Second Branch");
    branches.add(option);
    option = new Option();
    option.setValue("B03");
    option.setLabel("Third Branch");
    branches.add(option);
          <html:select property="branid">
                   <html:options name="memberForm" collection="branches"   value="value" label="label" />
           </html:select>and one more thing is is that after the validation if it is not validated it'd be sent back to input page which destorys the request therefore try making scope of "memberForm" to session in your action mappings and check.
    Hope this might help :)
    REGARDS,
    RaHuL

  • Problem with Hot deployment of Struts application

    I used the exploded archive format to deploy a web application ( no EJB Jars etc involved). But after modifying a custom Action class and placing it in the WEB-inf\classes, I get the following exception: java.lang.ClassCastException: org.apache.struts.action.RequestProcessor at org.apache.struts.action.ActionServlet.getProcessorForModule Clearly weblogic managed to load the new Action class, and if I understand correctly it would have destroyed the old web class loader and create a new one and loaded all the classes visible to the web app class loader. But somehow it still seems to cache the RequestProcessor class.. Can some one please throw some light on this.
    PS I dont have anything in the server classpath, and there is no chance of duplicate copies anywhere in the classpath or under web-inf

    Yes, I added the line getServletContext().removeAttribute(Globals.REQUEST_PROCESSOR_KEY) in ActionServlet's destroy(). It works now.
    It was previously getting back the old class reference while doing a getAttribute(REQ....) , so was giving the classcast.
    Not sure if this is a bug in the ActionServlet, or if I am missing something.

Maybe you are looking for

  • Says Error is 'Bad Image' Error 7 (Windows 193)

    When I try to get into iTunes this error message pops up. I've reinstalled iTunes, as well as tried every solution in the Troubleshooting section. I've had iTunes on my computer for quite sometime and it's only started doing this today. Any suggestio

  • I hope this is a vital link in the transition to iCloud

    If I can re-access an Apple based email network that operates iPhone locator, I can successfully complete my mission of connecting millions of NET Users into a new highly sophisticated Universal Techological Salvation Liberartion Project UTSLP.  Basi

  • Using a URL as the original application file in DMS/KPRO

    DMS and KPRO Has anyone had any experience with creating a DIR that points to a document stored on another server via a URL.  Such that the original document is not physically checked into the DMS vault.  When I enter the URL as the orginal applicati

  • PNGs keep getting converted to MOVs...?

    Hi all again. OK, so this problem is a doosey. I'm building a major app walkthrough in Keynote — a simulated experience of an iPad app that involvs lots of psuedo button presses and swipes and etc. It's been working great and maybe one day I'll put t

  • How can I connect the EMF of Early commitment (RE) to the commitment?

    Dear Experts, We have 2 kinds of EMF: 75 (Early commitment of real estate) and 77 (commitment of real estate). Now we can watch them seperately on transaction FMY3 & FMZ3 respectively. We cant to customize the connection between them, namely when you