I've got another suggestion:

You can set up an action mapping in your struts-config.xml as your
default action by adding the attribute unknown="true" to the action
element.  Using this, you create an action that parses the requested URL
and translates it to a page (could be as simple as changing *.do to
*.jsp, or could do some kind of lookup), puts the necessary data for
that page into the request, and forwards it along.  Make that action the
default for the application, and then you can use URLs like
http://mysite.com/index.do without having to configure a different
mapping for each page.

Caveat: I've never done this myself, so I may be missing something
important.

-- 
Tim Moore / Blackboard Inc. / Software Engineer
1899 L Street, NW / 5th Floor / Washington, DC 20036
Phone 202-463-4860 ext. 258 / Fax 202-463-4863


> -----Original Message-----
> From: James Ward [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, June 04, 2002 2:11 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Architecture Issue
> 
> 
> Ok, I must admit that I love Struts!  Who doesn't?  But I 
> have a design
> dilemma.   Let's suppose that I have a simple, almost static web site.
> Except that on the header of each page I read the url and I 
> am coming from and pull some info based on that url, from a 
> database...  Simple right?  Now wouldn't MVC suggest that any 
> request to my site that needs something from the model go 
> through a controller?  So if I put a controller in front of 
> all of my pages, I either get weird url's that don't play 
> nice with search engines (And aren't very pretty) like: 
http://mysite.com/Main.do?page=index.jsp
http://mysite.com/Main.do?page=AboutUs.jsp
Or I have to create struts actions for each page:
http://mysite.com/Index.do http://mysite.com/AboutUs.do

Neither of these seems ideal...  So I thought I would ask the experts.

What do you all think?  Is this a place where I can stray from MVC and
do something like: <% String url = request.getHeader("host"); url =
url.toLowerCase(); url = url.substring(0,url.indexOf("."));
MemberTO myMember = new MemberBean().getMember(url);
%>

Or, is there a much better way to do this?

Thanks for your help.

-James

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to