Hi, i am integrating struts with xform. i made a demo application which runs on jetty. problem: Not able to pass xml instances from servlet to jsp (xform).Hence, not able to display. getting " null" in getAttribute("XML") in jsp. i am having a save action class. =================================== SaveAction.java ================================= package action; import java.io.IOException; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts2.interceptor.RequestAware; import org.apache.struts2.interceptor.ServletRequestAware; import org.apache.struts2.interceptor.ServletResponseAware; import com.opensymphony.xwork2.ActionSupport; import pojo.Student; public class SaveAction extends ActionSupport implements ServletRequestAware ,ServletResponseAware{ Student student; HttpServletRequest request; HttpServletResponse response; public String execute() throws IOException { String str= new String("<book>"+ "<title >JAVA</title>" + "<author>Manish</author >" + " <language>English</language> " + "<link>s</link >" + "<rating>4</rating> " + "<notes>sddsa</notes> " + "</book>"); request.setAttribute("XML",str); System.out.println("Save Action"); response.sendRedirect("/pages/aaa.jsp"); return "success"; } public Student getStudent() { return student; } public void setStudent(Student student) { this.student = student; } public void setServletRequest(HttpServletRequest arg0) { request=arg0; } public void setServletResponse(HttpServletResponse arg0) { // TODO Auto-generated method stub response=arg0; } } ================================================================================== i am redirecting then to aaa.jsp ====================== aaa.jsp ===================== <%@ page import="java.util.* "%> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <head> <title>My test Xforms</title> <xforms:model> <xforms:instance id="books-instance"> <books <%=request.getAttribute("XML") %> xmlns="" > </books> </xforms:instance> <xforms:bind nodeset="book"> <xforms:bind nodeset="title" required="true()" /> <xforms:bind nodeset="author" required="true()" /> </xforms:bind> </xforms:model> </head> <body> <xforms:group ref="book"> <xforms:input ref="title"> <xforms:label>Title</xforms:label> </xforms:input> <br /> <xforms:input ref="author"> <xforms:label>Author</xforms:label> </xforms:input> <br/> <xforms:input ref="language"> <xforms:label>Language</xforms:label> </xforms:input> <br/> </xforms:group> </body> </html> =========================================================== i have also tried with request.setAttribute("oxf.xforms.renderer.document", xformsDocument); but in vain. please suggest me how shuld i do it. Thanks in advance Manish Suriya Mailto: [hidden email] Website: http://www.tcs.com ____________________________________________ Experience certainty. IT Services Business Solutions Outsourcing ____________________________________________ =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Manish,
On Tue, Sep 30, 2008 at 1:37 AM, Manish Suriya <[hidden email]> wrote: > i am integrating struts with xform. i made a demo application which runs on > jetty. Does your application work on Tomcat? Are you saying that this is a Jetty-specific issue? > problem: Not able to pass xml instances from servlet to jsp (xform).Hence, > not able to display. getting " null" in getAttribute("XML") in jsp. So you are setting a request attribute in a Struts action, and then reading it in a JSP. This doesn't seem to have something to do with Orbeon Forms, does it? Or am I miss-reading your code? Alex -- Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ Personal Blog: http://avernet.blogspot.com/ Twitter - http://twitter.com/avernet -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Hi Manish,
Looks like it is not a problem with the servers. You may not want to do a response.redirect() to your jsp to pass your attribute, but you should use request.forward() instead. But the best way is just to let your struts flow complete it course, and bind your jsp url to the "success" forward config in your struts-config.xml Marwoto. |
In reply to this post by manish_suriya
not orbeon related :
example, RequestDispatcher rd = request.getRequestDispatcher("/pages/aaa.jsp"); rd.forward(request, response);
|
Free forum by Nabble | Edit this page |