Hi Brian,
There seems to be a small glitch with url mapping in the crud-example
(rev151). It's okay for the standard use-cases but break-downs if I do
something untoward.
Interestingly, the behaviour differs between Firefox and IE6.
Here's the test-case. The URL is what's displayed on the browser.
1. Start the app:
URL: http://localhost:8080/
Shows the index with title Company | Index
2. Click on Add an Company:
URL: http://localhost:8080/add
shows add form with title Company | Add
3. Enter name as "Test Company" and click save
URL: http://localhost:8080/index
shows index with title Company | Index. The list now includes Test
Company.
4. Click on the "Test Company" link
URL: http://localhost:8080/edit?id=0
shows the edit form with title Company | Edit
6. Enter a blank company name and click save
In Firefox:
URL: http://localhost:8080/update
Shows the INDEX page with title Error. The Index is actually
contained within the iframe of 404.jsp
In IE6:
URL: http://localhost:8080/update
Shows the default IE6 404 not found page
7. Continuing on in Firefox, click on the "Test Company" link again
URL: http://localhost:8080/update
Shows the correct edit page within the error iframe
Inspecting the HTTP requests:
update returns a 404 with an iframe referencing "/missing"
the get of /missing returns a 302 containing the index page
subsequent requests are successfully performed within the /missing
namespace
ie.
http://localhost:8080//missing/edit?id=0
Note the double / as well.
Note that Crud-validation.xml uses a RequiredStringValidator but not a
StringLengthvalidator so I think it passes edit. I'm not sure why
update fails though.
As per my prior emails, http://localhost:8080/an/arbitary/url/index also
executes the index action.
Looking at the savant config, my test environment does differ from yours
in that I'm using Struts core 2.0.9 rather than 2.0.6. I'm testing with
Tomcat 5.5.23 from an exploded directory via IntelliJ.
Let me know if there's anything you'd like me to investigate further if
you're unable to reproduce this.
regards,
Jeromy Evans
Brian Pontarelli wrote:
Okay. The example is in the SmartURLs repository:
http://smarturls-s2.googlecode.com/svn/trunk/apps/crud-example/
It works pretty well. A few things I think could help reduce the
overall code bloat:
1. Support public fields instead of just getters/setters on actions.
I've never actually done anything interesting in my action property
accessors, so removing them in all my cases would be fine.
2. Fix the empty action requirements (the add action is empty for most
of my apps)
3. If we add the redirect to index convention, 2 annotations will be
removed
4. I could collapse add/save and edit/update using a post check like
this:
if (ServletActionContext.getRequest().getMethod().equals("GET")) {
}
or I could write a variation on Action that is more knowledgable about
GETs and POSTs and invokes two different methods depending on the method.
Everything (comments, thoughts, mods, etc) is welcome!
-bp
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]