sandeep Mule

Greenhorn
+ Follow
since Jul 31, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sandeep Mule

I need a help on Struts ActionMessage class.
I am using ActionMessages to Show Errors collected in processing Action class.
I am unable to get the messages displayed in my JSP. Even messages are present in ActionErrors Object, JSP shows Blank space instead of message. Can some buddy look into my problem.

Code in my action is like-------
Try{
//Action Specific code.

} catch(ExecuteOperationException eoe){
eoe.printStackTrace();
ActionMessage actionMessage = new ActionMessage("error.UserForm.LastName.NotPresent",false);

errors.add("ErrorMessage",actionMessage);
System.out.println("Key = "+actionMessage.getKey()+" /n Value = "+actionMessage.getValues()+" /n isResource = "+actionMessage.isResource());
saveErrors(request, errors);

System.out.println("Error = "+ errors);
Iterator it = errors.get();
while(it.hasNext()){
System.out.println(" Item == "+it.next());
}
forward = mapping.findForward("failure");


Struts Entry for Action and message is as given below.


<form-bean name="UserForm" type="com.lb.ort.web.form.UserForm" />



<action path="/UserAction"
type="com.lb.ort.web.action.UserAction" name="UserForm"
input="/index.jsp" parameter="parameter"
scope="request">
<forward name="add" path="/pages/AddUser.jsp" />
<forward name="edit" path="/pages/EditUsre.jsp" />
<forward name="search" path="/pages/DeleteUser.jsp" />
<forward name="failure" path="/pages/AddUser.jsp" />
</action>


<message-resources key="error"
parameter="com/lb/ort/web/resources/ErrorMessages" null="false" />


also my message Resource file is

error.UserForm.FirstName.NotPresent=Please insert value for First Name.
error.UserForm.LastName.NotPresent=Please insert value for Last Name.
error.UserForm.action.Problem={0}Sandeep
error.field.required=Value Required at given spot.


And My JSP is



<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>

<script language="javascript">
resetPaintMessage();
<logic`:messagesPresent>
<html:messages id="msg" property="ErrorMessage" bundle="error">
paintErrorMessage('<bean:write name="msg"/>');
</html:messages>
</logic:messagesPresent>
closePaintMessage();
</script>

Can Someone try to Solve my problem.
16 years ago