How do I immediately load another page in JSP/Spring?

I'm not very experienced in JSP. I have an application, which uses the Spring framework, that does a search. I show these results in a JSP page.

When the search returns just one item, I want to immediately jump to another page that shows information about that item.

Is this possible in JSP/Spring? I've seen tags like:

<c:redirect url="/somePage.html"/>

That's from another JSP file. What I want to do is (this is a naive bit of code)...

<c:when test="${cmd.totalResults = 1}">
    <c:redirect url="/loadItemInfo.html?id=someId"/>

Thanks in advance for your advice and help! You can omit anything regarding the parameters involved; I can figure those out. What I'm asking for is simply making this happen.

  1. Page loads.
  2. Page sees that there is only one result.
  3. Page goes to the page for that result, which is what happens anyway when the user clicks that search result. This saves a click.


You should check the number of items logic in your Spring controller not in the jsp file.

Inside your Spring controller you may have something like this:

 //Query items[0] info
 return new ModelAndView("itemInfo",model);
   return new ModelAndView("listOfItems",model);

Need Your Help

Moving From LINQpad to a Proper Visual Studio Project?

c# visual-studio linq oracle linqpad

I'm learning LINQ to SQL in LINQpad and it's been great, but there's a lot of magic happening under the hood that I don't quite understand. I am connecting to an Oracle database using the optional IQ

Customize UINavigationBar font

ios ios5

I'm trying to customize my UINavigationBar font, using the following code for iOS 5 in my app delegate's application:didFinishLaunchingWithOptions:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.