reset password
Author Message
p0941
Posts: 95
Posted 14:51 May 14, 2010 |

Hi Dr. Sun,


1) How can I pass a string with new ModelAndView( "wiki/somJSPPage" ).addObject() ?

   Or should I use  new ModelAndView( "wiki/someJSPPage?stringname" ) ?

2) It seems the <fmt  tag doesn't formate the  Calendar instance right, is there a way to work around?


Thank you very much.

trivedidr
Posts: 54
Posted 15:22 May 14, 2010 |

hi, reply for 1) only......

the syntex for redirect with passing some value is  

return new ModelAndView( "redirect:viewTopic.html?topicId="

                + topic.getId() );
in this case we pass id of topic.
 
 
 
and just go to next page with value :
 
 
return new ModelAndView( "mailinglist/viewSearchResults" ).addObject(
                "mailinglist", mailinglist ).addObject( "messages", messages )
                .addObject( "resultSize", messages.size() );
 
 

in this case we pass object

cysun
Posts: 2935
Posted 21:36 May 14, 2010 |
p0941 wrote:

Hi Dr. Sun,


1) How can I pass a string with new ModelAndView( "wiki/somJSPPage" ).addObject() ?

   Or should I use  new ModelAndView( "wiki/someJSPPage?stringname" ) ?

2) It seems the <fmt  tag doesn't formate the  Calendar instance right, is there a way to work around?


Thank you very much.

1. return new ModelAndView("viewName").addObject("stringName", string)

2. formatDate formats a Date object, not a Calendar object. Read the API of Calendar and see how you can get a Date from a Calendar.