how to pass string array from action class to jsp page? pls reply me.

Ads
 

how to pass string array from action class to jsp page? pls reply me.

how to pass string array from action class to jsp page? pls reply me.

View Answers

September 10, 2012 at 5:24 PM

You can use session.setAttribute() and session.getAttribute() methods. In your action class,

String[] arr = {"A","B","C","D"};
for (int x = 0; x < arr .length; x++) {
out.println(arr[x]);
}
session.setAttribute("names", arr);

And through your jsp page, get array values.

<%
try {

String[] str = (String[]) session.getAttribute("names");

for (int x = 0; x < str.length; x++) {
out.println(str[x]);
}

} catch (Exception e) {
out.println(e);
}
%>

September 10, 2012 at 5:35 PM

but, we can not use java code in jsp. with out using java code in jsp, is it possible?

Ads









Related Tutorials/Questions & Answers:
how to pass string array from action class to jsp page? pls reply me.
How to pass Array of string from action class to jsp page
Advertisements
How can i pass the valus from a JSP to the action class???
how to pass a string from one class to another
how to pass an array from one jsp to another jsp - JSP-Servlet
Pass value of rasio button from jsp page to action class(not conventional problem)
How to pass an arraylist from servlet to jsp?
how to pass variable from simple java main class(not servlet) to the jsp page?
How to pass multiple values from a servlet to JSP?
How to pass parametes from JSP page to HTML page? - JSP-Servlet
How to pass the value from controller to jsp page ?
How to pass variable from one class to another in java
How to validate a form in action class and forward errors to the jsp in struts?
Pls provide me jsp code to get values in drop down list from another table's field....
how to display output on jsp from while loop of action class....actually i am retreiving the post from posts column from my sql.plz help.thnkss
how can we pass parameters from jsp href to another servlet
how to pass input from radio button to jsp page
How to close a frame on action event of a button from a different class ?
RADIO FROM JSP TO ACTION.
how to pass input from radio button to jsp page
how to pass input from radio button to jsp page
how to pass form values from javascript of html page to jsp page
how to pass the mutiple values from <Ui:datagrid hyperlink - JSP-Servlet
Pass parameters from JSP to Servlet
how to pass the mutiple values from <Ui:datagrid hyperlink - JSP-Servlet
how to pass arraylist data from one jsp to another jsp - JSP-Servlet
how to pass class variable to another class
how to store the data in a array retrived from the database - JSP-Servlet
Plz Plz reply Me - JSP-Servlet
how to forward select query result to jsp page using struts action class
How to retrieve array values from html form to jsp?

Ads