aspose file tools*
The moose likes Struts and the fly likes javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts" Watch "javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts" New topic
Author

javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts

rajneekanth macharla
Greenhorn

Joined: Feb 13, 2009
Posts: 1
Hi All,
I'm also new to Struts.So was experimenting with the stuffs. I also coem across the same problem. I'm attaching the html code and my Actionbean. CAn anybody help?
HTML
===============================
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h2>Hello World!</h2>
<html:form action="/login"/>
<html:submit value="Login"/>
<table border="1">
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Enter your name: </td>
<td><html:text property="name"/></td>
</tr>
<tr>
<td>Enter your email:</td>
<td><html:text property="email"/></td>
</tr>
<tr>
<td></td>
<td><html:submit value="Login"/></td>
</tr>
</tbody>
</table>
</body>
</html>
================================
Bean
================================
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package com.myapp.struts;

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

/**
*
* @author rajneekanth.m
*/
public class LoginForm extends org.apache.struts.action.ActionForm {

private String name;
private String email;

public String getEmail() {
return email;
}

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

private int number;

/**
* @return
*/
public String getName() {
return name;
}

/**
* @param string
*/
public void setName(String string) {
name = string;
}

/**
* @return
*/
public int getNumber() {
return number;
}

/**
* @param i
*/
public void setNumber(int i) {
number = i;
}

/**
*
*/
public LoginForm() {
super();
// TODO Auto-generated constructor stub
}

public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if (getName() == null || getName().length() < 1) {
errors.add("name", new ActionMessage("error.name.required"));
// TODO: add 'error.name.required' key to your resources
}
return errors;
}
}

================================
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

*Please* put your code in code tags so it's easier to read. It's also beneficial to remove any non-essential code/comments/HTML/etc. to reduce cognitive noise.

Without the configuration for this action it's difficult to help. Are you accessing the page directly (via a URL ending with JSP) or through an action?

Also, unless you have a reason for starting with Struts 1, you might be better off learning Struts 2.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: "org.apache.struts