Online Hibernate Training just in Rs. 1000

One week online training in Hibernate ORM framework. Learn Hibernate Framework and enhance your skills. Best Online Hibernate training at 90% discount. Join Now!! Offer is valid Only for limited Period!!! Online Training Big Data and Hadoop Training Java Training  

I tried to create a dropdown list using is not working.can you find the errors in this code?



Share on Google+Share on Google+

rony rony
I tried to create a dropdown list using is not working.can you find the errors in this code?
0 Answer(s)      5 years and 6 months ago
Posted in : Struts

/jsp code for creating dropdownlist using struts2/

<p:form action="addemp" method="post">/*form created*/
<p:select name="designation" label="Enter Designation " list="design" /> /*dropdown list included*/
<p:submit name="submit"/>//submit

/java action class for adding form elements and accessing values/

import java.sql.PreparedStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.util.*;
import com.opensymphony.xwork2.ActionSupport;
import java.sql.SQLException;
import java.util.ArrayList;

public class EmpAdd extends ActionSupport {

public List<String> design;//list to be dropped
String designation;//the selected string to be taken

public List<String> getDesign() {//getter method of list
    return design;

public void setDesign(List<String> design) {/*setter method of list*/ = design;

public String getDesignation() {
    return designation;

public void setDesignation(String designation) {
    this.designation = designation;

public String execute() throws Exception{

            design = new ArrayList<String>();  //creating the list      
            design.add("es");//adding to the list
            return SUCCESS;

//struts.xml file for controlling

<package name="b" extends="struts-default">
<action name="addemp" class="b.EmpAdd" >
<result name="success">addemp.jsp</result>
View Answers

Related Tutorials/Questions & Answers: