RSS Forums RSS
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 829 | Replies: 1 | Thread Tools  Display Modes
Join Date: Nov 2007
Posts: 25
Reputation: chicago1985 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
chicago1985 chicago1985 is offline Offline
Light Poster

Eliminate conditions in JSP

  #1  
Nov 15th, 2007
I have a Servlet that checks for information and if there is an issue it forwards the message to presentation page (JSP). Now I want to stop using conditions in scriptlets in the JSP. Please advise how I can do it in this situation in my Tomcat 4.1.27 container. I dont have JSTL or EL due to restrictions in my environment.

Servlet that forwards to JSP:

String gotopage = "";
if(mydata == 1)
{
     gotopage = /"pager.jsp?mymessage=err";
}
else if(mydata == 34
{
   gotopage = /"pager.jsp?mymessage=duper";
}
else
{
    gotopage = /"pager.jsp?mymessage=proc";
}


RequestDispatcher dispatcher = 
  getServletContext().getRequestDispatcher(gotopage);	
dispatcher.forward(request, response);
...
JSP

  1. <%
  2. String mymessage = request.getParameter("mymessage")
  3.  
  4. if(mymessage.equals("err"))
  5. {
  6. out.println("Error on the page");
  7. }
  8. else if(mymessage.equals("dup"))
  9. {
  10. out.println("Duplicate issue.");
  11. }
  12. else if(mymessage.equals("proc"))
  13. {
  14. out.println("Process message issue");
  15. }
  16. %>

Please advise.
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.



Similar Threads
Other Threads in the JSP Forum
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:55 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC