The moose likes Struts and the fly likes Struts 1 :Using logic:present to load a JSP Page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 1 :Using logic:present to load a JSP Page" Watch "Struts 1 :Using logic:present to load a JSP Page" New topic

Struts 1 :Using logic:present to load a JSP Page

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234


Is it possible to load a JSP depending upon logic:present

I am doing a search functionality , once data is entered on TextField and search button is clicked on , i need to show the search details .
For this I developed a two jsps (Frameset Logic)

Once the search is successful , logic:present i want to load that JSP .
Is it possible to load a JSP in struts depending upon logic:present ??

Please let me know if there is any better Option avaialable for this ??

Thanks .

Save India From Corruption - Anna Hazare.
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 445

Hi Ravi,

You can always have your <logic:present> in the same page as the one that shows the search options? In this scenario when you are viewing the page for the first time when the search results are absent you can 'hide' the same using a <logic:present>. The next time when you get back to the same with the results the same will get displayed based on the presentation you enclose within the logic tags.

The choice is always dependant on the requirements. I do not see any restrictions from your question. If you want to use frameset/frame and/or multiple pages for displaying the search criteria/search results you are free to do so. If you want to use the same page for the same, you are welcome again! :-)

It is for you to decide. If you ask me I'd rather use the same jsp page for both i.e. the search criteria as well as the search results also showing the criterai the search is based on. Why use multipleof JSP's when you can seggregate common functionality, after all the whole application will be more maintainable too, right?

N.B.: Your choice ought to depend more on your requirements.

I agree. Here's the link:
subject: Struts 1 :Using logic:present to load a JSP Page
It's not a secret anymore!