I didn't use the struts examples to test out my setup. Instead I just
provided my own little application, but it works. Just make sure the
package names are consistent as I made changes to the sample codes below
before I sending this out.

Installation and configuration

1.   In VAJ, you will need to have the following projects present in your
workspace


   Servlet API Classes
   Java Class Libraries
   IBM WebSphere Test Environment
   IBM Enterprise Extension Libraries
   IBM XML Parser for Java

   If any of the above is missing,

·    select File/Quick Start from the menu
·    select Features/Add Features from the popup window and select the
project you need to import to your workspace

2.   Download/install the following:

Note:  If  you  have  projects in VAJ with the same name as the ones listed
below, be sure to version them first. Then when importing the new packages,
make  sure  you  select  option  create  new/scratch  editions of versioned
projects/packages

Xerces from http://xml.apache.org/dist/xerces-j/
·    the link is Xerces-J-bin.1.4.4.zip
·    extract Xerces.jar and import it in VAJava in the project XERCES

Xalan  from http://xml.apache.org/xalan-j/index.html

·    the link is xalan-j_2_3_1-bin.zip
·    extract Xalan.jar and xml-apis.jar and import them in VAJava  in the
project XALAN


Struts                   1.1b                  binary                  from
http://jakarta.apache.org/builds/jakarta-struts/release/v1.1-b1/
·    link is jakarta-struts-1.1-b1.zip


Struts commons (binary)
The         latest         commons         libraries         are         in
http://jakarta.apache.org/builds/jakarta-commons/release/

Download  all commons zip files and import these files to a COMMONS project
in VAJava

     OR

Open  the  binary  distribution of STRUTS and extract all commons jar files
and import them in the COMMONS project in VAJava.

Struts                   1.1b                  source                  from
http://jakarta.apache.org/builds/jakarta-struts/release/v1.1-b1/src/

·    link is jakarta-struts-1.1-b1-src.zip
·    import the entire file to a STRUTS project in VAJava



1.   Open jakarta-struts-1.1-b1.zip and extract the following files to e:
\apps\program files\ibm\VisualAge for Java\ide\project resources\IBM
WebSphere Test Environment\hosts\default_host\sample\WEB-INF\

·    struts-*.tld
·    *.dtd
·    *.xml

     Note  : the DTDs in this folder are for reference only. Struts uses an
     internal copy of the dtd's to validate the xml files.

Installing the sample application

1.   In the directory e:\apps\program files\ibm\VisualAge for
Java\ide\project resources\IBM WebSphere Test
Environment\hosts\default_host\sample\WEB-INF\, open the struts-config.xml
file and replace the contents with  the following code

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
     "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
     "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";>
<struts-config>
   <form-beans>
     <form-bean name="loginForm" type="com.struts.example.LoginForm" />
   </form-beans>
   <action-mappings>
     <action path="/login"
     type="com.struts.example.LoginAction"
     name="loginForm"
     scope="request"
     input="/Login.jsp">
     <forward name="success" path="/Welcome.jsp"/>
     </action>
   </action-mappings>
   </struts-config>


2. Open the web.xml file and replace the contents with the following code

<?xml version="1.0"?>
<!DOCTYPE  web-app  PUBLIC  "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd";>
<web-app>
</web-app>

Note  :  This  file is basically an empty file but we still need to provide
this because the ActionServlet still looks for it somehow. If it can't find
the file, it throws a MalformedURLException exception.

3.   In  VAJ,  create  a  project  named STRUTS EXAMPLE. Create a text file
outside  of  VAJ and name it ApplicationResources.properties then paste the
codes  below.  Save  the  file  then import it in the project that you just
created (make sure you check the Resource box).

error.missing.userid=<font color=red><b>Please enter a user id</b></font>
error.missing.password=<font color=red><b>Please enter a
password</b></font>

prompt.login.user=<b>User Id :<b>
prompt.login.password=<b>Password :<b>

prompt.welcome.msg=<b>Welcome <b>

4.   Open the sample.webapp file located in e:\apps\program
files\ibm\VisualAge for Java\ide\project resources\IBM WebSphere Test
Environment\hosts\default_host\sample\  and replace the contents with the
following code


