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.

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?









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 an array from one jsp to another jsp - JSP-Servlet
how to pass a string from one class to another
Pass value of rasio button from jsp page to action class(not conventional problem)
how to pass variable from simple java main class(not servlet) to the jsp page?
How to pass an arraylist from servlet to jsp?
How to pass parametes from JSP page to HTML page? - JSP-Servlet
How to pass multiple values from a servlet to JSP?
Pls provide me jsp code to get values in drop down list from another table's field....
How to pass the value from controller to jsp page ?
How to validate a form in action class and forward errors to the jsp in struts?
How to pass variable from one class to another in java
RADIO FROM JSP TO ACTION.
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 to pass input from radio button to jsp page
how can we pass parameters from jsp href to another servlet
how to pass form values from javascript of html page to jsp page
how to pass input from radio button to jsp page
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 ?
Pass parameters from JSP to Servlet
how to pass arraylist data from one jsp to another jsp - JSP-Servlet
how to pass the mutiple values from <Ui:datagrid hyperlink - JSP-Servlet
Plz Plz reply Me - JSP-Servlet
how to pass the mutiple values from <Ui:datagrid hyperlink - JSP-Servlet
Pass a dom object from jsp to servlet
how to store the data in a array retrived from the database - JSP-Servlet
JSP to output Java String Array - JSP-Servlet
Get values from JSP pages - JSP-Servlet
how to forward select query result to jsp page using struts action class
how to pass class variable to another class
How to retrieve array values from html form to jsp?
Reply Me - Java Beginners
create a string from an array using JavaScript
Convert String to Class - JSP-Servlet
Reply Me - Java Beginners
How to pass value from dijit.Tree to dijit.MenuItem - Ajax
Struts2.2.1 Action Tag Example
Understanding Struts Action Class
Reply me - Java Beginners
String Class in Action Script3
Pls help me with strings
Pls help me with strings
Plz reply me sir Its urgent - JSP-Servlet
pls help me it urgent
pls help me it urgent
pls help me it urgent
how to retrive data grom database in jsp pages.

Ads