On 12/8/05, Qiang Yu <[EMAIL PROTECTED]> wrote:
What you're running into is a duel between front controller frameworks -- with a resulting conflict over which framework should receive the form submit. I'd suggest approaching this requirement in one of a couple of different ways:
* Look for a JSF file upload component (doesn't the tomahawk
library at MyFaces have one)? so you can go pure JSF
or
* Use the struts-faces integration library so that you can use
JSF components with Struts back-end actions
http://struts.apache.org/struts-faces/
If file upload is the *only* reason you are using Struts in this app, you'll find the "pure JSF" approach to be simpler. If you're using lots of other Struts stuff, the second approach will likely be better.
Craig
Hello all,
I am using both of myfaces and struts in my project. In one of my JSP
page, the legacy code uses struts to upload files. Since JSF does not
have a html file upload tag, I am still using struts tags for the file
uploading. I wrote my page like that:
What you're running into is a duel between front controller frameworks -- with a resulting conflict over which framework should receive the form submit. I'd suggest approaching this requirement in one of a couple of different ways:
* Look for a JSF file upload component (doesn't the tomahawk
library at MyFaces have one)? so you can go pure JSF
or
* Use the struts-faces integration library so that you can use
JSF components with Struts back-end actions
http://struts.apache.org/struts-faces/
If file upload is the *only* reason you are using Struts in this app, you'll find the "pure JSF" approach to be simpler. If you're using lots of other Struts stuff, the second approach will likely be better.
Craig
<%-- JSF & STRUTS tag importing --%>
<f:view>
<f:verbatim>
<html:form action=""> <html:file property =..... />
.....
</html:form>
</f:verbatim>
</f:view>
I have a struts action mapped to /upload.do, where actual uploading is
being done. It is like:
public class MyAction extends ...{
public ActionForward Execute(...){
uploadFile(...); //works fine
return mapping.findForward("success"); //exception thrown here
}
}
Everything works fine except that after the file is uploaded, my
action bean cannot forward to the designated "success" page.
In my struts.config, I configure the action like:
<action path="/upload" ...>
<forward name="success" path="/success.jsf" />
</action>
The error I got was:
java.lang.IllegalArgumentException: could not find pathMapping for
servletPath = /p/data/submit.do requestPathInfo = null
I have configured FacesRequestProcessor in the struts-config.xml and
faces context listener in the web.xml. I just did not use the <s:form>
because I need to use<html:file> in my JSP.
Also, I found that if there was the following action in my struts config file:
<action path="/hello" forward="/welcome.jsf"/>
I can not use "http://localhost/myapp/hello.do" to access the
/welcome.jsf directly. I got the same exception as mentioned above.
Sorry for my bad english and thanks for any help in advance
Qiang