<?xml version="1.0"?>
<webapp>
   <name>sample</name>
   <description>sample Application</description>
   <error-page>/ErrorReporter</error-page>
   <servlet>
     <name>ErrorReporter</name>
     <description>Default error reporter servlet</description>
     <code>com.ibm.servlet.engine.webapp.DefaultErrorReporter</code>
     <servlet-path>/ErrorReporter</servlet-path>
     <autostart>true</autostart>
     </servlet>
     <servlet>
   <name>action</name>
   <description>Action Servlet</description>
   <code>org.apache.struts.action.ActionServlet</code>
   <servlet-path>*.do</servlet-path>
   <autostart>true</autostart>
     <init-parameter>
     <name>application</name>
     <value>ApplicationResources</value>
     </init-parameter>
     <init-parameter>
        <name>config</name>
        <value>/WEB-INF/struts-config.xml</value>
     </init-parameter>
     <init-parameter>
        <name>debug</name>
        <value>2</value>
     </init-parameter>
     <init-parameter>
        <name>detail</name>
        <value>2</value>
     </init-parameter>
     <init-parameter>
        <name>validate</name>
        <value>true</value>
     </init-parameter>
     </servlet>
     <servlet>
   <name>invoker</name>
   <description>Auto-registration servlet</description>
   <code>com.ibm.servlet.engine.webapp.InvokerServlet</code>
   <servlet-path>/servlet/*</servlet-path>
   <autostart>true</autostart>
     </servlet>
     <servlet>
   <name>jsp</name>
   <description>JSP support servlet</description>
   <code>com.ibm.ivj.jsp.jasper.runtime.JspDebugServlet</code>
   <init-parameter>
     <name>workingDir</name>
     <value>$server_root$/temp/default_app</value>
   </init-parameter>
   <init-parameter>
     <name>jspemEnabled</name>
     <value>true</value>
   </init-parameter>
   <init-parameter>
     <name>scratchdir</name>
     <value>$server_root$/temp/JSP1_1/default_app</value>
   </init-parameter>
   <init-parameter>
     <name>keepgenerated</name>
     <value>true</value>
   </init-parameter>
   <autostart>true</autostart>
   <servlet-path>*.jsp</servlet-path>
     </servlet>
     <servlet>
   <name>file</name>
   <description>File serving servlet</description>
   <code>com.ibm.servlet.engine.webapp.SimpleFileServlet</code>
   <servlet-path>/</servlet-path>
   <init-parameter>
     <name></name>
     <value></value>
   </init-parameter>
   <init-parameter>
     <name>default.page</name>
     <value>index.html</value>
   </init-parameter>

     <autostart>true</autostart>
     </servlet>
</webapp>

5.   In VAJ, create a project named STRUTS EXAMPLE and in it, create a
package named com.struts.example then create a class named LoginForm and
paste the following code in


/**
·    Insert the type's description here.
·    Creation date: (1/8/02 1:09:46 PM)
·    @author: Administrator
 */
import org.apache.struts.action.ActionForm;

import org.apache.struts.action.ActionForm;

public class LoginForm extends org.apache.struts.action.ActionForm {
   private String userId;
   private String password;

     public String getUserId()
     {
     return userId;
     }
     public String getPassword()
     {
     return password;
     }
     public void setUserId(String userId)
     {
     this.userId = userId;
     }
     public void setPassword(String password)
     {
     this.password = password;
     }
}


6.  Create a class named LoginAction in the same package and paste the
following code


import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;

import java.io.IOException;
import java.util.List;
import java.io.*;

public class LoginAction extends org.apache.struts.action.Action {

public ActionForward execute(ActionMapping mapping,     ActionForm form,
               HttpServletRequest request,
               HttpServletResponse response)
               throws IOException,ServletException {

     ActionErrors errors = new ActionErrors();

     try {

          LoginForm loginForm = (LoginForm) form;

/*        if (loginForm.getUserId().trim().equals("")) {
          ActionError error = new ActionError("error.missing.userid");
          errors.add(ActionErrors.GLOBAL_ERROR,error);
          }

          if (loginForm.getPassword().trim().equals("")) {
          ActionError error = new ActionError("error.missing.password");
          errors.add(ActionErrors.GLOBAL_ERROR,error);
          }


          if(errors.size() > 0) {
          saveErrors(request,errors);
          return new ActionForward(mapping.getInput());
          }

*/
          errors = loginForm.validate(mapping,request);
        if (!errors.empty()) {
           saveErrors(request, errors);
           return new ActionForward(mapping.getInput());
        }

          return mapping.findForward("success");

     } catch (Throwable e) {
          e.printStackTrace();

          ActionError error = new ActionError(e.getMessage());
          errors.add(ActionErrors.GLOBAL_ERROR, error);
     }


     saveErrors(request, errors);

     return new ActionForward(mapping.getInput());

}
}

