http://www.mkyong.com/tutorials/struts-tutorials/
---------------------------------------- > Date: Thu, 27 Jan 2011 16:37:27 -0500 > From: anji...@hotmail.com > To: user@struts.apache.org > Subject: Re: [S 1.3.8] Simple Struts Example > > 1. JSP Files > ========= > a) Calling page > --------------------- > <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> > <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> > <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> > > > > > Message body > > > > > > > > > b) Result Page > ------------------- > <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> > > > > JSP Page > > > result > > class="com.anjib.beans.DataBean" /> > > > > > > 2. Bean Class > =========== > package com.anjib.beans; > > import java.io.Serializable; > > public class DataBean implements Serializable { > > private String sampleProperty; > > public DataBean() { > > } > > public String getSampleProperty() { > return sampleProperty; > } > > public void setSampleProperty(String value) { > this.sampleProperty = value; > } > } > > 3. Action Class > ============ > package com.anjib.actions; > > import com.anjib.beans.DataBean; > import javax.servlet.http.HttpServletRequest; > import javax.servlet.http.HttpServletResponse; > import org.apache.struts.action.ActionForm; > import org.apache.struts.action.ActionForward; > import org.apache.struts.action.ActionMapping; > > public class GetValueAction extends org.apache.struts.action.Action { > > private static final String SUCCESS = "success"; > > @Override > public ActionForward execute(ActionMapping mapping, ActionForm form, > HttpServletRequest request, HttpServletResponse response) > throws Exception { > DataBean myBean = new DataBean(); > myBean.setSampleProperty("Anjib"); > System.out.println("Bean Value: " + myBean.getSampleProperty()); > return mapping.findForward(SUCCESS); > } > } > > When I run this app I get null as result. > > On 1/27/2011 4:16 PM, Anjib Mulepati wrote: > > Hi All, > > > > I am looking for the simple example of using beans and tag in Struts > > to avoid using scriptlets. I am trying to get concept of using tag to > > access result from back end using the beans. It will be very helpful > > if some one can provide me a link or example which I can look into. > > > > Thanks > > Anjib > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > > For additional commands, e-mail: user-h...@struts.apache.org > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org