You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by cool dude <co...@yahoo.com> on 2002/02/07 11:57:51 UTC
Migrating from another framework to struts ...
Hi,
We are currently migrating from another framework
to struts. This has brought about a lot of queries &
doubts about how we can use struts to do things for us
that the earlier framework provided. My main concerns
are :
1. Does struts provide any build-in mechanism for
session management? If not, then is there any
guideline as to how struts can be used to provide that
kindof support?
2. How do I deal with form beans that have
aggregate objects in them. For example, I have a class
called UserInfo, which has the username
& the user address (which is another class called
AddressInfo) among other things. Now, if I have to use
UserInfo class to display/edit user information in a
form. How would I manage that?
3. I'm also having problems with URL forwards. It
looks like in struts you have give URL forwards
starting with "/". What if I want to
forward to a URL that doesn't being with "/", i.e., a
relative URL. Say my site looks something like this
http://mysite.com/info1/info2/actionname and I would
want to carry this URL for all the actions, ie, only
the action name would change & the rest of the URL
remains the same. Maybe I'm missing soemthing out
here.
These are few of the questions that I had. Since I'm
new to struts, these questions may be naive. Please
get back to me if you need further clarifications on
the questions.
Thanx in advance,
VD.
__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Migrating from another framework to struts ...
Posted by cool dude <co...@yahoo.com>.
Hi Ted and Oliver,
First lemme thank you guyz for the quick response.
Few of your suggestions have really helped me. But my
problem with relative URL still remains. Maybe I
didn't explain the problem in the right manner. Lemme
tell you what the exact scenario is. I have a URL
which looks like
http://www.mysite.com/US/en/brandname/actionname.
This would be the URL even for the starting page, with
actionname being say "home". I need such a lengthy URL
because the site supports multiple countries &
languages & brands. I get this information form the
URL. I know we could have send this information even
as a querystring but unfortunately this is the
standard URL now and I can't change it. Now the
problem is this: If I give the action name as just
"login" & in the <html:form I mention "login" it does
not find the action mapping. It gives me a error when
I submit to this form saying that there is no mapping
for action name "/login". Why does it convert "login"
to "/login" I have no idea about ... its being done
internally in the struts FormTag. To solve this
problem I changed the action name to "/login" in my
struts-config.xml & it worked but then the URL changed
to http://www.mysite.com/main/login
You would notice that I lost the country, language &
brand information. I need all these information in the
all the pages to cater for bookmarking, ie, when a
user bookmarks a page I should be able to recreate the
page with his preferences, which I can do only if I
have this information in the URL.
How can I solve this problem? As I'm a newbee I might
be ignoring something really obvious ... hope you guyz
can help me out with this on e...
Thanx in advance,
Vikram.
--- Ted Husted <hu...@apache.org> wrote:
> In furtherance of Oliver's response:
>
> cool dude wrote:
> > 1. Does struts provide any build-in mechanism
> for
> > session management? If not, then is there any
> > guideline as to how struts can be used to provide
> that
> > kindof support?
>
> For the most part, Struts relies on the Java Servlet
> container for that.
>
> The custom tags provided with the framework all
> provide automatic URL
> rewriting, so the container can maintain the session
> when cookies are
> not available.
>
>
> > 3. I'm also having problems with URL
> forwards. It
> > looks like in struts you have give URL forwards
> > starting with "/". What if I want to
> > forward to a URL that doesn't being with "/",
> i.e., a
> > relative URL. Say my site looks something like
> this
> > http://mysite.com/info1/info2/actionname and I
> would
> > want to carry this URL for all the actions, ie,
> only
> > the action name would change & the rest of the URL
> > remains the same. Maybe I'm missing soemthing out
> > here.
>
> Struts looks as these as String identifiers rather
> than a file tree, and
> does not resolve "relative" references in the way
> that you might expect.
>
> It's important to remember that while we assign URI
> to actoins that look
> like references to directories or files, these don't
> exist in fact. You
> are not really forwarding to a URL that resolves to
> a file, but to an
> identifier that Struts looks up in a table.
>
> While seems like it would be feasible for Struts to
> treat this table
> like it were file tree, that functionality is not
> provided.
>
>
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Java Web Development with Struts.
> -- Tel +1 585 737-3463.
> -- Web http://www.husted.com/struts/
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Migrating from another framework to struts ...
Posted by Ted Husted <hu...@apache.org>.
In furtherance of Oliver's response:
cool dude wrote:
> 1. Does struts provide any build-in mechanism for
> session management? If not, then is there any
> guideline as to how struts can be used to provide that
> kindof support?
For the most part, Struts relies on the Java Servlet container for that.
The custom tags provided with the framework all provide automatic URL
rewriting, so the container can maintain the session when cookies are
not available.
> 3. I'm also having problems with URL forwards. It
> looks like in struts you have give URL forwards
> starting with "/". What if I want to
> forward to a URL that doesn't being with "/", i.e., a
> relative URL. Say my site looks something like this
> http://mysite.com/info1/info2/actionname and I would
> want to carry this URL for all the actions, ie, only
> the action name would change & the rest of the URL
> remains the same. Maybe I'm missing soemthing out
> here.
Struts looks as these as String identifiers rather than a file tree, and
does not resolve "relative" references in the way that you might expect.
It's important to remember that while we assign URI to actoins that look
like references to directories or files, these don't exist in fact. You
are not really forwarding to a URL that resolves to a file, but to an
identifier that Struts looks up in a table.
While seems like it would be feasible for Struts to treat this table
like it were file tree, that functionality is not provided.
-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Java Web Development with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
AW: Migrating from another framework to struts ...
Posted by Oliver Refle <o....@gmx.de>.
1. For one, what do you mean autmatic session management,
you can put form beans into the session and work with them.
So if you mean that with session support it supports it
2. You need getter and setter in your UserInfo form for
the aggregated forms.
Than struts can call them with the following entry
<html:text property="address.street"/>
Struts will call first the getter getAddress()
and then getStreet()
3. Only solution i found here was to return null in the action
and before that redirect the resonse, this should work.
e.g
repsonse.sendRedirect("test/side.jsp");
return null;
Oliver
-----Ursprungliche Nachricht-----
Von: cool dude [mailto:cool_dude_22_in@yahoo.com]
Gesendet: Donnerstag, 7. Februar 2002 11:58
An: struts-user@jakarta.apache.org
Betreff: Migrating from another framework to struts ...
Hi,
We are currently migrating from another framework
to struts. This has brought about a lot of queries &
doubts about how we can use struts to do things for us
that the earlier framework provided. My main concerns
are :
1. Does struts provide any build-in mechanism for
session management? If not, then is there any
guideline as to how struts can be used to provide that
kindof support?
2. How do I deal with form beans that have
aggregate objects in them. For example, I have a class
called UserInfo, which has the username
& the user address (which is another class called
AddressInfo) among other things. Now, if I have to use
UserInfo class to display/edit user information in a
form. How would I manage that?
3. I'm also having problems with URL forwards. It
looks like in struts you have give URL forwards
starting with "/". What if I want to
forward to a URL that doesn't being with "/", i.e., a
relative URL. Say my site looks something like this
http://mysite.com/info1/info2/actionname and I would
want to carry this URL for all the actions, ie, only
the action name would change & the rest of the URL
remains the same. Maybe I'm missing soemthing out
here.
These are few of the questions that I had. Since I'm
new to struts, these questions may be naive. Please
get back to me if you need further clarifications on
the questions.
Thanx in advance,
VD.
__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com
--
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>