Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in Bean Details display

 
Divakar Sashwanth
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vasudhaiv Naresh
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
can u paste the stack trace.
I think there's a problem with th eproperty emailID in the bean.
Regards,
Naresh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic