Note that there are some explanatory texts on larger screens.

plurals
  1. POin spring3 mvc how to display single value in different jsp pages
    primarykey
    data
    text
    <pre><code> Welcome.jsp page &lt;a href="addStudent"&gt;Click here for registration form&lt;/a&gt; student.jsp is the registration page &lt;s:form method="post" action="addStudent" commandName="student"&gt; &lt;s:label path="name"&gt;NAME:&lt;/s:label&gt; &lt;s:input path="name"/&gt;&lt;br&gt; &lt;font color="red"&gt;&lt;s:errors path="name"&gt;&lt;/s:errors&gt;&lt;/font&gt;&lt;br&gt; result.jsp &lt;table&gt; &lt;tr&gt; &lt;td&gt;&lt;font color="red"&gt;NAME:&lt;/font&gt;&lt;/td&gt; &lt;td&gt;&lt;font color="blue"&gt;${student.name}&lt;/font&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt; studentmoredetails.jsp &lt;s:form method="POST" action="studentadditionaldetails" commandName="studentMoreDetails"&gt; &lt;s:label path="fullname"&gt;FULLNAME:&lt;/s:label&gt; &lt;s:input path="fullname"/&gt; final result.jsp &lt;table&gt; &lt;tr&gt; &lt;td&gt;&lt;font color="red"&gt;NAME:&lt;/font&gt;&lt;/td&gt; &lt;td&gt;&lt;font color="blue"&gt;${name}&lt;/font&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;font color="red"&gt;FULLNAME:&lt;/font&gt;&lt;/td&gt; &lt;td&gt;&lt;font color="blue"&gt;${studentMoreDetails.fullname}&lt;/font&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt; I am having 2 controller class and two bean class RegistrationController.java @Controller @RequestMapping("addStudent") public class RegistrationController { Student studentobj=new Student(); @RequestMapping(method=RequestMethod.GET) public String toRegform(ModelMap model) { model.addAttribute("student", studentobj); return "student"; } @RequestMapping(method = RequestMethod.POST) public String addStudent(@Valid Student login, BindingResult result,ModelMap model) { if (result.hasErrors()) { return "student"; } login = (Student) model.get("student"); if ((login.getName()==null)) { return "student"; } // model.put("student", login); return "result"; } Student.java (bean class) private int age; @NotEmpty @Size(min=3,max=15) private String name; // getters and setters AdditionaldetailsController.java @Controller @RequestMapping("studentadditionaldetails") public class AdditionalDetailsConroller { @RequestMapping(method=RequestMethod.GET) public String additionalForl(ModelMap model1) { StudentMoreDetails additional=new StudentMoreDetails(); model1.addAttribute("studentMoreDetails", additional); return "studentmoredetails"; } @RequestMapping(method=RequestMethod.POST) public String additionalDetails(@Valid StudentMoreDetails login,BindingResult result,ModelMap model1) { if (result.hasErrors()) { return "studentmoredetails"; } login=(StudentMoreDetails) model1.get("studentMoreDetails"); if (login.getFullname()==null) { return "studentmoredetails"; } else { return "finalresult"; } } } StudentMoreDetails.java(bean class) private String fullname; //getters and setters web.xml file &lt;servlet&gt; &lt;servlet-name&gt;springdispatcher&lt;/servlet-name&gt; &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;springdispatcher&lt;/servlet-name&gt; &lt;url-pattern&gt;/&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; springdispatcher-servlet.xml file is &lt;mvc:annotation-driven/&gt; &lt;context:component-scan base-package="org.pratap.javashades.controllers"&gt;&lt;/context:component-scan&gt; &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;property name="prefix" value="/WEB-INF/JSP/"&gt;&lt;/property&gt; &lt;property name="suffix" value=".jsp"&gt;&lt;/property&gt; &lt;/bean&gt; &lt;bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"&gt; &lt;property name="basename" value="/WEB-INF/messages" /&gt; &lt;/bean&gt; &lt;/beans&gt; i am displaying both name and fullname values in the finalresult.jsp, but only fullname value i am getting, name value is empty in finalresult.jsp. please help me how can i display both the values in finalresult.jsp page. Please tell me how to achieve sesion for above?? </code></pre> <p>i am displaying both name and fullname values in the finalresult.jsp, but only fullname value i am getting, name value is empty in finalresult.jsp. please help me how can i display both the values in finalresult.jsp page. Please tell me how to achieve sesion for above?? Thanks in advance Hope somebody will guide me soon</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload