Results 1 to 5 of 5
  1. #1
    rajesh.moyra is offline Member
    Join Date
    Jun 2010
    Rep Power

    Default Error in Struts Application

    Hi friends,

    I am getting an error like the follow while trying to run an dynamic web project from Eclipse and JBoss application server ONLY THERE IS NO INTERNET CONNECTION in MY machine and the application working fine with internet connection.


    javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
    Java Code:
    package test.action;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import test.forms.LoginForm;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    public class LoginAction extends Action {
    	public ActionForward execute(ActionMapping mapping, ActionForm form,
    			HttpServletRequest request, HttpServletResponse response)
    			throws Exception {
    		String target = null;
    		LoginForm loginForm = (LoginForm)form; 
    				&& loginForm.getPassword().equals("admin123")) {
    			target = "success";
    			request.setAttribute("message", loginForm.getPassword());
    		else {
    			target = "failure";
    		return mapping.findForward(target);
    Java Code:
    package test.forms;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionMessage;
    public class LoginForm extends ActionForm {
    	private String userName = "";
    	private String password = "";
    	public ActionErrors validate(ActionMapping mapping,
    			HttpServletRequest request) {
    		ActionErrors actionErrors = new ActionErrors();
    		if(userName == null || userName.trim().equals("")) {
    			actionErrors.add("userName", new ActionMessage("error.username"));
    		try {
    		if(password == null || password.trim().equals("")) {
    			actionErrors.add("password", new ActionMessage("error.password"));
    		}catch(Exception e) {
    		return actionErrors ;
    	public String getUserName() {
    		return userName;
    	public void setUserName(String userName) {
    		this.userName = userName;
    	public String getPassword() {
    		return password;
    	public void setPassword(String password) {
    		this.password = password;

    label.username = Login Detail
    label.password = Password
    label.welcome = Welcome

    error.username =Username is not entered.

    Java Code:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE struts-config PUBLIC
              "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
    		<form-bean name="loginForm"
    			type="test.forms.LoginForm" />
    		<action path="/loginAction" name="loginForm" validate="true" input="/index.jsp"
    			<forward name="success" path="/welcome.jsp" />
    			<forward name="failure" path="/index.jsp" />
    	<!-- Message Resources -->
    	<message-resources parameter="resource.MessageResource"></message-resources>

    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="" xmlns="" xmlns:web="" xsi:schemaLocation="" id="WebApp_ID" version="2.5">

    Java Code:
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    		<title>Login page | Hello World Struts application in Eclipse</title>
    	<html:form action="/loginAction" name="loginForm" type="test.forms.LoginForm">
    		User ID
    		 <html:text name="loginForm"  property="userName"></html:text>
    		<html:password name="loginForm" property="password"></html:password>
    Moderator Edit: Code tags added
    Last edited by Fubarable; 06-20-2010 at 06:06 PM. Reason: Moderator Edit: Code tags added

  2. #2
    rajesh.moyra is offline Member
    Join Date
    Jun 2010
    Rep Power


    Is it required to have an Internet connection while running the application?????

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    Hello, and welcome to the forum. I hope you don't mind that I edited your code and added code tags which should help make your posted code retain its formatting and be more readable.

    To do this yourself, highlight your pasted code (please be sure that it is already formatted when you paste it into the forum; the code tags don't magically format unformatted code) and then press the code button, and your code will have tags.

    Another way to do this is to manually place the tags into your code by placing the tag [cod&#101;] above your pasted code and the tag [/cod&#101;] below your pasted code like so:

    Java Code:
      // your code goes here
      // notice how the top and bottom tags are different
    Best of luck, and again, welcome!

  4. #4
    rajesh.moyra is offline Member
    Join Date
    Jun 2010
    Rep Power


    thanks for ur guidance.:)

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power


    You don't need an internet connection if you are just running this locally (ie localhost).

    Are there any parse errors with respect to the struts-config? This usually goes hand in hand...that is, there's an error in the config, which means it can't read the mappings, so you also get the mappings error.

Similar Threads

  1. pinting Application in Struts
    By kishan in forum Advanced Java
    Replies: 2
    Last Post: 02-18-2010, 09:17 AM
  2. Struts application on Intranet
    By sprateek in forum Web Frameworks
    Replies: 3
    Last Post: 01-22-2010, 08:25 AM
  3. Exception in Struts Application
    By shuklajayb in forum Web Frameworks
    Replies: 1
    Last Post: 02-20-2009, 07:21 AM
  4. URL Problem with IE7 in my struts Application
    By SreenivasGurramkonda in forum Web Frameworks
    Replies: 0
    Last Post: 11-27-2008, 08:14 AM
  5. Struts 2.x sample application .......?
    By prabhurangan in forum Web Frameworks
    Replies: 7
    Last Post: 06-26-2008, 10:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts