Win a copy of Terraform in Action this week in the Cloud forum!

Nuri Jain

Greenhorn
+ Follow
since Jan 22, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nuri Jain

Hello sir,

I am using springMVC , I have command object as pojo class with string parameters and one stirng[] parameter. I am getting list of object from controller and i am able to display list of object in my jsp page in table formate.user checked checkbox for some rows of table to perform some operation , if i am using string[] for <form:checkbox> its working fine ,but i want to assing whole object with checkbox ,so i kept one property as Arraylist<fault> in command object . But its giving dataBinding error.

I want to know that , how can populate Array of objects back to controller or command object from jsp page.is it possible ? or not ?

I need urgent help please help me.
thanks .

I am sending corresponding code here

1. my command object is Fault form


2. my jsp which is displaying fault list is as follow I am getting list of fault objects in "alarmPage.pageContents".
Hello

please let me know what is use of form action in spring ,cause without using this attribute i am able to submit form data into controller which i defined in servlet.xml file.

I have 2 button on my jsp I want to call 2 differentdiffernt controller on that button ,how can i do this ?
whenever i submit my page using submit in javascript it always calls predefined controller (which is defined in .xml file) but i want to call different controller .

please help me

Thanks
Nuri Jain
Thanks for your reply ,its working fine I am able to get simple jsp page without calling any controller.
but the next problem comes if I want to submit that jsp page .
Actually my concern was like , i want to generate a login page without calling any controller. once user fill username and password then i want to submit that page with userid and pwd value(as i did in struts)

If i use SimpleUrlHandlerMapping then it calls controller 2 time
1.befor formview generation
2.after jsp submit

Please let me know if there is any way in spring

Thanks in advance
Nuri
Hello,

As in struts we can display jsp page without going to action class ,for example in struts I have
url http://localhost:7001/testapplication/info.do
As I click on this url the request goes to struts-config.xml
where it found <action path="/info" forward="/information.jsp"/> then it display information.jsp in response,
but in spring for each request it goes through with controller then it controller returns corresponding view. I have some simple information jsp , how can i avoid controller part.how i can display jsp directly ?
Please help me , i need it urgently.

Thanks in advance
-nuri
Sorry for mistake ,

I changed my display name accroding to your policy.
Please help me to resolve my issues.
Thanks in advance.

-Nuri
Hello

I am entering userid and pwd through login page,i am able to generate success page with userid and pwd.this is working fine for me.

1)MY question is if i want to see the same login page with user id and pwd instead of new success page how can i get it ? If i am using same name for formView and successView its throwing error for bean cause i am using <form> for binding.
Actually on the same login form if userid and pwd is correct i want to show some more text field to fill by user.

2)If i want to submit my jsp page for different-2 action how can i do it in spring2.0.(As i worked in struts we can change action name using javascript and submit will consider current form action )

3)As in struts we can use <action name="" and path =""> to generate simple jsp page without form bean or action class ,can we do the same in spring?
can we call jsp page without using any controller MV.if yes then how ?

Please help me i have to urgent solve those issue for my project development.

Thanks in advance.

nuri[/I][/I]
Hello,
I am spring biggner and trying to hand on by reading material available on net.
As i read BeanNameUrlHandlerMapping , I tried it with one example ,but its not working.
As per my understanding the flow should be like
1.request travels in web.xml and see the DispatcherServlet
2.this front controller lead it to proper controller defined in <application>-servlet.xml file by the help of HandlerMappling.
in my case i am using BeanNameUrlHandlerMapping so it will fetch mapping string from request url and match it in <application>-servlet.xml> to fetch appropriate controller.In my case it is "CreateContactController.java"
3.As request goes to appropriate controller,controller checks the request ,call constructors and then display view page ,defined in formView tag.
4.commandClass tag is pogo class which is used to set all getter setter property defined in view form.
5.As user click on submit button , controller comes up and call the doSubmitAction() method to fetch the services from java class which is defined in commandService tag.
6.After completing step 5 ,if everything is succes then it calls success jsp defined in successView tag.


This is my understaing ,i am not sure wheter it is correct or not pls let me know am i correct ???
one more doubt , in my following code ,CreateContactController role how many time come existence ???only after submit action or before it too ???

Thanks in advance

<bean name="/CreateContact.htm" class="com.CreateContactController">
<property name="formView"><value>CreateContact</value></property>
<property name="successView"> <value>ContactCreated</value> </property>
<property name="commandClass"><value>test.Contact</value></property>
<property name="commandName"><value>MyCommandName</value></property>
<property name="contactService"><value>test.ContactService</value></property>
</bean>
Thanks for reply,I added doSubmitAction(Object command) method in my controller class but still the same problem i am not getting succesor page..its repetedly showling me only initial view page.As i observe its not reaching up to controller cause its not printing even Controller's construtor print statement.

I am giving here my complete controller class
Thanks in advance

1.public class CreateContactController extends SimpleFormController{

private ContactService contactService;

public void setContactService(ContactService contactService) {
this.contactService = contactService;
}
public CreateContactController() {
System.out.println("this is CreateContactController CreateContactController()");
setCommandClass(Contact.class);
}
//public ModelAndView onSubmit(Object command) throws ServletException {
// System.out.println("done");
//Contact contact=(Contact) command;
// ContactService.createContact(contact);
//return new ModelAndView(new RedirectView(getSuccessView()));
// }

public void doSubmitAction(Object command){
System.out.println("this is CreateContactController doSubmitAction");
Contact contact = (Contact)command;
ContactService.createContact(contact);
}
}
13 years ago
I am bignner and I am trying to write simple spring example which takes name and surname input from jsp file and call the controller .
Its initially showing jsp page proper but after click on submit button i am not getting success page, as i dig out the code i come to know its not calling controller properly.
Please let me know where is the problem exactly.
1.<bean id="beanNameUrlMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
<property name="order"><value>0</value></property>
</bean>

2.
<bean name="/CreateContact.htm" class="com.CreateContactController">
<property name="formView"><value>CreateContact</value></property>
<property name="successView"> <value>ContactCreated</value> </property>
<property name="commandClass"><value>test.Contact</value></property>
<property name="commandName"><value>MyCommandName</value></property>
<property name="contactService"><ref local="contactService"/></property>
</bean>

4.public class CreateContactController extends SimpleFormController{

private ContactService contactService;

public void setContactService(ContactService contactService) {
this.contactService = contactService;
}
public CreateContactController() {
System.out.println("this is CreateContactController CreateContactController()");
setCommandClass(Contact.class);
}
public ModelAndView onSubmit(Object command) throws ServletException {
System.out.println("done");
Contact contact=(Contact) command;
ContactService.createContact(contact);
return new ModelAndView(new RedirectView(getSuccessView()));
}
13 years ago