You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Affan Qureshi <qu...@etilize.com> on 2003/04/02 05:36:31 UTC

[OT] Re: A question

Isn't the scriplet free version more confusing/cryptic than the scriplet
one? I know we should avoid scriplets 110% in JSPs but what about cases
where it can save some confusion of five tags to do a simple thing?

The reason to avoid scriplets is to allow seperation of page designers and
developers dependancies but the poor page designer won't make much sense out
of either of them in this case i think and its better to give him one line
of confusion than 5.

Intersted to know your comments.

Regards,
Affan

----- Original Message -----
From: "James Mitchell" <jm...@apache.org>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, April 02, 2003 12:21 AM
Subject: Re: A <bean:define> question


> ....or using the scriptlet-free version
>
> <bean:parameter id="myparam" name="httpParameter"/>
>
> <bean:define id="msgKey">
>  <bean:write name="myparam"/>.name
> </bean:define>
>
> <bean:define id="varName">
>  <bean:message name="msgKey"/>
> </bean:define>
>
> <bean:write name="varName"/>  <-- remove this unless you just want to
print
> it out on the page
>
>
>
> --
> James Mitchell
> Software Developer/Struts Evangelist
> http://www.open-tools.org
>
>
>
> ----- Original Message -----
> From: "Karr, David" <Da...@wamu.net>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Tuesday, April 01, 2003 11:14 AM
> Subject: RE: A <bean:define> question
>
>
> > This might work:
> >
> > <bean:define id="varName">
> > <bean:message key='<%= request.getParameter("httpParameter") +
> >                              ".name" %>'/>
> > </bean:define>
> >
> > > -----Original Message-----
> > > From: Binaghi Mauro [mailto:mauro.binaghi@vtin.it]
> > >
> > > Hi
> > > I have the "user.name" property in my "ApplicationResource.properties"
> > > file.
> > > Can I take its value with the following instrucition in my JSP page?
> > >
> > > <bean:define id="varName">
> > > <bean:message key="<%= request.getParameter("httpParameter")
> > > %>.name"/>
> > > </bean:define>
> > >
> > > Of course, I call my JSP with this URI
> > "/myPage.jsp?httpParameter=user"
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


RE: [OT] Re: A question

Posted by apachep2 <ap...@hotmail.com>.
I found sometimes it is hard to use one-line JSTL code in a situation
like this

- iterate through a list.
- if odd line, use style oddTableRowStyle
- if even line, use style evenTableRowStyle

e.g.

<logic:iterate name=myBean property=myCollection id=myLineItem>
	<TR id=myStyle>
		<TD>......</TD>
	</TR>
</logic:iterate>

How do I fill in this "myStyle" to serve the above purpose? Just a quiz,
don't take it seriously.

Regards

-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org] 
Sent: April 2, 2003 12:18 PM
To: Struts Users Mailing List
Subject: Re: [OT] Re: A <bean:define> question



On Wed, 2 Apr 2003, Affan Qureshi wrote:

> Date: Wed, 2 Apr 2003 08:36:31 +0500
> From: Affan Qureshi <qu...@etilize.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: Struts Users Mailing List <st...@jakarta.apache.org>
> Subject: [OT] Re: A <bean:define> question
>
> Isn't the scriplet free version more confusing/cryptic than the
scriplet
> one? I know we should avoid scriplets 110% in JSPs but what about
cases
> where it can save some confusion of five tags to do a simple thing?
>
> The reason to avoid scriplets is to allow seperation of page designers
and
> developers dependancies but the poor page designer won't make much
sense out
> of either of them in this case i think and its better to give him one
line
> of confusion than 5.
>
> Intersted to know your comments.
>

It's not just the page author you should be worrying about -- the page
compiler is affected as well.  Pages with no scriptlets allow the
compiler
to create much better executable code (including lifting the 64k limit
on
method size that really affects pages with lots of custom tags).

Personally, I prefer the JSTL syntax for stuff like this:

  <c:set var="varName" value="${requestScope.httpParameter}"/>

