|
|
Acegi and Spring 2.0 Form Taglib issue
I have exhausted my search prior to posting a new thread....
But, I have just integrated acegi into my application with very good success using the standard stuff within the contact filter example (minus method level interceptor stuff)
Well I before integrating all of my forms were working fine....Now the new 2.0 form tags are placing my quot;view jsp pagequot; to the action for the form action.
Like:
Code:
lt;form id=quot;nullquot; name=quot;nullquot; method=quot;postquot; action=quot;/efree/WEB-INF/jsp/AccountSearchForm.jspquot;gt;
I need all of the forms to post to a controller that isn't names *.jsp
I can't remember what the action was spitting out prior to integrating acegi....
Here is a snippet of my form code in the *.jsp files.
Code:
lt;form:form commandName=quot;commandquot;gt;
lt;form:errors path=quot;*quot; cssClass=quot;errorBoxquot; /gt;
lt;table border=quot;0quot;gt;
lt;trgt;
lt;td nowrap=quot;nowrapquot; width=quot;130quot;gt;lt;form:label path=quot;accountNamequot;gt;lt;fmt:message key=quot;accountSearch.accountNamequot; /gt;lt;/form:labelgt;lt;/tdgt;
lt;td width=quot;210quot;gt;lt;form:input disabled=quot;${tempEdit}quot; path=quot;accountNamequot;/gt;lt;/tdgt;
lt;tdgt;lt;form:errors path=quot;accountNamequot; cssClass=quot;fieldErrorquot; /gt;lt;/tdgt;
lt;/trgt;
Has anyone got any good advice.....Maybe it's a view level filter issue. I'm a bit new to acegi....so my learning curve is going up and down right now. LOL.
I can include some my configs if necessary.....
I am using the following for JSP resolving.
I'm also using Spring 2.0 RC1 as well.Code: lt;bean id=quot;viewResolverquot; class=quot;org..web.servlet.view.InternalResourceViewResolverquot;gt; lt;property name=quot;viewClassquot;gt;lt;valuegt;org..web.servlet.view.JstlViewlt;/valuegt;lt;/propertygt; lt;property name=quot;prefixquot;gt;lt;valuegt;/WEB-INF/jsp/lt;/valuegt;lt;/propertygt; lt;property name=quot;suffixquot;gt;lt;valuegt;.jsplt;/valuegt;lt;/propertygt; lt;/beangt;I think it may have something to do with the following class.
SavedRequestAwareWrapper which it looks likes it implements ServletRequest from the supers...
It looks like this is a wrapper class for each servlet request that comes in.....I'm thinking that maybe its not using the initial request which is a request to a controller.
ie.... initial request is: /servlet/home.do (server processes some db stuff) then the model is home.jsp stored under /WEB-INF/jsp/home.jsp
When the code from FormTag is recieved, it doesn't receive /servlet/home.do but gets /WEB-INF/jsp/home.jsp for the action...
Here is the code from the FormTag:Code:
private String resolveAction() throws JspException {
if (StringUtils.hasText(this.action)) {
return ObjectUtils.getDisplayString(evaluate(ACTION_ATTRIBUTE, this.action));
}
else {
String requestUri = getRequestContext().getRequestUri();
ServletResponse response = this.pageContext.getResponse();
if (response instanceof fromServletResponse) {
requestUri = ((fromServletResponse) response).encodeucl(requestUri);
}
if (StringUtils.hasText(requestUri)) {
return requestUri;
}
else {
throw new IllegalArgumentException(quot;Attribute 'action' is required. Attempted to resolve quot; +
quot;against current request URI but request URI was null.quot;);
}
}
}
If would think this line would return the: /servlet/home.do
String requestUri = getRequestContext().getRequestUri();
Without acegi, I think it did or maybe it was a blank action....thus forcing the browser to use the current ucl for posting.
Any thoughts.....I'm open for suggestings:
1) I was thinking of always placing the action in there....but this is may be extra unnecessary code.....when the initial ucl.
I'm also using SimpleFormController for all of our form submissions.
Any advice...alternatives....
If anyone has any thoughts that would be awesome....
Does anyone use the new form tags within spring? I'm having an issue with the form tags and the quot;actionquot; attribute AND with integrating Acegi into it.
What is everyones thoughts on the quot;actionquot; attribute. If I can't find a solution for the issue, I'll just hard code each action for every form.....
Are than any advantages to ALWAYS coding the action?
-like firewall / gateway / browser issues.
--I have seen articles that say that if no action is specified in a quot;formquot; tag then the browser will use the current ucl.
I guess, in a way, that would be a good reason to always add an action to every form no matter what.....thoughts...
Although, I don't want to hard code the servlet or webapp name into the action.
I'm always using controllers for posting data....
ie. account.do (sim form controller) -gt; View is accountForm.jsp
It still seems like an acegi issue because it wraps the request as a security wrapper....
I have already see this quot;bugquot;... I was working with AppFuse tha used acegi 0.8.3...
Now I use the latest AppFuse that works with acegi 1.0.1. And now everything seems to be OK!
Hope it will help you
clendestino......thanks so much for the reply.
I will try it out with the latest version of acegi....I'll find the 1.0.1 release...
you da man.....
Darn....I am using acegi 1.0.1.jar..... Thanks for the help...
I think I'll just code the darn action ucls.....
I may try and debug it further in the acegi source....You would think since the original request quot;wasquot; /servlet/account.do that at the point of the view layer, it would still have it.....but's still coming out /WEB-INF/jsp/accountForm.jsp as the action.....
Oh well, brain hurts with this one....I guess I'll just code all of the actions....
same problem here. i am using spring 2.0 and acegi 1.0.3.
i had to code the actions into the forms as a workaround.
does anyone have a hint |
|