7.   In e:\apps\program files\ibm\VisualAge for Java\ide\project
resources\IBM WebSphere Test Environment\hosts\default_host\sample\ ,
create a file named Login.jsp and paste the following code

<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@taglib uri="/WEB-INF/struts-html.tld " prefix="html" %>
<%@taglib uri="/WEB-INF/struts-logic.tld " prefix="logic" %>

<logic:messagesPresent>
   <bean:message key="errors.header"/>
   <ul>
   <html:messages id="error">
      <li><bean:write name="error"/></li>
   </html:messages>
   </ul><hr>
</logic:messagesPresent>


<html:form action="login.do" >

<table border="1">
<tr>
   <td><bean:message key="prompt.login.user" /></td>
   <td><html:text property="userId" /></td>
</tr>
<tr>
   <td><bean:message key="prompt.login.password" /></td>
   <td><html:password property="password" /></td>
</tr>
</table>

<html:submit />
</html:form>



8.   In the same folder, create a file named Welcome.jsp and paste the
following code

<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<table width="100%" height="100%">
<tr>
   <td valign="center" align="center">
   <h2><bean:message key="prompt.welcome.msg" /> <bean:write property
="userId" name="loginForm" /> </h2>
   </td>
</tr>
</table>

9.   Just to make sure that you have the sample application correctly
configure, make sure that the file default.servlet_engine located in e:
\apps\program files\ibm\VisualAge for Java\ide\project resources\IBM
WebSphere Test Environment\properties\  contains the following entry


<websphere-webgroup name="sample">
   <description>sample Webgroup</description>
   <document-root>$approot$</document-root>
   <classpath>$approot$</classpath>
   <root-uri>/sample</root-uri>
   <auto-reload enabled="true" polling-interval="3000"/>
   <shared-context>false</shared-context>
</websphere-webgroup>

10.  In the end, the sample directory structure should look something like
this


     sample
     |_WEB-INF
          app.tld
          struts-bean.tld
          struts?config.xml
          struts-config_1_0.dtd
          struts-config_1_1.dtd
          struts-html.tld
          struts-logic.tld
          struts-nested.tld
          struts-template.tld
          tiles.tld
          tiles-config.dtd
          web.xml
          web-app_2_2.dtd
          web-app_2_3.dtd
          |_ classes

Deploying and running the sample application

1.   Bring up the WebSphere Test Environment then click on Edit Class Path.

·    click Select All
·    enter the following text in the extra classpath area

E:\Apps\Program   Files\Ibm\VisualAge   for  Java\ide\project_resources\IBM
Webpshere Test Environment\hosts\default_host\sample\WEB-INF\classes;
E:\Apps\Program   Files\Ibm\VisualAge   for  Java\ide\project_resources\IBM
Webpshere Test Environment\hosts\default_host\sample\WEB-INF\

·    click OK

2.   Start the servlet engine.

3.   Once the servlet engine is started,

·    bring up a browser

enter the following URL http://localhost:8080/sample/Login.jsp






Struts Newsgroup (@Basebeans.com) <struts on 05/14/2002 02:55:01 AM

Please respond to "Struts Users Mailing List"
      <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:
Subject:  Re: VAJ 4 & Struts & Error 503


Subject: Re: VAJ 4 & Struts & Error 503
From: Marco <[EMAIL PROTECTED]>
 ===
[EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]:

>
> This is a generic error put out by VAJ (actually WebSphere) when one
> of your servlets in your app.webapp fails to load. In this case, it's
> most probably the ActionServlet. Check all you classpaths (in the
> servlet engine) and make sure you have the xml files in the correct
> directory. I can post some instructions on how to install Struts 1.1b
> in VAJ 4.0 if you need it.
>

If you could post those instructions I would appreciate it very much. Now
I'm just fiddling with various examples but I keep getting the same error
503.

Thanks,
Marco

--
To unsubscribe, e-mail:   <
mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>






**********************************************************************
Please Note:
The information in this E-mail message, and any files transmitted
with it, is confidential and may be legally privileged.  It is
intended only for the use of the individual(s) named above.  If you
are the intended recipient, be aware that your use of any confidential
or personal information may be restricted by state and federal
privacy laws.  If you, the reader of this message, are not the
intended recipient, you are hereby notified that you should not
further disseminate, distribute, or forward this E-mail message.
If you have received this E-mail in error, please notify the sender
and delete the material from any computer.  Thank you.
**********************************************************************



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to