> Regards,
> Affan

Craig

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


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


Re: [OT] Re: A question

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 2 Apr 2003, Affan Qureshi wrote:

> Date: Wed, 2 Apr 2003 08:36:31 +0500
> From: Affan Qureshi <qu...@etilize.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: Struts Users Mailing List <st...@jakarta.apache.org>
> Subject: [OT] Re: A <bean:define> question
>
> Isn't the scriplet free version more confusing/cryptic than the scriplet
> one? I know we should avoid scriplets 110% in JSPs but what about cases
> where it can save some confusion of five tags to do a simple thing?
>
> The reason to avoid scriplets is to allow seperation of page designers and
> developers dependancies but the poor page designer won't make much sense out
> of either of them in this case i think and its better to give him one line
> of confusion than 5.
>
> Intersted to know your comments.
>

It's not just the page author you should be worrying about -- the page
compiler is affected as well.  Pages with no scriptlets allow the compiler
to create much better executable code (including lifting the 64k limit on
method size that really affects pages with lots of custom tags).

Personally, I prefer the JSTL syntax for stuff like this:

  <c:set var="varName" value="${requestScope.httpParameter}"/>

> Regards,
> Affan

Craig

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


Re: [OT] Re: A question

Posted by James Mitchell <jm...@apache.org>.
On Tue, 2003-04-01 at 22:36, Affan Qureshi wrote:
> Isn't the scriplet free version more confusing/cryptic than the scriplet
> one? I know we should avoid scriplets 110% in JSPs but what about cases
> where it can save some confusion of five tags to do a simple thing?

Well, first of all, referencing a key from the bundle like this is poor
design IMHO.  Something like that should have been done in the action,
and placed on the formbean.  I was just trying to help with syntax.

> 
> The reason to avoid scriplets is to allow seperation of page designers and
> developers dependancies but the poor page designer won't make much sense out
> of either of them in this case i think and its better to give him one line
> of confusion than 5.

I agree.

> 
> Intersted to know your comments.
> 
> Regards,
> Affan
> 
> ----- Original Message -----
> From: "James Mitchell" <jm...@apache.org>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Wednesday, April 02, 2003 12:21 AM
> Subject: Re: A <bean:define> question
> 
> 
> > ....or using the scriptlet-free version
> >
> > <bean:parameter id="myparam" name="httpParameter"/>
> >
> > <bean:define id="msgKey">
> >  <bean:write name="myparam"/>.name
> > </bean:define>
> >
> > <bean:define id="varName">
> >  <bean:message name="msgKey"/>
> > </bean:define>
> >
> > <bean:write name="varName"/>  <-- remove this unless you just want to
> print
> > it out on the page
> >
> >
> >
> > --
> > James Mitchell
> > Software Developer/Struts Evangelist
> > http://www.open-tools.org
> >
> >
> >
> > ----- Original Message -----
> > From: "Karr, David" <Da...@wamu.net>
> > To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> > Sent: Tuesday, April 01, 2003 11:14 AM
> > Subject: RE: A <bean:define> question
> >
> >
> > > This might work:
> > >
> > > <bean:define id="varName">
> > > <bean:message key='<%= request.getParameter("httpParameter") +
> > >                              ".name" %>'/>
> > > </bean:define>
> > >
> > > > -----Original Message-----
> > > > From: Binaghi Mauro [mailto:mauro.binaghi@vtin.it]
> > > >
> > > > Hi
> > > > I have the "user.name" property in my "ApplicationResource.properties"
> > > > file.
> > > > Can I take its value with the following instrucition in my JSP page?
> > > >
> > > > <bean:define id="varName">
> > > > <bean:message key="<%= request.getParameter("httpParameter")
> > > > %>.name"/>
> > > > </bean:define>
> > > >
> > > > Of course, I call my JSP with this URI
> > > "/myPage.jsp?httpParameter=user"
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
-- 
James Mitchell
Software Developer/Struts Evangelist
http://www.open-tools.org




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