tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Woodchuck <woodchuc...@yahoo.com>
Subject RE: Probably an easy answer
Date Mon, 13 Jun 2005 14:55:54 GMT
hihi Charles,

perhaps it is possible to use another 'indicator' other than 'if a
variable has been declared or not'.

it suspect there is something else easier you can use...

for example, any session objects/parameters that differ when going to
the page with no declared variable vs declared?

it seems to me there are easier ways to frame your solution around,
other than by trying to detect if a given variable is declared or not.

just a thought,
woodchuck


--- "Charles P. Killmer" <charlesk@netgaintechnology.com> wrote:

> I tried the try catch block and that led me to asking this forum.  I
> tried a generic catch (Exception e)  and it resulted in a compile
> error.
> My suspicion is that this is not an easy thing to do.
> 
> Any brainstorms out there?
> 
> Charles 
> 
> -----Original Message-----
> From: Frank W. Zammetti [mailto:fzlists@omnytex.com] 
> Sent: Monday, June 13, 2005 8:34 AM
> To: Tomcat Users List
> Cc: Tomcat Users List
> Subject: RE: Probably an easy answer
> 
> The only other possible way I can think of, and I would have to do so
> experimenting to see if/how exactly it would work, would be something
> like:
> 
> try {
>   Object a = b; // Where b might be declared or might not be } catch
> (????) { // Not sure what exception would be thrown
>   // Do something when b wasn't declared }
> 
> I'm assuming there is a runtime exception to check for... that may
> not
> be true at all... part of me suspects there isn't... that's why I'd
> have
> to do some experimenting :)
> 
> In fact, being in a JSP this might be the best option because I'm not
> sure how you could use reflection as I suggested, i.e., what object
> would you inspect when the field you want to check for is a JSP
> variable?  I'm not sure.
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Mon, June 13, 2005 8:58 am, Charles P. Killmer said:
> > Thanks.  And I do mean declared.  I have a jsp that is included by
> a 
> > few other jsp's.  Some of them declare a variable and some do not. 
> 
> > Right now I have two files that are almost identical.  One expects
> the
> 
> > variable to be present and the other does not.  I am looking to 
> > consolidate these two files.
> >
> > Charles
> >
> > -----Original Message-----
> > From: Frank W. Zammetti [mailto:fzlists@omnytex.com]
> > Sent: Friday, June 10, 2005 5:46 PM
> > To: Tomcat Users List
> > Subject: Re: Probably an easy answer
> >
> > If it is a class member you could conceivably use reflection to see
> if
> 
> > a given object/class has a member you name... if it's local though,
> 
> > no, it's a purely compile-time check.
> >
> > Do you really mean declared or do you perhaps mean initialized?
> >
> > Frank
> >
> > Charles P. Killmer wrote:
> >> Is there a way to, at runtime, check if a variable is declared?  I
> 
> >> have some code that I want to behave differently depending on
> whether
> 
> >> or not a variable has been declared.  I tried using a try catch
> block
> 
> >> but it gets caught at compile time.
> >>
> >> Thanks
> >> Charles
> >>
> >>
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> >>
> >>
> >>
> >>
> >>
> >
> > --
> > Frank W. Zammetti
> > Founder and Chief Software Architect
> > Omnytex Technologies
> > http://www.omnytex.com
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



		
__________________________________ 
Discover Yahoo! 
Use Yahoo! to plan a weekend, have fun online and more. Check it out! 
http://discover.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message