What's with the weird stuff in the URL? What's the actual request URL
end up looking like (as per proxy/Firebug/etc. And are you using the
exact same URL from the browser when testing it as a non-Ajax request?

Dave

On Monday, June 20, 2011, sivaks75
<sivakumar.subbura...@verizonwireless.com> wrote:
> Hi,
>
> I am using struts 1.3.8 with ajax to load the content of a selected file
> into another textarea as soon as user selects the text file.
>
> my action class extended from DispatchAction.
>
> Here is the URL, i specified in ajax request:
>
> var url = "emaillayout.do?function=fileUpload";
>
> I have written a method fileUpload in my action class.
>
> When I run the application, i get the below error.
> E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet
> Error]-[action]: java.lang.NoSuchMethodException: Action[/emaillayout] does
> not contain specified method (check logs)
>
> Instead ajax, if i do normal form submit, everything works fine. Only for
> ajax, i have this problem.
>
> Here is ajax JS function.
> function fileUpload(uploadFile){
> if(uploadFile != null && uploadFile.value == "")
> alert("Select the HTML file to be uploaded");
> var PAGE_SUCCESS = 200;
> requestObject = xmlHttpRequestHandler.createXmlHttpRequest();
> requestObject.onreadystatechange = processStateChange;
> var url = "emaillayout.do?function=fileUpload";
> try {
> requestObject.open("Get",url+"'||chr(38)||'"+Math.random(),false);
> } catch (e) {
> alert(e);
> }
> requestObject.send(null);
> }
>
> Here is my action class method:
> public ActionForward fileUpload(ActionMapping mapping, ActionForm form,
> HttpServletRequest request, HttpServletResponse response)throws Exception{
> //PrintWriter out = null;
> FrmEmailLayout frm = (FrmEmailLayout) form;
> FormFile uploadFile = frm.getUploadFile();
> try {
> String fileContent = uploadFile.getFileData().toString();
> response.setContentType("text/html");
> out = response.getWriter();
> out.println(fileContent);
> out.flush();
> return null;
> } finally {
> if (out != null) {
> out.close();
> }
> }
> }
>
> action definition:
> <action path="/emaillayout"
> type="com.vzwcorp.dashboard.actions.EmailLayouts"
> name="frmEmailLayout"
> parameter="function"
> scope="session"
> input="/emaillayout/main.jsp">
>
> Any help appreciated.
>
> --
> View this message in context: 
> http://struts.1045723.n5.nabble.com/Action-emaillayout-does-not-contain-specified-method-check-logs-tp4506435p4506435.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

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

Reply via email to