Struts 2

2009-08-28 Thread Sonu S
Hi,

i am using struts 2. i want to check some condition in my jsp and based on
result i want to perform some task.

i have written


//DO something


// Do Something else


for this i have created one hidden field also in JSP named status and have
getter and setter method in Action class.

but things are not working as expected. Even if status is Y it always
execute ELSE part. please let me what i am doing wrong.

thanks


[S2] how to use multiple resource files in struts2

2009-05-06 Thread Sonu S
Hi,

I am trying to use two or more resource files in struts2, like this

struts.custom.i18n.resources=Resources1
struts.custom.i18n.resources=Resources2

but it is not working (in JSP pages only values from Resource2 are being
displayed and for keys are being displayed from resource1)

please tell me how to use multiple resource files in struts2

Thanks


ArrayList in tag

2009-01-12 Thread Sonu S
Hi all,

I am using Struts 1.2. I have one ArrayList and one HashMap in my form bean.
Name of these collection are myList and myMap. Form bean name is myForm and
scope is request.

I would like to know how to display values from arraylist and hashmap to
 tag for creating drop down list.

Thank you for your help


Struts list

2008-06-25 Thread Sonu S
 HI,

I have to show list in my jsp page. I am using 

i am getting two lists from data base and it is in employee form bean: first
list is for employee no and second list is for name. i want to display
employee name in  and want to use employee no as VALUE in 
so list would have employee no as value and name will be displayed to user.

i am not sure how to do it with two lists as i have two different lists, one
list for emp no and one list for employee name. My form bean name is
employeeForm and list names are employeeNoList and employeeNameList. Please
help me... some code example would be a help for me. I am using struts 1.1

Thank you


struts- validation messages

2008-03-29 Thread Sonu S
Hi,

I am using struts in my application. to validate users entry in jsp i have
my validation method. and i am calling that method in action class. code is
below:(I am not using struts' validations )

//  in action class, calling validate method
ActionErrors errors = myForm.validate(mapping,request);


//In form bean
public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
ActionErrors errors = new ActionErrors();
if(("".equals(name.trim({
errors.add(name, new ActionError("myForm.Name"));
}
if(("".equals(address.trim({
errors.add(address, new ActionError("myForm.address"));
}
return errors;
}



// in action class checking is errors are empty
if (!errors.isEmpty()) {
saveErrors(request, errors);
return mapping.findForward("ADD");
}


above code is working fine. Only problem is it is printing error messages in
jsp in one line.

example: Enter Name. Enter Address.


I would like to show every error message on new line in jsp. is it possible.


in jsp i am using  to print message.


thank you for your time and solutions


html:radio in struts

2008-03-19 Thread Sonu S
 Hi,

I have something like this in JSP :

MALE
FEMALE

1) i want to know how to make "Male" to be default selected when page is
loaded
2) I would set the value in form bean and on second page i would display
radio buttons to change the value. i would like to know how to make one
radio button selected as per the value set in form bean. I have already set
value in form bean... i have printed on console.. it is showing value but
not selecting in second page.

thank you
Sonu


struts 1.2 html:select and submit button

2008-03-17 Thread Sonu S
 HI,

I am using struts 1.2 in my web application. I have to display one
  list

list will be build dynamically. User can select any option. base on the
user's selection page will be refreshed (need to hit the database and
display information in other fields on same page.) I need to know two
things:

1) there is one submit button on that page and one action is associated with
that submit button. i can call the associated action class once the user
finish the form and click the submit button. When user select from list i
need to call another action class.

I want to know how to call another action class, (when user select something
from list), as list control is inside the same html:form tag.

2) When user selects some value from list i need to refresh the page and
populate the other fields.

I would like to know, Lets say there are ten values and user has selected
third option, how to keep selected that third option as page is already
refreshed?

I am beginner in struts.. any sample code would be a great help for me

Thank you for time and help.

sonu


reset() method

2006-09-01 Thread Sonu S

Hi,

I am using struts in my application. i am using reset and validation. i am
not writing any validation method. i am using struts' validation framework.
validation is working. reset also works fine in application if i enter some
values in form  (text box) and press reset, it clears form values.

but if i follow these steps, reset does not work

1) enter some values in form
2) click submit button
3) validation fails
4)  return to form
5) values are still in text box
6) here if i press reset button it does not reset the form values.  it calls
reset method ( i have checked reset method is being called) but it does not
reset the text box,

i want to reset the form every time reset button is clicked.


thank u


email valodation

2006-08-27 Thread Sonu S

hi all,


i am using struts' validation.

i want to validate fields for required, mask and email. required and mask
validation works fine but email validation is not working.it gives error
like


validateEmail method not found..

i have given

























pls tell me how to do the email validation

thank you

with regards


error in mapping

2006-08-25 Thread Sonu S

hi 2 all,

I am using dynaValidatiorForm in my application. i am getting some error
related to mapping. i checked my code everything seems to be ok. My code is.


in struts config:


 
  
  
  
  
  
  
 






  
  


in JSP i am giving



 
 




in web browser i am getting

400 Invalid path was requested

and on console i am getting someting like

RequestProces E org.apache.struts.action.RequestProcessor  Invalid path  was
requested.


i hope i will get solution in group


with regards
sonu


accssing object in JSP

2006-06-14 Thread Sonu S

Hi 2 all

I am using struts in my application. In my application i am getting array of
objects of MyClass. This Class has methods like getName(), getId(),. I
am getting this array of object in Action class. I want to use these array
in JSP.

For this i am doing in Action Class i am doing.

MyClass[] arrObj = SomeClass.getArrayObjects();

and creating JavaBean object like

MyBean myBean = (MyBean) form // Action Form

and setting values for Bean..

myBean.setMyObj(arrObj);

In MyBean i have written

MyClass[] myObj; (written getter and setter methods)

I want to access this array of objects in jspwhat should i do so i could
write in jsp like

arrBoj.getName() or arrObject.getId()...



I can not store bean in request or session or any scope (design issues...)


Please help me..give me some advice.




Thanks for ur time and consideration...

With regards


Accessing List in JSP

2006-05-11 Thread Sonu S

Hi 2 all


I am using Struts 1.2

in my action class i am writing

List testList = new ArrayList();

testList.add("str 1");
testList.add("str 2");
testList.add("str 3");

MyForm myForm = (MyForm) form;
myForm.setMyList(testList);

In Action Form i have done
public class myForm extends ActionForm{
   List myList;

   public List getMyList() {
 return MyList;
   }
   public void setMyList(List MyList) {
 this.MyList = MyList;
   }

I want to access this List in JSP.

I am trying  butit is not working. I am trying




Could u please tell me how to access List in JSP page


Thank you
With regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]