Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 6403 invoked from network); 28 Jan 2011 16:40:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 28 Jan 2011 16:40:54 -0000 Received: (qmail 7274 invoked by uid 500); 28 Jan 2011 16:40:52 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 6778 invoked by uid 500); 28 Jan 2011 16:40:49 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 6770 invoked by uid 99); 28 Jan 2011 16:40:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Jan 2011 16:40:48 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RFC_ABUSE_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of anjibcs@hotmail.com designates 65.55.111.86 as permitted sender) Received: from [65.55.111.86] (HELO blu0-omc2-s11.blu0.hotmail.com) (65.55.111.86) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Jan 2011 16:40:40 +0000 Received: from BLU0-SMTP200 ([65.55.111.73]) by blu0-omc2-s11.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 28 Jan 2011 08:40:19 -0800 X-Originating-IP: [146.243.44.97] X-Originating-Email: [anjibcs@hotmail.com] Message-ID: Received: from [146.243.44.97] ([146.243.44.97]) by BLU0-SMTP200.blu0.hotmail.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Fri, 28 Jan 2011 08:40:18 -0800 Date: Fri, 28 Jan 2011 11:40:17 -0500 From: Anjib Mulepati User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: Struts Users Mailing List Subject: Re: [S 1.3.8] Simple Struts Example References: <4D41E597.3080806@hotmail.com> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 28 Jan 2011 16:40:18.0268 (UTC) FILETIME=[0C08E9C0:01CBBF0A] 1. " ..... when you try to display a bean property in your JSP you're not seeing the value you expect in the browser." Yes, I set the bean value in execute() method and I am trying to get that display in JSP result page. 2. "You also submit a form, and you might mean that the form isn't being handled in the way you ...." My form have just have a single button which just trigger the action. 3. " .. but show nothing that actually puts a bean into the session. So far, your problem is there." I also think that I am missing something to relate between bean in action and JSP page. 4. " ... is there a reason you're learning Struts 1?" I am working ont his app developed in struts 1 so try to fix around. Soon I will be moving to Struts 2. So what will be the solution to issue #3? Thanks Anjib On 1/28/2011 9:59 AM, Dave Newton wrote: > On Fri, Jan 28, 2011 at 9:50 AM, Anjib Mulepati wrote: >> Can anyone help to get this simple program run? > I suspect you mean "run correctly". > >> When I run this app I get null as result. > When describing a problem it's helpful to be specific: while reading the > code leads me to *believe* what you mean is that when you try to display a > bean property in your JSP you're not seeing the value you expect in the > browser. > > But I really have no idea if that assumption is correct. You also submit a > form, and you might mean that the form isn't being handled in the way you > expect (although you've done, or at least shown, nothing related to Struts 1 > form processing at all). > > So. > > You're attempting to display a bean value retrieved from the session, but > show nothing that actually puts a bean into the session. So far, your > problem is there. > > You'll be disappointed when you find out all you have to do to process forms > in the normal Struts 1 way... is there a reason you're learning Struts 1? > Most new development has moved on to more recent frameworks, with good > reasons. I'm suspicious of companies doing new development in Struts 1. > > Dave > > >> On 1/27/2011 4:37 PM, Anjib Mulepati wrote: >> >>> 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" %> >>> >>> >>> >>> >>> <bean:message key="welcome.title"/> >>> >>> >>>
>>> >>>
>>> >>>
>>> >>> 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-unsubscribe@struts.apache.org >>>> For additional commands, e-mail: user-help@struts.apache.org >>>> >>>> >>>> >>>> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org >> For additional commands, e-mail: user-help@struts.apache.org >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org