Results 1 to 2 of 2
  1. #1
    aalhazm is offline Member
    Join Date
    May 2013
    Posts
    3
    Rep Power
    0

    Default Converting to jsp

    Can any one help me in converting this part to use jstl without scripting elements
    Java Code:
    private StringBuilder getFormHTML(String genre) {
    
    		StringBuilder sb = new StringBuilder();
    		String temp = "";
    
    		sb.append("<form action=\"Games\" method=\"post\"><label for=\"selectButton\">Browse Games:</label>");
    		sb.append("<select name=\"mySelect\">");
    
    		// All
    		sb.append("<option value=\"all\"");
    		temp = (genre.equalsIgnoreCase("all")) ? " selected=\"selected\">All</option>"
    				: ">All</option>";
    		sb.append(temp);
    
    		// Action
    		sb.append("<option value=\"action\"");
    		temp = (genre.equalsIgnoreCase("action")) ? " selected=\"selected\">Action</option>"
    				: ">Action</option>";
    		sb.append(temp);
    
    		// Adventure
    		sb.append("<option value=\"adventure\"");
    		temp = (genre.equalsIgnoreCase("adventure")) ? " selected=\"selected\">Adventure</option>"
    				: ">Adventure</option>";
    		sb.append(temp);
    
    		// RPG
    		sb.append("<option value=\"rpg\"");
    		temp = (genre.equalsIgnoreCase("rpg")) ? " selected=\"selected\">RPG</option>"
    				: ">RPG</option>";
    		sb.append(temp);
    
    		// Sports
    		sb.append("<option value=\"sports\"");
    		temp = (genre.equalsIgnoreCase("sports")) ? " selected=\"selected\">Sports</option>"
    				: ">Sports</option>";
    		sb.append(temp);
    
    		// Strategy
    		sb.append("<option value=\"strategy\"");
    		temp = (genre.equalsIgnoreCase("strategy")) ? " selected=\"selected\">Strategy</option>"
    				: ">Strategy</option>";
    		sb.append(temp);
    
    		sb.append("</select><button name=\"selectButton\">Select</button></form>");
    
    		return sb;
    	}
    Last edited by aalhazm; 05-10-2013 at 01:00 AM.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,002
    Rep Power
    20

    Default Re: Converting to jsp

    Well, you could at least give it a go and then post here if/when you hit a problem.
    From what you have up there it looks like there's only a series of 'if' statements.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 2
    Last Post: 12-08-2012, 04:32 AM
  2. Converting
    By PhQ in forum New To Java
    Replies: 3
    Last Post: 08-21-2011, 05:28 PM
  3. Help me Converting jar to jpg and jpg to jar
    By nap_patague in forum Advanced Java
    Replies: 0
    Last Post: 03-20-2011, 08:33 AM
  4. converting hex to dec -
    By Symbiot in forum New To Java
    Replies: 3
    Last Post: 05-27-2010, 01:56 PM
  5. Converting URL to URI
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-26-2007, 10:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •