struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jennie Moeller" <Jennie.Moel...@bbc.co.uk>
Subject RE: how do i get the ActionClass's Vector to my JSP page for display
Date Fri, 07 Sep 2007 08:54:57 GMT
Hi,

Since you've put it on your form you can pull it off your form. So in
your jsp you can do something like:


This will look through all your items in the vector...its like a for
loop (assuming you are using jstl tags)
<c:foreach var="I" items="${form.lable_temp}"> 

Or in your case perhaps you just want to toString it in which case:

<c:out value="${form.lable_temp}"/>

(why not use a List<String> instead? Less overhead) and also underscores
in variable names are not java standard (although perhaps those are the
standards at your company so ignore me!).

If you aren't using jstl you could use bean:write or various other
methods to write out the variables

Jennie
-----Original Message-----
From: msg2ajay [mailto:msg2ajay@gmail.com] 
Sent: 07 September 2007 03:50
To: user@struts.apache.org
Subject: how do i get the ActionClass's Vector to my JSP page for
display


hi,
    I am trying to get a ActionClass's vector object my forntEnd(jsp). I
have tried to set to my form bean and get the values to my jsp. But it
is showing error as .

[code]
[javac]
/usr/java/SUNWappserver/domains/domain2/generated/jsp/j2ee-modules/ILICT
reasury/org/apache/jsp/banker_002dweb/jsp/XS/X32Iframe_jsp.java:212:
incompatible types
    [javac] found   : java.lang.String
    [javac] required: java.util.Vector
    [javac]     labels_demo = request.getParameter("Lable_temp");
                                                                   ^ 

my actionClass is:   (HERE MY VECTOR WILL BE POPULATED WITH SOME STRING
VALUES)
------------------
Vector<String> lableGenVect = new Vector<String>();
lableGenVect = (Vector<String>) xParser.xmlLableGen (Comm_vect);     //
i am
using jdk1.5
form.setLable_temp (lableGenVect);

my FormBean is:
----------------
 public Vector<String> getLable_temp(){
        return lable_temp;
    }
    public void setLable_temp(Vector<String> lables){
        this.lable_temp = lables;
    }

my jsp page is:
---------------

   Vector<String> lables_demo = new Vector<String>();
    lables_demo = request.getParameter("lable_temp");
    out.println("LABELS :"+lables_demo); [/code]

Is the approach is wrong or is there any other way to access Vector
values to my jsp.
thx in adv.
Ajay.

--
View this message in context:
http://www.nabble.com/how-do-i-get-the-ActionClass%27s-Vector-to-my-JSP-
page-for-display-tf4395762.html#a12535038
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system. 
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received. 
Further communication will signify your consent to this.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message