Re: Where can I find Example
I can't see anything wrong with your code. If you want, you can download the source code from the book's website at www.wiley.com/compbooks/goodwill rc --- Rama <[EMAIL PROTECTED]> wrote: > Hi, > I have been trying to implement Struts for a simple > applicaiton. > I am using WLS 6.1 and Struts 1.02. > > > Application: User enters a stock symbol and clicks > submit button in the index page. > if the value is "SUNW" , it is success and value is > displayed, > else it is failure , user is forwarded to starting > index page. > > Here is the following code > > > index.jsp > > <%@ page language ="java" %> > <%@ taglib uri="/WEB-inf/struts-html.tld" > prefix="html" %> > > type="LookupForm" > > Symbol : > > > . > > > > > LookupAction.java > import java.io.*; > import java.util.*; > import javax.servlet.*; > import javax.servlet.http.*; > import org.apache.struts.action.*; > > public class LookupAction extends Action > { > protected Double getQuote(String symbol) > { > if (symbol.equalsIgnoreCase("SUNW") ) > { > return new Double(25.00); > > } > return null; > } > > public ActionForward execute(ActionMapping mapping, > ActionForm form, > HttpServletRequest request, > HttpServletResponse response) throws > ServletException,IOException > { > Double price = null; > // set default target to success > > String target = new String("success"); > > if (form != null) > { > // use the LookupFoprm to get request parameters. > > LookupForm lookupForm = (LookupForm)form; > > String symbol = lookupForm.getSymbol(); > > price = getQuote(symbol); > > } > // set the target to failure > if (price == null) > { > target = new String("failure"); > > } > else > { > request.setAttribute("PRICE", price); > } > > // forward to the appropriate view > return(mapping.findForward(target) ); > > } > } > > > > LookupForm.java > import java.io.*; > import java.util.*; > import javax.servlet.*; > import javax.servlet.http.*; > import org.apache.struts.action.ActionForm; > import org.apache.struts.action.ActionMapping; > > public class LookupForm extends ActionForm > { > private String symbol = null; > > public String getSymbol() > { > return (symbol); > } > public void setSymbol(String symbol) > { > this.symbol = symbol; > } > > public void reset(ActionMapping mapping, > HttpServletRequest request) > { > this.symbol=null; > } > > } > > > > > struts-config.xml > > Foundation//DTD Struts Configuration 1.0//EN" > "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd";> > > > > > > >name="lookupForm" input="/index.jsp"> > > > > > > > > > > This is the excerpt from web.xml > > /WEB-INF/struts-html.tld > > /WEB-INF/struts-html.tld > > > > action > > org.apache.struts.action.ActionServlet > > config > > /WEB-INF/struts-config.xml > > 1 > > > > action > *.do > > quote.jsp > . > > Current Price : <%= request.getAttribute("PRICE") > %> > > ... > > > When I entered the SUNW in the text box, I am > forwarded to a blank page. > I am not seeing any results... why??? > > Please anyone let me know what I am missing? > Any ideas are really appreciated > Thanks in Advance > Rama > > > __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where can I find Example
This link has examples from the Oreilly book. http://examples.oreilly.com/jakarta/ --- "Pellier, Marc" <[EMAIL PROTECTED]> wrote: > Hi, > I'm new > Where can I find exampleS of struts Application > (other than struts-example) ? > > Thanks > > > Disclaimer: > This electronic transmission and any files attached > to it are strictly > confidential and intended solely for the addressee. > If you are not > the intended addressee, you must not disclose, copy > or take any > action in reliance of this transmission. If you have > received this > transmission in error, please notify the sender by > return and delete > the transmission. Although the sender endeavors to > maintain a > computer virus free network, the sender does not > warrant that this > transmission is virus-free and will not be liable > for any damages > resulting from any virus transmitted. > Thank You. > > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where can I find Example
Marc, http://jakarta.apache.org/struts/resources/examples.html It's also generally a good idea to search the archives before posting a question on a list - this question has been asked several times. A good search archive is: http://marc.theaimsgroup.com/?l=struts-user&r=1&w=2 Best of luck, -- Becky Norum Database Administrator Center for Subsurface Sensing and Imaging Systems (CenSSIS) Northeastern University http://www.censsis.neu.edu On Wed, 2003-03-05 at 08:22, Pellier, Marc wrote: > Hi, > I'm new > Where can I find exampleS of struts Application (other than struts-example) ? > > Thanks > > > Disclaimer: > This electronic transmission and any files attached to it are strictly > confidential and intended solely for the addressee. If you are not > the intended addressee, you must not disclose, copy or take any > action in reliance of this transmission. If you have received this > transmission in error, please notify the sender by return and delete > the transmission. Although the sender endeavors to maintain a > computer virus free network, the sender does not warrant that this > transmission is virus-free and will not be liable for any damages > resulting from any virus transmitted. > Thank You. > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Where can I find Example
http://sf.net/projects/struts > -Original Message- > From: Pellier, Marc [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 05, 2003 6:23 AM > To: Struts Users Mailing List > Subject: Where can I find Example > > > Hi, > I'm new > Where can I find exampleS of struts Application (other than > struts-example) ? > > Thanks > > ** > ** > Disclaimer: > This electronic transmission and any files attached to it are > strictly > confidential and intended solely for the addressee. If you are not > the intended addressee, you must not disclose, copy or take any > action in reliance of this transmission. If you have received this > transmission in error, please notify the sender by return and delete > the transmission. Although the sender endeavors to maintain a > computer virus free network, the sender does not warrant that this > transmission is virus-free and will not be liable for any damages > resulting from any virus transmitted. > Thank You. > ** > ** > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]