You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Graham <dg...@hotmail.com> on 2002/11/12 20:53:32 UTC
RE: From old JSP and Servlets to STRUTS
I think all that code would be called from an Action. I didn't see anything
that tied it to presentation.
David
>From: "Fernando Hernandez" <fe...@bit-bang.com>
>Reply-To: "Struts Users Mailing List" <st...@jakarta.apache.org>
>To: "Struts Users Mailing List" <st...@jakarta.apache.org>
>Subject: RE: From old JSP and Servlets to STRUTS
>Date: Tue, 12 Nov 2002 20:37:10 +0100
>
>Thanks for your interest in this...
>
>Here is one the cases(The problem line have a comment with asterisks):
>
> BeanMetacontent currentRes = session.getAttribute("currentRes");
> try {
> /*********/BeanMetaContent currentContent =
>currentRes.getMetaContentByLanguage(currBeanLang.getLanguageId());
> langDefined = true;
> currContentClass = "mngTableLine";
> } catch (NotFoundLanguageException e) {
> currentContent = new BeanMetaContent();
> currentContent.setTitle(defBeanLang.getNotFoundMessage());
>
>currentContent.setDescription(defBeanLang.getNotFoundMessage());
> currentContent.setSubject(defBeanLang.getNotFoundMessage());
> currentContent.setLanguage(currBeanLang.getLanguageId());
> }
> langDefined = false;
> currContentClass = "mngTableLineUntranslated";
>
>//////////////////////////////////////////////////////
>
>I receive in the Session Scope an object named currentRes...whcih I use to
>instanciate the BeanMetaContent class(currentContent) by calling a method
>(currentRes.getMetaContentByLanguage ( currBeanLang.getLanguageId() )which
>is not a simple getter, beacuse a parameter has to be given to it to
>retreive the instance.
>
>Also, the method getMetaContentByLanguage( LanguageId ), throws a
>LanguageNotFoundException when the content with the desired language is not
>found. This exception I have to catch it(I don't know yet how to do it) and
>then do some setters like
>currentContent.setTitle(defBeanLang.getNotFoundMessage()(which I think I
>can
>do it but not sure yet).
>
>What I have understand through my research and the answers from the people
>I
>have asked for an opinion about this, is that the presentation layer should
>not be handling this type of operations that can be done (maybe even more
>effectively) in the logic layer. That the presentation should only care
>about showing content and not as in this example if there is content in a
>particular language and then show in it. Another example is the fact of
>setting attributes of the currContentClass to use them later...
>
>I still have to learn a lot of the whole perspective about Struts(though I
>have read dozens of articles and tutorials jeje)...my main tasks are
>adopting Model 2, and giving the JSPs enough simplicity and versatility so
>they can be easily parametirized resulting in customer benefit and
>maintanance efficiency. But the main obstacle I have found(I may be wrong
>about this) is that in this case, the presentation and the logic layer are
>to tightly related, as I assume I show in the previous example(again, I
>maybe wrong about this). But i'll keep on investigating about this until
>I'm
>completely sure about the "whole picture", and until i have a well defined
>strategy for this project in particular.
>
>THANKS A LOT FOR YOU INTEREST!
>
>F.
>
>
>
>
>
>
>
>
>
>
>
>-----Mensaje original-----
>De: Karr, David [mailto:david.karr@attws.com]
>Enviado el: martes, 12 de noviembre de 2002 19:18
>Para: Struts Users Mailing List
>Asunto: RE: From old JSP and Servlets to STRUTS
>
>
>Show us some examples of why you think you can't remove the scriptlets.
>Some of those cases are probably easily fixable.
>
>However, you should probably first understand the model and framework
>before
>trying to fix your JSP pages. This is because you'll find that anything
>resembling "business logic" will not be in your JSP pages.
>
>Once you address that, you'll mostly just have a few scriptlet expressions
>left to cover cases that aren't easily covered with normal usage of Struts.
>
>Just integrating with the JSTL will also help, as you can use some JSTL
>tags
>that use the JSTL EL instead of using scriptlets.
>
>You can also move towards using the Struts-EL library (in the nightly
>build), which is a version of the Struts tag library which uses the JSTL EL
>engine to evaluate attribute values.
>
> > -----Original Message-----
> > From: Fernando Hernandez [mailto:fernando@bit-bang.com]
> >
> > I am student doing an intership and i just started to learn
> > about Struts
> > because I'm currently transforming a J2EE web application composed by
> > servlets and old-java-embedded-JSPs so it can adopt Model 2.
> >
> > To acomplish this i found that using Struts is the prefect
> > answer. To reach
> > my goal, at first I thought that maybe the best way to do it
> > was to first
> > address the interface by taking out all the Java embedded in
> > all the JSPs,
> > and change it with Struts, JSTL, custom made taglibs. After
> > doing this, i
> > was going then to think about the Model and the framework itself...
> >
> > But i have found that to take out the embedded java from the
> > JSP has been
> > very difficult, since the objects(I'd like to say JavaBeans,
> > bur they 're
> > not exactly that, and actually that is part of the problem) which were
> > sended from the logic to the presentation were very complex
> > in nature and
> > the content an not be presented just by using the strut's,
> > JSTL or many
> > other libraries i have looked exhaustively.
> >
> > So, should i leave some Java embedded in the JSPs?
> > If the answer to the previous question is "yes", should I
> > maybe put the
> > embedded Java into custom tag libraries made by me? or maybe
> > use includes or
> > imports?
> >
> >
> > I please ask your help on this since I'm running out of time.
> >
> > Thanks from Madrid.
> >
> >
> > Fernando Hernandez.
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
>For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>--
>To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
>For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>
>
>
>--
>To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
>For additional commands, e-mail:
><ma...@jakarta.apache.org>
_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RES: html:select and collections
Posted by Francisco Goncalves Rodrigues <fc...@atlantico.com.br>.
Try use:
request.setAttribute("productTypes", productTypes);
instead
session.setAttribute("productTypes", productTypes);
Fco. Goncalves
-----Mensagem original-----
De: Gus Delgado [mailto:gdelgado@oceanobjects.com]
Enviada em: terca-feira, 12 de novembro de 2002 18:07
Para: Struts Users Mailing List
Assunto: html:select and collections
I declare a tag in my jsp like this
<html:select name="dataEntryForm" property="productType">
<html:options collection="productTypes" property="value"
labelProperty="label"/>
</html:select>
and my action for pre population goes something like this
Collection productTypes = getProductTypes(results);
session.setAttribute("productTypes", productTypes);
I'm getting an error saying that the productTypes bean does not exist?
any ideas
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
html:select and collections
Posted by Gus Delgado <gd...@oceanobjects.com>.
I declare a tag in my jsp like this
<html:select name="dataEntryForm" property="productType">
<html:options collection="productTypes" property="value"
labelProperty="label"/>
</html:select>
and my action for pre population goes something like this
Collection productTypes = getProductTypes(results);
session.setAttribute("productTypes", productTypes);
I'm getting an error saying that the productTypes bean does not exist?
any ideas
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>