The compiler is not able to determine that 'myComputerName' will exist
because you only instantiate it inside of an IF statement

you should do a:
String myComputerName = new String();
outside of your IF so that the object is brought into scope, then
just perform a value assignment inside the IF
myComputerName = myComputer.getComputerName();

That way there will always be a 'myComputerName' object to satisfy the
compiler.

- vin




At 10:02 AM 5/15/00 -0700, you wrote:
>Ok.  So in my JSP I call on a servlet that returns data to me via a
>"Computer" object which has name and description properties, but I can't
>seem to get to those properties once I'm back in my JSP.  The jsp code is
>this:
><%
>         if (request.getParameter("selComputers") != null) {
>                 String getComputer = request.getParameter("selComputers");
>                 net.authentix.applicationdefs.Computer myComputer =
>clsGetComputers.compGetAComputer(getComputer);
>                 String myComputerName = myComputer.getComputerName();
>                 String myComputerDescription =
>myComputer.getComputerDescription();
>         }
>%>
>
>It is called in a file that get's included only if
>request.getParameter("selComputers") exists.
>But, if later in the same jsp I reference <%=myComputerName%> I receive this
>error
>
>
>
>
>
>d:\InetPub\ServletExec\ISAPI\Servlets\pagecompile\_AprilRelease\_AdminFuncti
>ons\_System\_Services\_console_xjsp.java:189: Undefined variable:
>myComputerName
>         out.print( String.valueOf(  myComputerName  ) );
>                                         ^
>Is this a common or obvious error?  It has me quite stumped.  Admittedly I
>am a COM/VB dll web programmer trying to learn jsp but I just want to access
>the properties of my object.  Is this possible in my jsp?
>I wouldn't ask but I've been trying for a couple days now and cannot get
>there.
>Thanks.
>Jt.
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to