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
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 the value from controller to jsp page ?
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
Pls provide me jsp code to get values in drop down list from another table's field....
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 close a frame on action event of a button from a different class ?
How to retrieve array values from html form to jsp?
Pass a dom object from jsp to servlet
Reply me soon.........
How to pass javascript variable in Scriplet of JSP?
[JSP] How to pass back ID to previous page.
Struts2.2.1 Action Tag Example
how to pass values from 2nd page tp 3rd page....
how can i get output pls urget tell me
pls help me it urgent
pls help me it urgent
pls help me it urgent
pls send reply - Java Beginners
Pls help me with strings
Pls help me with strings
how to convert string to char array in Java
how to use string of one class into another Class

Ads