wood burning stoves 2.0*
The moose likes Struts and the fly likes Doubt in Bean Details display Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Doubt in Bean Details display" Watch "Doubt in Bean Details display" New topic
Author

Doubt in Bean Details display

Divakar Sashwanth
Greenhorn

Joined: Apr 17, 2005
Posts: 11
Hi,

I am new to struts.. I am trying to learn the flow of a struts application... I am caught up with a problem.

I have a actionform, action class and a bean. In the action class i query for the details from the database and set it the values to the bean abd then redirect to an another page(confirmation.jsp). In the confirmation.jsp i need to display the values of the bean which are assigned in the action class. How will i do it... i tried using the bean:write tag.. but i came with errors and i am still trying on it.. Can u please hel pme in this..

I have atatched my code below.. please help me... weaiting for ur reply..


Member Bean

public class Member {

private String emailID;
private String firstName;


// all the getters and setters for the member bean


}


Action Class

public class EntryAction extends Action {
public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm,
HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {

EntryForm entryForm = (EntryForm)actionForm;
Member member = null;
String target = "success";
String emailID = "ram@yahoo.com";
String firstName = "Ram";

member = new Member();
member.setEmailID(emailID);
member.setFirstName(firstName);
httpServletRequest.setAttribute("member", member);

return actionMapping.findForward(target);
}
}


confirmation.jsp

<%@ taglib uri="struts/bean-el" prefix="bean" %>
<%@ taglib uri="struts/html-el" prefix="html" %>
<%@ taglib uri="struts/logic-el" prefix="logic" %>

<jsp:useBean id="member" scope="request" class="Member"/>
<html>
<head>
<title>Title</title>
</head>

<body>
<bean:write name="member" property="emailID" />
</body>
</html>


Divakar
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Please post the error message you're getting.

One thing I can see right away is that you need to put all the java classes you create in packages. Classes in the default package don't do well in web applications.


Merrill
Consultant, Sima Solutions
Vasudhaiv Naresh
Ranch Hand

Joined: May 13, 2005
Posts: 57
Hi,
can u paste the stack trace.
I think there's a problem with th eproperty emailID in the bean.
Regards,
Naresh
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Doubt in Bean Details display