Yes I have.
UrlFormController:
public class UrlFormController extends BaseFormController {
private UrlManager urlManager = null;
public void setUrlManager(UrlManager urlManager) {
this.urlManager = urlManager;
}
public UrlFormController() {
setCommandClass(Url.class);
setCommandName("url");
}
protected Object formBackingObject(HttpServletRequest request)
throws Exception {
String id = request.getParameter("id");
if (!StringUtils.isBlank(id)) {
return urlManager.get(new Long(id));
}
return new Url();
}
public ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object
command,
BindException errors)
throws Exception {
log.debug("entering 'onSubmit' method...");
Url url = (Url) command;
boolean isNew = (url.getId() == null);
String success = getSuccessView();
Locale locale = request.getLocale();
if (request.getParameter("delete") != null) {
urlManager.remove(url.getId());
saveMessage(request, getText("url.deleted", locale));
} else {
urlManager.save(url);
String key = (isNew) ? "url.added" : "url.updated";
saveMessage(request, getText(key, locale));
if (!isNew) {
success = "redirect:urlForm.html?id=" + url.getId();
}
}
return new ModelAndView(success);
}
}
Sanjiv Jivan wrote:
Have you set the commandName for
uk.co.arjit.travelbeen.webapp.controller.UrlFormController to "url"?
It seems like you're using a Spring bind tag in urls.jsp that expects
a command name of "url". Hard to tell with the details posted.
On 5/17/07, *Aled Rhys Jones* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Thanks for the reply. Still not sure what I'm doing wrong, as its
very
similar to the tutorial example.
urls.jsp (list of urls) contains e.g the following:
<display:column property="id" escapeXml="true" sortable="true"
url="/urlForm.html" paramId="id" paramProperty="id"
titleKey="url.id <http://url.id>"/>
I have a UrlFormController that is the same as the example
PersonFormController except it uses a Url model and UrlManager.
dispatch-servlet.xml contains the following:
<bean id="urlController"
class="uk.co.arjit.travelbeen.webapp.controller.UrlController ">
<property name="urlManager" ref="urlManager"/>
</bean>
<bean id="urlFormController"
class="uk.co.arjit.travelbeen.webapp.controller.UrlFormController ">
<property name="validator" ref="beanValidator"/>
<property name="successView" value="redirect:urls.html"/>
<property name="urlManager" ref="urlManager"/>
</bean>
<bean id="companyController"
class="uk.co.arjit.travelbeen.webapp.controller.CompanyController">
<property name="companyManager" ref="companyManager"/>
</bean>
<bean id="companyFormController"
class="uk.co.arjit.travelbeen.webapp.controller.CompanyFormController">
<property name="validator" ref="beanValidator"/>
<property name="successView" value="redirect:companies.html"/>
<property name="companyManager" ref="companyManager"/>
</bean>
As mentioned earlier, company just has generic crud whilst url has an
extra method so requires its own dao and service classes.
All unit tests succeed.
Other web pages are companies.jsp, companyForm.jsp and urlForm.jsp .
Cheers
Aled
Matt Raible wrote:
> The first error is likely because you're navigating to the JSP
> directly, rather than going through a SimpleFormController. As
for the
> 2nd issue, what is your Controller named? The
> ControllerClassNameHandlerMapping determines how URLs are
created for
> controllers:
>
> http://tinyurl.com/3ce2zn
>
> Matt
>
> On 5/16/07, Aled Rhys Jones < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
>> Hi everyone
>>
>> I've started developing with appfuse and so far its been
great. I've
>> created two services, url and company, and all the tests pass
including
>> the webb ones.
>> I think there's a problem with my jsp's however, as when I
click on a
>> url in my url list page (urls.jsp) to go to the urlForm.jsp
page, I get
>> the following error:
>> [myapp] ERROR [btpool0-8] HiddenInputTag.doStartTag(84) | Neither
>> BindingRe
>> sult nor plain target object for bean name 'url' available as
request
>> attribute
>> java.lang.IllegalStateException: Neither BindingResult nor
plain target
>> object f
>> or bean name 'url' available as request attribute
>>
>> My companies page (list of companies) doesn't load either. I
get the
>> error:
>> [myapp] WARN [btpool0-9] PageNotFound.noHandlerFound(1003) | No
>> mapping for
>> [/companies.html] in DispatcherServlet with name 'dispatcher'
>>
>> Any ideas?
>>
>> Cheers
>> Aled
>>
>>
>>
---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
>> For additional commands, e-mail:
[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.467 / Virus Database: 269.7.5/812 - Release Date: 19/05/2007 13:52
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]