struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Galbreath, Mark" <>
Subject RE: Newbie Question: Login form submit error - Servlet action is currently unavailable
Date Mon, 23 Sep 2002 21:09:35 GMT
go to and get chapter 23 of jsp pro....

Just kidding.  A 503 error usually means the ProcessPreprocess class is
failing; what does your server log read?


-----Original Message-----
From: Tuan H. Le []
Sent: Monday, September 23, 2002 3:57 PM
Subject: Newbie Question: Login form submit error - Servlet action is
currently unavailable


I'm trying to get the login functionality to work with Struts, but when I
submit data from a login form (with empty user ID/password or witth data), I
got an error

HTTP Status 503 - Servlet action is currently unavailable

Here're my struts-config.xml, login.jsp,
1) struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.1//EN"
  <!-- <data-sources> element must be added prior to the <form-beans> and
<action-mappings> -->

    <form-bean name="loginForm" type="com.phs.ezhr.forms.LoginForm" />

    <forward   name="login"		path="/login.jsp"/>
    <forward   name="success"		path="/mainMenu.jsp"/>

  <!-- Action Mapping Definitions -->
    <!-- Process an employee login -->
    <action path="/Login"
            scope="session" >

  <controller contentType="text/html;charset=UTF-8" debug="3" locale="true"
nocache="true" />

  <message-resources parameter="com.phs.ezhr.ApplicationResources"
null="false" key="org.apache.struts.action.MESSAGE" />

2) login.jsp
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
  <link rel="stylesheet" type="text/css" href="stylesheets/styleLogin.css">
    <title><bean:message key="app.title" /></title>

  <body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0"
marginwidth="0" marginheight="0">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <td><img src="images/logoBig.gif" width="202" height="48" hspace="8"
        <td width="60%" valign="top" align="right">&nbsp;</td>
    <table border="0" cellspacing="0" cellpadding="0" width="100%"
style="background: url(images/topTile.gif) repeat-x;">
        <td><img src="images/loginTopLeft.gif" width="472" height="38"></td>
        <td><img src="images/loginTopRight.gif" width="155"
    <html:errors />
    <html:form action="/Login"
      focus="employeeId" >
    <table height="240" border="0" cellspacing="0" cellpadding="0"
align="center" bgcolor="#FFFFFF">
	  <table cellspacing="2" cellpadding="2" border="0">
              <td colspan="2" class="text" style="padding: 10px;"></td>
              <td class="label" valign="bottom"
align="right"><b><bean:message key="app.employeeId" />:</b></td>
              <td><html:text property="employeeId" /></td>
              <td class="label" valign="bottom"
align="right"><b><bean:message key="app.password" />:</b></td>
              <td><html:password property="password" /></td>
              <td colspan="2" align="center"><html:submit /></td>

package com.phs.ezhr.forms;

 * Title:
 * Description: It provides accessors to data members that map to the values
 * submitted by the Login View -- employee ID and password -- and it
 * some simple validation of those values.  If the values pass the
 * then the transaction continues; otherwise, ActionErrors are created and
 * request is forwarded back to the value defined by this Actions input
 * sub-element, which in this case is Login.jsp
 * Copyright:    Copyright (c) 2002
 * Company:      PacifiCare Health Systems - ADC
 * @author Tuan H. Le
 * @version 1.0

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionMapping;

 * This ActionForm is used by the EZHR appliation to validate
 * that the user has entered an employee ID and a password. If one or
 * both of the fields are empty when validate is called by the
 * ActionServlet, error messages are created.
public class LoginForm extends ActionForm {
  // The user's password
  private String password;

  // The user's access ID
  private String employeeId;
   * Default Constructor
  public LoginForm() {

   * This method is called with every request.  It resets the
   * Form attribute prior to setting the values in the new
   * request.
   * @param mapping The mapping used to select this instance
   * @param request The servlet request we are processing
  public void reset( ActionMapping mapping,
                     HttpServletRequest request ) {

    // Clear out the access number and pin number fields

   * @param anEmployeeId The employee ID
  public void setEmployeeId( String anEmployeeId ) {
    this.employeeId = anEmployeeId;

  * @retrurn The employee ID
  public String getEmployeeId() {
    return this.employeeId;

  public void setPassword( String aPassword ) {
    this.password = aPassword;

  * @retrurn The employee password
  public String getPassword() {
    return this.password;

  protected void resetFields() {
    this.employeeId = "";
    this.password = "";

   * Validate the properties that have been set from this HTTP request,
   * and return an <code>ActionErrors</code> object that encapsulates any
   * validation errors that have been found.  If no errors are found, return
   * <code>null</code> or an <code>ActionErrors</code> object with
   * recorded error messages.
   * @param mapping The mapping used to select this instance
   * @param request The servlet request we are processing
  public ActionErrors validate( ActionMapping mapping,
                                HttpServletRequest request ) {
    ActionErrors errors = new ActionErrors();

    // Check and see if the access number is missing
    if( employeeId == null || employeeId.length() == 0 ) {
      ActionError newError = new ActionError( "errors.employeeId.required"
      errors.add( employeeId, newError );

    // Check and see if the password is missing
    if( password == null || password.length() == 0 ) {
      ActionError newError = new ActionError( "errors.password.required" );
      errors.add( password, newError );
    return errors;

4) My environment:

Tomcat 4.1.10
Struts 1.1b2
Windows XP

I can provide web.xml and if needed.

Much thanks in advance for your helps!


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message