You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mighty Tornado <mi...@gmail.com> on 2009/04/20 22:30:39 UTC

Is there a better way?

*Struts: *1.3
*Tomcat:* 6.0
*OS:* Mac OS X

Hi,

I have a sample application I am building, and I got it working, but am not
sure that what I have is the best most efficient way to do it.

Here is what I have:

I have a Home Page with several <a href> links, one of which takes me to
Family Members page. The Family Members page is supposed to open already
pre-populated with a simple list of family members take from a DB.

To do that I mapped the URL from the Home Page <a href="/familyMembers.do">
in struts-config, like this

<action path="/familyMembers"
                name="familyMembersForm"
                type="com.vhousehold.struts.actions.FamilyMembersAction"
                scope="session">
            <forward name="success" path="/WEB-INF/JSP/familyMembers.jsp"/>


In the FamilyMembersAction class above, I use a DAO to get the information,
but then I put it in the request object as a regular attribute and have the
familyMembers.jsp display it.  This means I am not using the FORM at all.

This works, but is there a better way to do it with Struts? The question is:
the jsp page is not an HTML form; it just displays information - can I use
the form for this purpose though, and if so, should I?

Thanks,

Re: Is there a better way?

Posted by Mighty Tornado <mi...@gmail.com>.
Thanks.

On Mon, Apr 20, 2009 at 5:27 PM, Lukasz Lenart <lukasz.lenart@googlemail.com
> wrote:

> 2009/4/20 Mighty Tornado <mi...@gmail.com>:
> > This works, but is there a better way to do it with Struts? The question
> is:
> > the jsp page is not an HTML form; it just displays information - can I
> use
> > the form for this purpose though, and if so, should I?
>
> It's up to you, the only think, you have to be consistent. If you use
> request to display data, then use it through whole application, and
> then use forms only for add/edit purpose. Using request is even better
> if you want to use some third-part tag library like displaytag.
>
>
> Regards
> --
> Lukasz
> http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Is there a better way?

Posted by Lukasz Lenart <lu...@googlemail.com>.
2009/4/20 Mighty Tornado <mi...@gmail.com>:
> This works, but is there a better way to do it with Struts? The question is:
> the jsp page is not an HTML form; it just displays information - can I use
> the form for this purpose though, and if so, should I?

It's up to you, the only think, you have to be consistent. If you use
request to display data, then use it through whole application, and
then use forms only for add/edit purpose. Using request is even better
if you want to use some third-part tag library like displaytag.


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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