Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I would like to know how to create a menu bar in jsp, and are there any coding to be done in .java file, because i am new to jsp and i would be glad if someone can guide me through.....
Posted
Comments
Pandu Rang 17-Feb-15 9:39am    
Have you searched in google? And yes you can create static menu using jsp and javascript.

1 solution

XML
Create array with predefined values

String[] myArray = {"option1", "option2", "option3"};
Create getters and setters

public String[] getMyArray() {
    return myArray;
}
public void setMyArray(String[] myArray) {
    this.myArray = myArray;
}
Then create select dropdown and iterate through your array, you can use Struts2 tags like this

<select>
    <s:iterator value="myArray">
        <option value="<s:property/>"><s:property/></option> <!-- This prints out current value of the iterator -->
    </s:iterator>
</select>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900