File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts with Ajax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts with Ajax" Watch "Struts with Ajax" New topic
Author

Struts with Ajax

vishal Mestri
Greenhorn

Joined: Sep 05, 2012
Posts: 14
Hi All,

I am using struts 1.2.7 version.
Further I am also using JQUERY for ajax calls.
I am calling struts action classes from jquery ajax calls.
code is shown below:


Further I have also implemented GetPGPaymentModes action class.
On success it is forwarding request to jsp



code for pgPaymentModes.jsp is shown below:-



It is giving below mentioned error....



action class




I want to know whether can we use <html:select> and other tags in AJAX output ......
jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 296

Hi Vishal,

Cannot find bean under name org.apache.struts.taglib.html.BEAN
means struts cant find the taglibrary .first check whether you have added the right jar file or not and if you have added jar file then check for the correct version.
Regards
Jatan
vishal Mestri
Greenhorn

Joined: Sep 05, 2012
Posts: 14
Hi Jatan bhavsar,

Really appreciate quick feedback...

But I am using normal form submit action (without ajax) , they are working fine.

Further if I don't use <html:input> in response jsp. i.e. if I use plain <input type="text" .... > , then it works fine.

But when I put <html:input ..> tags in response jsp of AJAX, then only I am facing this issue.

I have copied all jars from "struts 1.2.7" package lib folder , in my web applications LIB folder.

Please let me know if any more information is help ful.

First , I would like to confirm whether does Struts/Ajax allows use of html tags , in response jsp.


Thanks and Regards,
Vishal
jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 296

Hi Vishal,

Can you please post form and PgTransactionBean with remain code so i can try to find problem in my local environment.

Regards
Jatan
vishal Mestri
Greenhorn

Joined: Sep 05, 2012
Posts: 14
hi jatan,

Thanks ...for keeping attention on my post...

It would not be possible for me to share code for PgTransactionBean .

But I guess....you can write dummy methods there..i am confident that they are not causing any issue...as same is working without any issue when I had code without struts...

please let me know if you need any more inputs..

My focus or aim is to know whether can we use <html:input> etc tags inside the response jsp in ajax.

Thanks and Regards,
Vishal
vishal Mestri
Greenhorn

Joined: Sep 05, 2012
Posts: 14
Hi Jatan,

Even if you can share with a very basis sample with even one drop down being shown as part of AJAX response , through struts action... it would be really helpful.

Thanks and Regards,
Vishal
vishal Mestri
Greenhorn

Joined: Sep 05, 2012
Posts: 14
Hi All,

please help me out .

Thanks and Regards,
Vishal

jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 296

Hi Vishal,

Refer to this link Struts example there is example given to fill the combo with ajax request. specially see the example3. Code is given in zip file as well.

They have used the ajax you can refer to this.

Regards
Jatan
vishal Mestri
Greenhorn

Joined: Sep 05, 2012
Posts: 14
really thank you for taking your time out..

I have gone through zip file and example no 3 which is there.

Example3GetCharactersAction.java action contains html coding within java. Actually I want to avoid the same. Hence I am putting all possible values in arraylist.Put arraylist as attribute in request and forward to some jsp.
Within jsp I write code..... for showing drop down...hence it becomes good for understanding purpose..
I dont want to put html in action class as I think , if i do that, i am going back to old days of servlet, where we used to do html coding in servlets.....


As mentioned above when I am forwarding request to jsp for showing drop down...currently coding which I am doing is like mentioned below.



but I want to use


I hope you understand , what i want to do..
but i am not sure , is that feasible...

Regards,
Vishal
 
Don't get me started about those stupid light bulbs.
 
subject: Struts with Ajax