Meaningless Drivel is fun!
The moose likes Servlets and the fly likes loading a jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "loading a jsp page" Watch "loading a jsp page" New topic

loading a jsp page

kevin schmidt
Ranch Hand

Joined: Aug 24, 2001
Posts: 85
I have a jsp page that some of the contents are loaded depending on what is chosen from a drop box. But when you load the page initially, nothing appears because nothing has been selected from the box. I want to set one of the options as a default so when the page is initially loaded, the one certain view always appears first. Right now I have an if else statement:
if((request.getParameter("sort")).equals("Date")) {%>
<%@ include file="display_sort.jsp" %>
else if((request.getParameter("sort")).equals("Newspaper") ){ %>
<%@ include file="display_news.jsp" %>
} %>
Now, I want display_news.jsp to be the default when the page is loaded, just not sure how to do that. Thanks for peoples patience!
Tony Alicea

Joined: Jan 30, 2000
Posts: 3226
Then you may want to consider the include ACTION instead (it's dynamic):
<jsp:include page="your_file_here.jsp" flush="true"/>

Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Manjunath Reddy
Ranch Hand

Joined: Jul 26, 2001
Posts: 60
continuing ur logic...use else condition to display the news list for all other cases
else { %>
<%@ include file="display_news.jsp" %>
out.println(" </td></tr>");
out.println(" <tr><td>");
} %>
Manohar Karamballi
Ranch Hand

Joined: Jul 17, 2001
Posts: 227

or else before checking for selection write Javascript to make default selection.
I agree. Here's the link:
subject: loading a jsp page
It's not a secret anymore!