aspose file tools
The moose likes Spring and the fly likes Can I add two controller classes in one dispatcher-servlet.xml? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Reply Bookmark "Can I add two controller classes in one dispatcher-servlet.xml?" Watch "Can I add two controller classes in one dispatcher-servlet.xml?" New topic
Author

Can I add two controller classes in one dispatcher-servlet.xml?

Abhra Kar
Ranch Hand

Joined: May 22, 2008
Posts: 112
I have one redirect.jsp(just under my application named myproj3),where sendRedirect(“welcome.htm”) is mentioned and in dispatcher-servlet.xml it is methioned---
<bean name="/welcome.htm" class="control.GetValueController" >
<property name="formView" value="index" />
<property name="validator"> <ref bean="userValidator"/></property>
</bean>


In GetValueController(it extends SimpleFormController) it is written that -----
onSubmit(HttpServletRequest request,
HttpServletResponse response, Object command, BindException errors)
throws Exception {
User user = (User)command;

return new ModelAndView("result","abc",user);
}


so result.jsp will called and I have printed the field values come from index.jsp.

No I want in result.jsp I will add –
<form:form method="POST" commandName="user1">
<form:input path="credential" />

<form:password path="password"/>
</form:form>


User1 represent User1.class which is mentioned in dispatcher-servlet.xml.
But how can I call another controller or call the previous one by which I can print “credential” and “password” field in some other field like “result1.jsp”.

How I will do that ?

Thanks in advance
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 503

Abhra Kar wrote:
But how can I call another controller or call the previous one by which I can print “credential” and “password” field in some other field like “result1.jsp”.

How I will do that ?

Thanks in advance

I didn't understand the question completely, But assuming that you need to print the credential, like say 'welcome user' in some jsp. HttpSession is the way. You store the information required by whole application in a session variable and access it in the JSP's..


Regards, Prasad
SCJP 5 (93%)
Abhra Kar
Ranch Hand

Joined: May 22, 2008
Posts: 112
Thanks
I will try and let you know
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Can I add two controller classes in one dispatcher-servlet.xml?
 
Similar Threads
get parameter from Form page in validator
Problem in using javascript in spring web mvc system:
<form:hidden path="lastName" value="${param.lname}" /> is it valid ?
Getting error----NoContextLoaderListener registered
Javascript new window is not opening from a jsp page