是不是jsp里的标签有问题啊?
<%@ page language="java" pageEncoding="ISO-8859-1"%><%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-template" prefix="template" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
  <head>
    <html:base />
    
    <title>userLoginSuccess.jsp</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->  </head>
  
  <body>
    This a struts page. <br>Hello    <bean:write name="userName" scope="request" />  
  </body>
</html:html>

解决方案 »

  1.   

    action代码看看。
    把你的<bean:write name="userName" scope="request" />  
    userName换成你的form(bean)的名字试试。
      

  2.   

    userName没存到request,当然抛EX
      

  3.   

    我存了啊。。public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response) {
    UserLoginForm userLoginForm = (UserLoginForm) form;// TODO Auto-generated method stub
    if(userLoginForm.getUserName().equals("abcd")&&userLoginForm.getPassWord().equals("abcd")){
    request.setAttribute("userName", userLoginForm.getUserName());

    System.out.println("username:" + userLoginForm.getUserName() + "passWord:" +userLoginForm.getPassWord());
    return mapping.findForward("success");
    }else{
    return mapping.findForward("error");

    }
    }
    }
    难道我存的不对?
      

  4.   

    看一下你的action中是否有 
    requuest.setAttribute("userName","一个值");
    这句话。
    如果直接访问这个页面 要先判断 userName 是否为空。
      

  5.   

    bean:write要的是bean,不是字段
    你的userName是个字段,而不是你的formbean
      

  6.   

    <bean:write name="userName" scope="request" /> 
    改成:
    <bean:write property="userName" scope="request" /> 
    因为name一般代表ActionForm
      

  7.   

    Cannot find bean userName in scope request 
    userName属性应该放入他对应的bean中,再将bean放入request中
    这样应该可以得到了
      

  8.   

    把你的UserLoginForm拿出来晒一下
      

  9.   

    /*
     * Generated by MyEclipse Struts
     * Template path: templates/java/JavaClass.vtl
     */
    package com.yourcompany.struts.form;import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;/** 
     * MyEclipse Struts
     * Creation date: 05-28-2008
     * 
     * XDoclet definition:
     * @struts.form name="userLoginForm"
     */
    public class UserLoginForm extends ActionForm {
    /*
     * Generated fields
     */ /** userName property */
    private String userName; /** passWord property */
    private String passWord; /*
     * Generated Methods
     */ /** 
     * Method validate
     * @param mapping
     * @param request
     * @return ActionErrors
     */
    public ActionErrors validate(ActionMapping mapping,
    HttpServletRequest request) {
    // TODO Auto-generated method stub
    return null;
    } /** 
     * Method reset
     * @param mapping
     * @param request
     */
    public void reset(ActionMapping mapping, HttpServletRequest request) {
    // TODO Auto-generated method stub
    } /** 
     * Returns the userName.
     * @return String
     */
    public String getUserName() {
    return userName;
    } /** 
     * Set the userName.
     * @param userName The userName to set
     */
    public void setUserName(String userName) {
    this.userName = userName;
    } /** 
     * Returns the passWord.
     * @return String
     */
    public String getPassWord() {
    return passWord;
    } /** 
     * Set the passWord.
     * @param passWord The passWord to set
     */
    public void setPassWord(String passWord) {
    this.passWord = passWord;
    }
    }
    自动生成的应该没什么问题把