Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

loading a jsp page

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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" %>
<%
out.println("</td></tr>");
out.println("<tr><td>");
}
else if((request.getParameter("sort")).equals("Newspaper") ){ %>
<%@ include file="display_news.jsp" %>
<%
out.println("</td></tr>");
out.println("<tr><td>");
} %>
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!
Kevin
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then you may want to consider the include ACTION instead (it's dynamic):
<jsp:include page="your_file_here.jsp" flush="true"/>
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>");
} %>
 
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

or else before checking for selection write Javascript to make default selection.
RGds
Manohar
 
We can walk to school together. And we can both read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic