This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cannot find BEAN in any scope

 
athadu pokiri
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting the error the following error while deploying struts application .can any one tell where to look in? to find the error


:Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This error is frequently encountered in a Struts application. In order for us to help you with it, we need you to post:

1-The JSP you were trying to display when the error occurred
2-The ActionForm bean used by the JSP
3-The entries for the Action and ActionForm in your struts-config.xml file.
 
Sunesh Kumar
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I too having the same problem

My Jsp:

<BODY>
<center>
<h1> Account Control </h1>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<html:form action="/AccountMod.do">
<bean:write name="accountFormBean" property="warning" filter="false" />
Email
<html:text property="email" />
Password
<html:text property="password" />
<table>
<tr>
<td><html:radio property="operation" value="createAccount" />Create Account</td>
<td><html:radio property="operation" value="modifyAccount" />Modify Account</td>
<td><html:radio property="operation" value="deleteAccount" />Delete Account</td>
</tr>
</table>
<html:submit value="Perform Selected Operation" />
</html:form>
</center>
</BODY>

ActionForm:

package com.sunesh.struts;

import org.apache.struts.action.*;

public class AccountFormBean extends ActionForm
{
private String email = "sample@xyz.com";
private String password = "null";

//for error messages
private String warning = "";

public String getEmail()
{
return this.email;
}

public void setEmail(String email)
{
this.email = email;
}

public String getPassword()
{
return this.password;
}

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

public String getWarning()
{
return this.warning;
}

public void setWarning(String warning)
{
this.warning = "<H2>Invalid or missing <FONT color=red>" + warning + "</FONT></H2>";
}
}

struts-comfig.xml :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<form-beans>
<form-bean name="accountFormBean"
type="com.sunesh.struts.AccountFormBean" />
</form-beans>

<action-mappings>
<action path="/AccountMod"
type="com.sunesh.struts.AccountAction"
name="accountFormBean"
parameter="operation"
scope="session">

<forward name="create-success" path="admin/create-confirm.jsp" />
<forward name="create-failure" path="accountMod.jsp" />
</action>

</action-mappings>
</struts-config>


can u please help me..

Bye
 
Sunesh Kumar
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Sorry I forgot to say this..

First i am trying for only "createAccount" operation only.

But I cant even able to display the "accountMod.jsp" file

could you please help me...

Bye
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sunesh,

You need to add an "operation" property to your AccountFormBean class with a corresponding getter and setter. Also, it's a good idea to change:

<html:form action="/AccountMod.do">

to

<html:form action="/AccountMod">
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic