File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Very basic question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Very basic question" Watch "Very basic question" New topic

Very basic question

Madhuri Dhahiwal

Joined: Jun 17, 2006
Posts: 2
Dear All

I have very simple problem. I am not able to get <bean:message key="title.login"/> working.

I have following configuration.

struts 1.2.9
Tomcat 5.5

My web.xml is like

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"

<display-name>Struts Blank Application</display-name>

<!-- Standard Action Servlet Configuration (with debugging) -->

<!-- Standard Action Servlet Mapping -->

<!-- The Usual Welcome File List -->

<!-- Struts Tag Library Descriptors -->






My strus-config.xml is like

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"


<!-- ========== Form Bean Definitions ============ -->
<form-bean name="login" type="org.apache.struts.validator.DynaValidatorForm" />
<form-property name="userId" type="java.lang.String" />
<form-property name="passWord" type="java.lang.String" />


<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"

<!-- ========== Global Forward Definitions ========= -->

<!-- ========== Action Mapping Definitions ======== -->
type="test.struts.LoginAction" >

<forward name="valid" path="/jsp/MainMenu.jsp" />
<forward name="invalid" path="/jsp/LoginView.jsp" />


My jsp goes like this

<!-- LoginView.jsp -->

<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<bean:message key="title.login"/>
<BODY><p> This is very very bad.
<bean:message key="title.login"/>

I just wanted <baen:message>

I get following error


org.apache.jasper.JasperException: Exception in JSP: /jsp/First.jsp:8

5: <HTML>
6: <HEAD>
7: <TITLE>
8: <bean:message key="title.login"/>
9: </TITLE>
10: </HEAD>
11: <BODY><p> This is very very bad.


My is like

button.submit=Send for Verification<li>User ID is a required field</li><li>Password is a required field</li>
error.invalid.login=<li>The User ID and/or Password are invalid. Please try again.</li>
errors.header=<h3><font color="red">Validation Error</font></h3>You must correct the following error(s) before proceeding:<ul>
label.userId=User ID
heading.login=<H2>Enter your user information</H2>
title.login=Login Screen
label.userType=<H2>You are authorized to use this system as a</H2>
errors.required={0} is required.<br>
errors.minlength={0} cannot be less than {1} characters<br>

Where am I going wrong? I think taglibs entries are finding the required tld files in my WEB-INF but <bean:message> not working? Please guide.

Madhuri Dhahiwal
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
From what you've shown us of your struts-config.xml file, you haven't configured the message resources. You need an entry like this:

<message-resources parameter="message"/>

You also need to make sure your file is in /WEB-INF/classes.

This link has a lot of good information about all aspects of messages in Struts.

Consultant, Sima Solutions
Madhuri Dhahiwal

Joined: Jun 17, 2006
Posts: 2
Thanks it is really working now.

shruthip prashu

Joined: Jul 19, 2006
Posts: 5
Am using jsp and display tag. when am using java script its giving error.
could no process the requestorg.apache.jasper.JasperException: /web/viewdata.jsp(5,5) Invalid standard action

Can anyone help me.. Thanks in advance
I agree. Here's the link:
subject: Very basic question
It's not a secret anymore!