What's the link that's created by the code below? If you manually type
that link into your browser, does it go to the correct controller?
Matt
On 6/6/07, Aled Rhys Jones <[EMAIL PROTECTED]> wrote:
I've been debugging my build, and noticed that when I click the link
that's supposed to take me to view a company details, companyForm.html
(the file is companyForm.jsp) it goes through the CompanyController
again as opposed to the CompanyFormController. Any ideas why it might
be doing this? Obviously if it uses the CompanyController then it will
be returning the wrong Model.
The link in company.jsp:
<display:column property="id" escapeXml="true" sortable="true"
url="/companyForm.html" paramId="id" paramProperty="id"
titleKey="companyForm.id"/>
Can anyone help?
Thanks in advance
Aled
Aled Rhys Jones wrote:
> Still stuck with this one, though thanks to Matt for pointing out how
> the ControllerClassNameHandlerMapping works, I had indeed named my jsp
> incorrectly.
>
> I'm getting an error when clicking from a model list page to a model
> detail page. So far I've made pages for Url and Company models. Both
> give the same error when I click to go from the list to the detail.
> As far as I'm aware I have followed the tutorials. I'm using M-04.
> For example, for company I have a page that displays a list of
> companies. When I click a company the url is e.g.
> http://localhost:8080/companyForm.html?id=1
>
> I get the following error:
> CompanyController.handleRequest(37) | entering 'handleRequest' method...
> [travelbeen] ERROR [btpool0-4] HiddenInputTag.doStartTag(84) | Neither
> BindingResult nor plain target object for bean name 'company'
> available as request attribute
> java.lang.IllegalStateException: Neither BindingResult nor plain
> target object for bean name 'company' available as request attribute
> at
> org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:137)
>
>
> Exactly the same happens when I try to go to the Url detail page, just
> swap 'company' for 'url'.
>
> Matt you noted that the cause might be that I'm navigating to the JSP
> directly, rather than going through a SimpleFormController. Could you
> elaborate on this?
>
> The jsp page I have for company.jsp is as follows:
>
> <%@ include file="/common/taglibs.jsp"%>
> <title><fmt:message key="companyList.title"/></title> <content
> tag="heading"><fmt:message key="companyList.heading"/></content>
> <meta name="menu" content="CompaniesMenu"/>
> <c:set var="buttons"> <input type="button" style="margin-right:
> 5px" onclick="location.href='<c:url
> value="/companyForm.html"/>'" value="<fmt:message
> key="button.add"/>"/>
> <input type="button" onclick="location.href='<c:url
> value="/mainMenu.html"/>'" value="<fmt:message
> key="button.done"/>"/> </c:set>
> <c:out value="${buttons}" escapeXml="false"/>
> <display:table name="companyList" cellspacing="0" cellpadding="0"
> requestURI="" id="companyList" pagesize="25" class="table"
> export="true">
> <display:column property="id" escapeXml="true" sortable="true"
> url="/companyForm.html" paramId="id" paramProperty="id"
> titleKey="companyForm.id"/> <display:column property="name"
> escapeXml="true" sortable="true"
> url="/companyForm.html" paramId="id" paramProperty="id"
> titleKey="companyForm.name"/>
> <display:column property="url" escapeXml="true" sortable="true"
> titleKey="companyForm.url"/>
>
> <display:setProperty name="paging.banner.item_name"
> value="company"/> <display:setProperty
> name="paging.banner.items_name" value="companies"/>
> <display:setProperty name="export.excel.filename" value="Company
> List.xls"/> <display:setProperty name="export.csv.filename"
> value="Company List.csv"/> <display:setProperty
> name="export.pdf.filename" value="Company List.pdf"/> </display:table>
> <c:out value="${buttons}" escapeXml="false"/>
> <script type="text/javascript">
> highlightTableRows("companyList"); </script>
>
> Any ideas?
>
> Thanks
> Aled
>
>
>
> Aled Rhys Jones wrote:
>> 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]
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
http://raibledesigns.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]