tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Mohrig <andreas.moh...@cadooz.de>
Subject RE: registering variables
Date Thu, 12 Sep 2002 15:36:45 GMT
I don't know Struts, but if it is possible to register variables in other
scopes with the help of Struts it gives me the creeps/makes me shudder and
would not shine a good light on Java as a programming language. Why should
you want to register a variable in the first place? Java is good for
encapsulation and information hiding. Data transport can be managed via
return values of method calls or if there is absolutely no other way over
global contexts (which is frightful by itself). What you are talking about
would undermine the foundations of the Java programming language (in my
humble opinion as a programmer). But I'm willing to learn and to broaden my
perspective, so if you have a case where it is absolutely necessary (or even
practically/elegant or otherwise useful) to do what you want to do, please
let me know about it.

Andreas Mohrig

-----Original Message-----
From: Felipe Schnack [mailto:felipes@ritterdosreis.br]
Sent: Thursday, September 12, 2002 5:16 PM
To: Tomcat Users List
Subject: RE: registering variables


  Ok, but this is an attribute, not an variable really. There isn't a
way I can register a variable? Like in Strut's TE tags?

On Thu, 2002-09-12 at 11:57, Andreas Mohrig wrote:
> You could put it in the pageContext (or even in the session or application
> context). That will require some syntactic clutter (first 
> 	pageContext.setAttribute("variableName",objectVariable);
>  then (in the jsp page)
>       ObjectType myVariable =
> (ObjectType)pageContext.getAttribute("variableName",objectVariable);
> )
> and opens the possibilitie of errors that are hard to debug (what if there
> is already an attribute with that name?) but is much safer than directly
> creating variables in other scopes. It is one of javas merits that this is
> not possible (at least not to my knowledge).
> 
> greetings
> 
> Andreas Mohrig
> 
> -----Original Message-----
> From: Felipe Schnack [mailto:felipes@ritterdosreis.br]
> Sent: Thursday, September 12, 2002 4:42 PM
> To: Tomcat Users List
> Subject: registering variables
> 
> 
>   How can I create an variable within an taglib? I would like to be able
> to create an variable accesible to my jsp page.
> 
> -- 
> 
> Felipe Schnack
> Analista de Sistemas
> felipes@ritterdosreis.br
> Cel.: (51)91287530
> Linux Counter #281893
> 
> Faculdade Ritter dos Reis
> www.ritterdosreis.br
> felipes@ritterdosreis.br
> Fone/Fax.: (51)32303328
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:tomcat-user-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>
> 
-- 

Felipe Schnack
Analista de Sistemas
felipes@ritterdosreis.br
Cel.: (51)91287530
Linux Counter #281893

Faculdade Ritter dos Reis
www.ritterdosreis.br
felipes@ritterdosreis.br
Fone/Fax.: (51)32303328


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

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


Mime
View raw message