Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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..
 
Abhra Kar
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
I will try and let you know
 
This parrot is no more. It has ceased to be. Now it's a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic