Passing Object or object collection from action to jsp
HI, When we want to pass an object or collection of objects to jsp we use value object or collection of them. For example imagine there is an action that wants to retrieve a list of users from database and send it to jsp. Here is the code of action: UserListAction { execute() { //connect to database(); //execute the select statement(); //Get result set Vector vecUsers = new Vector(); for size of result { User aUser = new User; aUser.setName( rs.get(username)); aUser.setFamily( rs.get(family)); . vecUser.add(aUser); } request.setPropertie(allUsers, vecUser) } } Then in the jsp we use logic:iterate tag to navigate. The only problem that we found is defining a value object named User, for data transfer for each page. Is there any way that we can use the dynamicForms or dynamic beans for passing data from action to jsp? Is it a good solution any way? Most of users use dynaForms are used for passing parameter from jsp to actions. Is it correct? Is there other usages of dynaForms? Thanks
Action to JSP
There are a way to: When a click in a link in my jsp page, in address bar in my browser dont write the name of the action, and go direct to the jsp page (defined in action forward) ??? Thanks. Mauricio
RE: Action to JSP
There are a way to: When a click in a link in my jsp page, in address bar in my browser dont write the name of the action, and go direct to the jsp page (defined in action forward) ??? Most of us go to great lengths to prevent users from accessing the JSPs directly, including putting them under WEB-INF or behind a security constraint. But if you have JSP's that don't need Action code in front of them, just put them somewhere accessible and use a plain old a href=filename.jspLink/a. If the link text/location needs to be dynamic, JSTL can be of help. However, if there are any Struts tags on the target JSP, they probably won't work right unless you go through an Action first. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action to JSP
Hi Mauricio can you send your caller jsp, the mapping and the action class? Vanessa [EMAIL PROTECTED] 09/01/2004 17:51:46 There are a way to: When a click in a link in my jsp page, in address bar in my browser dont write the name of the action, and go direct to the jsp page (defined in action forward) ??? Thanks. Mauricio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action to JSP
The easiest way is perhaps to simply add a redirect=true in your action mapping. However, be aware that this will kill your request attributes (since your request object is no longer forwarded..) Regards, Geeta Mauricio T. Ferraz wrote: There are a way to: When a click in a link in my jsp page, in address bar in my browser dont write the name of the action, and go direct to the jsp page (defined in action forward) ??? Thanks. Mauricio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Action to JSP
Thanks Smoak, but I have do execute a Action and go to a jsp page, but I dont want to show the name of the action in my address bar (htt://www.domain.com/someaction.do) I dont want this. When I execute the action I want to show the jsp, p.e. (htt://www.domain.com/mypage.jsp) thanks Message - From: Wendy Smoak [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, January 09, 2004 5:57 PM Subject: RE: Action to JSP There are a way to: When a click in a link in my jsp page, in address bar in my browser dont write the name of the action, and go direct to the jsp page (defined in action forward) ??? Most of us go to great lengths to prevent users from accessing the JSPs directly, including putting them under WEB-INF or behind a security constraint. But if you have JSP's that don't need Action code in front of them, just put them somewhere accessible and use a plain old a href=filename.jspLink/a. If the link text/location needs to be dynamic, JSTL can be of help. However, if there are any Struts tags on the target JSP, they probably won't work right unless you go through an Action first. -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action to JSP
Sorry Vanessa, I didn´t undestand. I just want to execute the action e show the jsp, but in my address bar I want to show the jsp page not the action (action.do) []´s Hi Mauricio can you send your caller jsp, the mapping and the action class? Vanessa [EMAIL PROTECTED] 09/01/2004 17:51:46 There are a way to: When a click in a link in my jsp page, in address bar in my browser dont write the name of the action, and go direct to the jsp page (defined in action forward) ??? Thanks. Mauricio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Action to JSP
From: Mauricio T. Ferraz [mailto:[EMAIL PROTECTED] I have do execute a Action and go to a jsp page, but I dont want to show the name of the action in my address bar (htt://www.domain.com/someaction.do) I dont want this. When I execute the action I want to show the jsp, p.e. (htt://www.domain.com/mypage.jsp) Then set redirect=true, but 1. you'll lose any request parameters (put them in session scope?) 2. it's going to be possible for people to go directly to your jsp's, so you'll have to check that that hasn't happened. Code/tag on the JSP? Filter? Place something in the session in the Action, then look for it in the Filter before allowing the request through to the JSP, otherwise forward it to the Action instead? (Wild guess... The marketing department doesn't think the .do URL's are pretty? Just curious!) -- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action to JSP - Works!!!
Thanks People Works!!! Thanks Geeta for the solution []´s Mauricio - Original Message - From: Geeta Ramani [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, January 09, 2004 6:06 PM Subject: Re: Action to JSP The easiest way is perhaps to simply add a redirect=true in your action mapping. However, be aware that this will kill your request attributes (since your request object is no longer forwarded..) Regards, Geeta Mauricio T. Ferraz wrote: There are a way to: When a click in a link in my jsp page, in address bar in my browser dont write the name of the action, and go direct to the jsp page (defined in action forward) ??? Thanks. Mauricio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action to JSP
Guess there was a two sided misunderstanding ;) I'm new at struts but I don't think you can do that. What you can do is change your url-pattern to something like *.jspa and name you action with the same name as your jsp and the browser will show (ex.) index.jspa Vanessa [EMAIL PROTECTED] 09/01/2004 18:11:12 Sorry Vanessa, I didn t undestand. I just want to execute the action e show the jsp, but in my address bar I want to show the jsp page not the action (action.do) [] s Hi Mauricio can you send your caller jsp, the mapping and the action class? Vanessa [EMAIL PROTECTED] 09/01/2004 17:51:46 There are a way to: When a click in a link in my jsp page, in address bar in my browser dont write the name of the action, and go direct to the jsp page (defined in action forward) ??? Thanks. Mauricio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action to JSP - Works!!!
be aware that this is not a good thing to do in general ... as you'll never be able to make use of the request scope for variables which *will* bite you at some point down the road. If someone doesn't like the *.do at the end of the action name, then you really need to address a solution other than redirecting everything to JSPs. Just my $0.02. Mauricio T. Ferraz wrote: Thanks People Works!!! Thanks Geeta for the solution []´s Mauricio - Original Message - From: Geeta Ramani [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, January 09, 2004 6:06 PM Subject: Re: Action to JSP The easiest way is perhaps to simply add a redirect=true in your action mapping. However, be aware that this will kill your request attributes (since your request object is no longer forwarded..) Regards, Geeta Mauricio T. Ferraz wrote: There are a way to: When a click in a link in my jsp page, in address bar in my browser dont write the name of the action, and go direct to the jsp page (defined in action forward) ??? Thanks. Mauricio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action to JSP
Quoting Geeta Ramani [EMAIL PROTECTED]: The easiest way is perhaps to simply add a redirect=true in your action mapping. However, be aware that this will kill your request attributes (since your request object is no longer forwarded..) Geeta's warning about one consequence is quite correct. So is the warning that you're going to make the performance of your application worse, because a redirect requires an extra round trip to the client (a forward is basically a glorified subroutine call that happens only on the server, which is why the browser doesn't change it's address -- it never knew what happened). personal-opinion In a web *applicaton* (as opposed to a web *site*), URLs should be thought of as an internal implementation detail, not a primary user-accessible feature. If you find your users getting distracted by the displayed URLs (or, worse, trying to bookmark them, which will never work unless your app takes pains to make it work), consider creating a frameset with a single frame in it (so the shown address never changes), or use JavaScript to create a new window that does not have a location bar. Other folks will disagree with me on this, of course, but in my general response is show me where the back button and bookmarks window are in a Swing app, and I'll make them available in my web app. :-) /personal-opinion Regards, Geeta Craig McClanahan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Action to JSP
Craig, I agree with everything you said, but would absolutely love a clarification from you on the following: Other folks will disagree with me on this, of course, but in my general response is show me where the back button and bookmarks window are in a Swing app, and I'll make them available in my web app. :-) I share your philosophy about how web^H^H^H applications should work, but there's a place where this philosophy abandons me. So I respond: If it's supposed to work like a swing app, then get rid of the bookmarks window and back button. Either that or make them unobtrusive. And now you know why I hate Web UI design. :-/ As such, this makes me an utter newb for the more esoteric front end issues involving a browser. So since my pre-struts experience put me mostly on the back end of web applications, what would you say are the best options for dealing with these things (struts or not) in a web application? I mean, I don't care if the back button still exists, but I don't want the user cursing my name every time he presses it without thinking about it. I personally _really_ hate it when this happens to me on my bank's site. TIA, Joe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to pass information between action and jsp
Hi, I need to create input pages for crystal reports 9 reports. What I am planning to do is create Action, Form and JSP page for each input pages. From JSP the information will be passed to Form bean and Action will be called. Here what I will do is collect the parameters, generate the SQL. Now I need to forward it to a common JSP/Action page where I will collect the generated SQL and call crystal reports to generate the report. How can I pass the SQL info to the common JSP/Action page without using session? Here I assume if I use session then it could create issues if the user generates more than one report at a time. Of course, I can store the SQL for each report in different attribute and retrieve it. But user can not view the same report simultaneously with different parameters. Hope I explained things clearly. Regards Thiru This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited. Visit Us at http://www.polaris.co.in - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors getting lost between action and JSP
When you call the saveErrors(...) method in the Action class' execute method, Struts will store the ActionErrors object under the default request attribute name org.apache.struts.action.ERROR. In the JSP, when you add the empty html:errors tag: html:errors/, Struts will look for this attribute in the request and display the errors. There is generally no need for you to save the errors under a different attribute name in the request in your Action class or specify a name attribute in the html:errors tag. You stated that you were saving the errors under the name errors in your Action class but your earlier code snippet shows that you were just calling saveErrors(...). Are you saving the errors yourself under a different attribute name? If so, are you doing this in addition to or in place of calling saveErrors()? It is not clear to me what your execute() method looks like. - Original Message - From: Parnell, Giles (AU - Sydney) [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, January 16, 2003 5:03 PM Subject: RE: ActionErrors getting lost between action and JSP Hi there Giri I seem to have got this working... although not sure why it's doing what it is. I've included my jsp. I basically traced though the SaveErrors method and saw that it appears to be changing the name of the actionErrors object on the request. - In my action i save it with the name : errors. - In the SaveMethod it seems to replace errors with: 'org.apache.struts.action.ERROR' So now in my jsp, i just use that name in the name portion of the html tag, like so: html:errors name=org.apache.struts.action.ERROR/ Do you have any idea why this is happening ? I am using struts1.0.2. Our company will not go to 1.1 as it's still beta. :( *** Heres my overall jsp: *** %@ page language=java import=java.lang.*, java.util.* % %@ page import=org.apache.struts.action.Action % %@ page import=org.apache.struts.action.ActionErrors % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % % response.setHeader(Cache-Control, no-cache); response.setHeader(Pragma, no-cache); response.setDateHeader(Expires, 0); % html head titleoops in gEm!/title script language=JavaScript src=../../static/js/rollUp.js/script link rel=stylesheet href=../../static/css/default.css type=text/css /head body bgcolor=#FF text=#00 leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 html:form name=errors scope=request type=au.com.eclipsegroup.egem.valueObject.VOErrors action=/roleTypeCheck.do !-- Top error banner - got the link back to the homepage -- jsp:include page=includes/99_errors_nav_top.jsp/ table class=table border=0 cellspacing=0 cellpadding=0 align=center tr td bgcolor=fed267 class=normal If you have come to this page - a critial system error has occured. Unfortunately your current changes will be lost. Please take note of the error message(s), and then click on the above 'myCareer' tag to return to your home page /td /tr trtdnbsp;/td/tr tr td bgcolor=fed267 class=error html:errors name=org.apache.struts.action.ERROR/ /td /tr trtdnbsp;/td/tr trtd bgcolor=fed267 class=normalTake heart in knowing the issue will be resolved !/td/tr /table /div /html:form /body /html *** Here's my struts-config portion *** actionpath=/preCreateCareerPlan type=au.com.eclipsegroup.egem.actions.cde.cp.PreCreateCareerPlanAction scope=request validate=true forward name=success path=/jsp/cde/cp/createCP.jsp/ forward name=failure path=/jsp/errors.jsp/ /action Any ideas why the object is getting renamed on the request ? Thanks Giri Giles -Original Message- From: Giri Alwar [mailto:[EMAIL PROTECTED]] Sent: Friday, 17 January 2003 5:55 AM To: Struts Users Mailing List Subject: Re: ActionErrors getting lost between action and JSP See my comments below. - Original Message - From: Parnell, Giles (AU - Sydney) [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, January 15, 2003 10:03 PM Subject: RE: ActionErrors getting lost between action and JSP Hi there Giri Thanks for your reply. The thing is... these are all the options I have tried. I've removed all the irrelevant code from my source for you to look at: log.error(Add some errors to check this working !!!); errors.add(test1, new ActionError(errors.moreThanOneEmployee)); errors.add(test2, new ActionError(errors.XMLHydration)); log.debug(Wot is the size of the actionErrors
Re: ActionErrors getting lost between action and JSP
See my comments below. - Original Message - From: Parnell, Giles (AU - Sydney) [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, January 15, 2003 10:03 PM Subject: RE: ActionErrors getting lost between action and JSP Hi there Giri Thanks for your reply. The thing is... these are all the options I have tried. I've removed all the irrelevant code from my source for you to look at: log.error(Add some errors to check this working !!!); errors.add(test1, new ActionError(errors.moreThanOneEmployee)); errors.add(test2, new ActionError(errors.XMLHydration)); log.debug(Wot is the size of the actionErrors: + errors.size()); saveErrors(request, errors); return (mapping.findForward(failure)); This part looks ok. ... - As i said before... the logging statement shows two errors in the actionErrors object. - Tracing through the SaveErrors method the errors are still there... - It's on leaving the action, and entering into the html:errors tag that it appears empty. Can you post the JSP portion where you are trying to display the errors? Also, can you post the action mapping including the forward element for failure? Which version of Struts are you using? - I don't need to use the property names, as I want ALL the errors to appear on the page. This is kinda driving me nuts - not sure where else I can trace ! Is there anything I need in my struts.config? Am i right is assuming that you DON'T need a form bean for the errors page. ie - can i just put the errors on the request, and forward ? Yes, you are right. Errors have nothing to do with form beans. Cheers Giles PS: ohhh... and both (errors.morethanoneEmployee and errrors.XMLHy...) are defined in my app.resources -Original Message- From: Giri Alwar [mailto:[EMAIL PROTECTED]] Sent: Thursday, 16 January 2003 1:49 PM To: Struts Users Mailing List Subject: Re: ActionErrors getting lost between action and JSP You need to save the ActionErrors object in the request in order to access it from the JSP. The simplest way to do this is as follows: In your Action class, ActionErrors errors = new ActionErrors(); errors.add(some property name, new ActionError(some.key)); // The next step is important if you will use the default attribute name saveErrors(request, errors); return mapping.findForward(failure); In your JSP, html:errors/ This should output all the errors regardless of property name. - Original Message - From: Parnell, Giles (AU - Sydney) [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, January 15, 2003 6:57 PM Subject: ActionErrors getting lost between action and JSP Hi there guys Wonder if you can help. I am trying to get the struts actionErrors to appear on my error page. I can get them working when I use the html:errors tag and specify the exact error I'm after, however I am now trying to output ALL the errors... with zero luck so far. I have added two errors to the actionErrors object in my action like so: if (true) { log.error(MAJOR DEBUGGING !!!); actionErrors.add(careerPlan.help, new ActionError (errors.updatingError, fingers, CareerPlan)); actionErrors.add(careerPlan.help, new ActionError (errors.XMLHydration )); //request.setAttribute(errors, errors); VOErrors errors = new VOErrors(actionErrors); request.setAttribute(errors,errors); log.debug(Wot is the size of the actionErrors: + actionErrors.size()); // XXX this always comes back as 2 // Try just place a string array on request /* String a = this is my first error; String b = this is my second error; String c = this is my third error; errors.add(a); errors.add(b); errors.add(c); request.setAttribute(errors, errors); //XXX this didn't work either XXX */ return (mapping.findForward(failure)); } The options i've tryed so far are: a)creating actionErrors, adding it to the request, and then forwarding to my error page b)creating a VOErrors, adding the actionErrors to the VO and forwarding this VO to my error page c)creating an arrayList of strings called errors, and forwarding to my error page When tracing through my action, on leaving the action I can see that there are two errors
Re: ActionErrors getting lost between action and JSP
Sorry if this was mentioned, but are you using redirect=true for that action-mapping? -- James Mitchell - Original Message - From: Giri Alwar [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, January 16, 2003 1:55 PM Subject: Re: ActionErrors getting lost between action and JSP See my comments below. - Original Message - From: Parnell, Giles (AU - Sydney) [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, January 15, 2003 10:03 PM Subject: RE: ActionErrors getting lost between action and JSP Hi there Giri Thanks for your reply. The thing is... these are all the options I have tried. I've removed all the irrelevant code from my source for you to look at: log.error(Add some errors to check this working !!!); errors.add(test1, new ActionError(errors.moreThanOneEmployee)); errors.add(test2, new ActionError(errors.XMLHydration)); log.debug(Wot is the size of the actionErrors: + errors.size()); saveErrors(request, errors); return (mapping.findForward(failure)); This part looks ok. ... - As i said before... the logging statement shows two errors in the actionErrors object. - Tracing through the SaveErrors method the errors are still there... - It's on leaving the action, and entering into the html:errors tag that it appears empty. Can you post the JSP portion where you are trying to display the errors? Also, can you post the action mapping including the forward element for failure? Which version of Struts are you using? - I don't need to use the property names, as I want ALL the errors to appear on the page. This is kinda driving me nuts - not sure where else I can trace ! Is there anything I need in my struts.config? Am i right is assuming that you DON'T need a form bean for the errors page. ie - can i just put the errors on the request, and forward ? Yes, you are right. Errors have nothing to do with form beans. Cheers Giles PS: ohhh... and both (errors.morethanoneEmployee and errrors.XMLHy...) are defined in my app.resources -Original Message- From: Giri Alwar [mailto:[EMAIL PROTECTED]] Sent: Thursday, 16 January 2003 1:49 PM To: Struts Users Mailing List Subject: Re: ActionErrors getting lost between action and JSP You need to save the ActionErrors object in the request in order to access it from the JSP. The simplest way to do this is as follows: In your Action class, ActionErrors errors = new ActionErrors(); errors.add(some property name, new ActionError(some.key)); // The next step is important if you will use the default attribute name saveErrors(request, errors); return mapping.findForward(failure); In your JSP, html:errors/ This should output all the errors regardless of property name. - Original Message - From: Parnell, Giles (AU - Sydney) [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, January 15, 2003 6:57 PM Subject: ActionErrors getting lost between action and JSP Hi there guys Wonder if you can help. I am trying to get the struts actionErrors to appear on my error page. I can get them working when I use the html:errors tag and specify the exact error I'm after, however I am now trying to output ALL the errors... with zero luck so far. I have added two errors to the actionErrors object in my action like so: if (true) { log.error(MAJOR DEBUGGING !!!); actionErrors.add(careerPlan.help, new ActionError (errors.updatingError, fingers, CareerPlan)); actionErrors.add(careerPlan.help, new ActionError (errors.XMLHydration )); //request.setAttribute(errors, errors); VOErrors errors = new VOErrors(actionErrors); request.setAttribute(errors,errors); log.debug(Wot is the size of the actionErrors: + actionErrors.size()); // XXX this always comes back as 2 // Try just place a string array on request /* String a = this is my first error; String b = this is my second error; String c = this is my third error; errors.add(a); errors.add(b); errors.add(c); request.setAttribute(errors, errors); //XXX this didn't work either XXX */ return
Re: ActionErrors getting lost between action and JSP
This was what I was looking for as well when I requested that he provide the action mapping (specifically the forward element) in my reply below. - Original Message - From: James Mitchell [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, January 16, 2003 1:10 PM Subject: Re: ActionErrors getting lost between action and JSP Sorry if this was mentioned, but are you using redirect=true for that action-mapping? -- James Mitchell - Original Message - From: Giri Alwar [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, January 16, 2003 1:55 PM Subject: Re: ActionErrors getting lost between action and JSP See my comments below. - Original Message - From: Parnell, Giles (AU - Sydney) [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, January 15, 2003 10:03 PM Subject: RE: ActionErrors getting lost between action and JSP Hi there Giri Thanks for your reply. The thing is... these are all the options I have tried. I've removed all the irrelevant code from my source for you to look at: log.error(Add some errors to check this working !!!); errors.add(test1, new ActionError(errors.moreThanOneEmployee)); errors.add(test2, new ActionError(errors.XMLHydration)); log.debug(Wot is the size of the actionErrors: + errors.size()); saveErrors(request, errors); return (mapping.findForward(failure)); This part looks ok. ... - As i said before... the logging statement shows two errors in the actionErrors object. - Tracing through the SaveErrors method the errors are still there... - It's on leaving the action, and entering into the html:errors tag that it appears empty. Can you post the JSP portion where you are trying to display the errors? Also, can you post the action mapping including the forward element for failure? Which version of Struts are you using? - I don't need to use the property names, as I want ALL the errors to appear on the page. This is kinda driving me nuts - not sure where else I can trace ! Is there anything I need in my struts.config? Am i right is assuming that you DON'T need a form bean for the errors page. ie - can i just put the errors on the request, and forward ? Yes, you are right. Errors have nothing to do with form beans. Cheers Giles PS: ohhh... and both (errors.morethanoneEmployee and errrors.XMLHy...) are defined in my app.resources -Original Message- From: Giri Alwar [mailto:[EMAIL PROTECTED]] Sent: Thursday, 16 January 2003 1:49 PM To: Struts Users Mailing List Subject: Re: ActionErrors getting lost between action and JSP You need to save the ActionErrors object in the request in order to access it from the JSP. The simplest way to do this is as follows: In your Action class, ActionErrors errors = new ActionErrors(); errors.add(some property name, new ActionError(some.key)); // The next step is important if you will use the default attribute name saveErrors(request, errors); return mapping.findForward(failure); In your JSP, html:errors/ This should output all the errors regardless of property name. - Original Message - From: Parnell, Giles (AU - Sydney) [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, January 15, 2003 6:57 PM Subject: ActionErrors getting lost between action and JSP Hi there guys Wonder if you can help. I am trying to get the struts actionErrors to appear on my error page. I can get them working when I use the html:errors tag and specify the exact error I'm after, however I am now trying to output ALL the errors... with zero luck so far. I have added two errors to the actionErrors object in my action like so: if (true) { log.error(MAJOR DEBUGGING !!!); actionErrors.add(careerPlan.help, new ActionError (errors.updatingError, fingers, CareerPlan)); actionErrors.add(careerPlan.help, new ActionError (errors.XMLHydration )); //request.setAttribute(errors, errors); VOErrors errors = new VOErrors(actionErrors); request.setAttribute(errors,errors); log.debug(Wot is the size of the actionErrors: + actionErrors.size()); // XXX this always comes back as 2 // Try just place a string array on request
RE: ActionErrors getting lost between action and JSP
Hi there Giri I seem to have got this working... although not sure why it's doing what it is. I've included my jsp. I basically traced though the SaveErrors method and saw that it appears to be changing the name of the actionErrors object on the request. - In my action i save it with the name : errors. - In the SaveMethod it seems to replace errors with: 'org.apache.struts.action.ERROR' So now in my jsp, i just use that name in the name portion of the html tag, like so: html:errors name=org.apache.struts.action.ERROR/ Do you have any idea why this is happening ? I am using struts1.0.2. Our company will not go to 1.1 as it's still beta. :( *** Heres my overall jsp: *** %@ page language=java import=java.lang.*, java.util.* % %@ page import=org.apache.struts.action.Action % %@ page import=org.apache.struts.action.ActionErrors % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % % response.setHeader(Cache-Control, no-cache); response.setHeader(Pragma, no-cache); response.setDateHeader(Expires, 0); % html head titleoops in gEm!/title script language=JavaScript src=../../static/js/rollUp.js/script link rel=stylesheet href=../../static/css/default.css type=text/css /head body bgcolor=#FF text=#00 leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 html:form name=errors scope=request type=au.com.eclipsegroup.egem.valueObject.VOErrors action=/roleTypeCheck.do !-- Top error banner - got the link back to the homepage -- jsp:include page=includes/99_errors_nav_top.jsp/ table class=table border=0 cellspacing=0 cellpadding=0 align=center tr td bgcolor=fed267 class=normal If you have come to this page - a critial system error has occured. Unfortunately your current changes will be lost. Please take note of the error message(s), and then click on the above 'myCareer' tag to return to your home page /td /tr trtdnbsp;/td/tr tr td bgcolor=fed267 class=error html:errors name=org.apache.struts.action.ERROR/ /td /tr trtdnbsp;/td/tr trtd bgcolor=fed267 class=normalTake heart in knowing the issue will be resolved !/td/tr /table /div /html:form /body /html *** Here's my struts-config portion *** actionpath=/preCreateCareerPlan type=au.com.eclipsegroup.egem.actions.cde.cp.PreCreateCareerPlanAction scope=request validate=true forward name=success path=/jsp/cde/cp/createCP.jsp/ forward name=failure path=/jsp/errors.jsp/ /action Any ideas why the object is getting renamed on the request ? Thanks Giri Giles -Original Message- From: Giri Alwar [mailto:[EMAIL PROTECTED]] Sent: Friday, 17 January 2003 5:55 AM To: Struts Users Mailing List Subject: Re: ActionErrors getting lost between action and JSP See my comments below. - Original Message - From: Parnell, Giles (AU - Sydney) [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, January 15, 2003 10:03 PM Subject: RE: ActionErrors getting lost between action and JSP Hi there Giri Thanks for your reply. The thing is... these are all the options I have tried. I've removed all the irrelevant code from my source for you to look at: log.error(Add some errors to check this working !!!); errors.add(test1, new ActionError(errors.moreThanOneEmployee)); errors.add(test2, new ActionError(errors.XMLHydration)); log.debug(Wot is the size of the actionErrors: + errors.size()); saveErrors(request, errors); return (mapping.findForward(failure)); This part looks ok. ... - As i said before... the logging statement shows two errors in the actionErrors object. - Tracing through the SaveErrors method the errors are still there... - It's on leaving the action, and entering into the html:errors tag that it appears
ActionErrors getting lost between action and JSP
Hi there guys Wonder if you can help. I am trying to get the struts actionErrors to appear on my error page. I can get them working when I use the html:errors tag and specify the exact error I'm after, however I am now trying to output ALL the errors... with zero luck so far. I have added two errors to the actionErrors object in my action like so: if (true) { log.error(MAJOR DEBUGGING !!!); actionErrors.add(careerPlan.help, new ActionError (errors.updatingError, fingers, CareerPlan)); actionErrors.add(careerPlan.help, new ActionError (errors.XMLHydration )); //request.setAttribute(errors, errors); VOErrors errors = new VOErrors(actionErrors); request.setAttribute(errors,errors); log.debug(Wot is the size of the actionErrors: + actionErrors.size()); // XXX this always comes back as 2 // Try just place a string array on request /* String a = this is my first error; String b = this is my second error; String c = this is my third error; errors.add(a); errors.add(b); errors.add(c); request.setAttribute(errors, errors); //XXX this didn't work either XXX */ return (mapping.findForward(failure)); } The options i've tryed so far are: a)creating actionErrors, adding it to the request, and then forwarding to my error page b)creating a VOErrors, adding the actionErrors to the VO and forwarding this VO to my error page c)creating an arrayList of strings called errors, and forwarding to my error page When tracing through my action, on leaving the action I can see that there are two errors in the actionErrors object. However on hitting the jsp page, and tracing through the html:errors tag - the errors object is always empty. Heres my jsp: %@ page language=java import=org.apache.struts.action.ActionErrors, java.lang.*, java.util.*, au.com.eclipsegroup.egem.valueObject.VOErrors % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % % response.setHeader(Cache-Control, no-cache); response.setHeader(Pragma, no-cache); response.setDateHeader(Expires, 0); % html head titleoops in gEm!/title script language=JavaScript src=../../static/js/rollUp.js/script link rel=stylesheet href=../../static/css/default.css type=text/css /head body bgcolor=#FF text=#00 leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 ! DO i even need a form been? ... or can i just place the actionErrors in the request and then use the html:errors tag ??? html:form name=errors scope=request type=au.com.eclipsegroup.egem.valueObject.VOErrors action=/roleTypeCheck.do !-- Top error banner - got the link back to the homepage -- jsp:include page=includes/99_errors_nav_top.jsp/ table class=table border=0 cellspacing=0 cellpadding=0 align=center tr td bgcolor=fed267 class=normal The following error(s) have occured - please fix or contact the system administrator for help. /td /tr tr td bgcolor=fed267 class=error !-- XXX debuggin -- % if (request.getAttribute(errors) != null) { ActionErrors e = (ActionErrors) request.getAttribute(errors); if (e != null) { int size = e.size(); % !-- this always comes back as 0 XXX --
Re: ActionErrors getting lost between action and JSP
You need to save the ActionErrors object in the request in order to access it from the JSP. The simplest way to do this is as follows: In your Action class, ActionErrors errors = new ActionErrors(); errors.add(some property name, new ActionError(some.key)); // The next step is important if you will use the default attribute name saveErrors(request, errors); return mapping.findForward(failure); In your JSP, html:errors/ This should output all the errors regardless of property name. - Original Message - From: Parnell, Giles (AU - Sydney) [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, January 15, 2003 6:57 PM Subject: ActionErrors getting lost between action and JSP Hi there guys Wonder if you can help. I am trying to get the struts actionErrors to appear on my error page. I can get them working when I use the html:errors tag and specify the exact error I'm after, however I am now trying to output ALL the errors... with zero luck so far. I have added two errors to the actionErrors object in my action like so: if (true) { log.error(MAJOR DEBUGGING !!!); actionErrors.add(careerPlan.help, new ActionError (errors.updatingError, fingers, CareerPlan)); actionErrors.add(careerPlan.help, new ActionError (errors.XMLHydration )); //request.setAttribute(errors, errors); VOErrors errors = new VOErrors(actionErrors); request.setAttribute(errors,errors); log.debug(Wot is the size of the actionErrors: + actionErrors.size()); // XXX this always comes back as 2 // Try just place a string array on request /* String a = this is my first error; String b = this is my second error; String c = this is my third error; errors.add(a); errors.add(b); errors.add(c); request.setAttribute(errors, errors); //XXX this didn't work either XXX */ return (mapping.findForward(failure)); } The options i've tryed so far are: a)creating actionErrors, adding it to the request, and then forwarding to my error page b)creating a VOErrors, adding the actionErrors to the VO and forwarding this VO to my error page c)creating an arrayList of strings called errors, and forwarding to my error page When tracing through my action, on leaving the action I can see that there are two errors in the actionErrors object. However on hitting the jsp page, and tracing through the html:errors tag - the errors object is always empty. Heres my jsp: %@ page language=java import=org.apache.struts.action.ActionErrors, java.lang.*, java.util.*, au.com.eclipsegroup.egem.valueObject.VOErrors % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % % response.setHeader(Cache-Control, no-cache); response.setHeader(Pragma, no-cache); response.setDateHeader(Expires, 0); % html head titleoops in gEm!/title script language=JavaScript src=../../static/js/rollUp.js/script link rel=stylesheet href=../../static/css/default.css type=text/css /head body bgcolor=#FF text=#00 leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 ! DO i even need a form been? ... or can i just place the actionErrors in the request and then use the html:errors tag ??? html:form name=errors scope=request type=au.com.eclipsegroup.egem.valueObject.VOErrors action=/roleTypeCheck.do !-- Top error banner - got the link back to the homepage -- jsp:include page=includes/99_errors_nav_top.jsp/ table class=table border=0 cellspacing=0 cellpadding=0 align=center tr td bgcolor=fed267 class=normal The following error(s) have occured - please fix or contact the system administrator for help. /td /tr tr td bgcolor=fed267 class=error !-- XXX debuggin -- % if (request.getAttribute(errors) != null) { ActionErrors e = (ActionErrors) request.getAttribute(errors
RE: ActionErrors getting lost between action and JSP
Hi there Giri Thanks for your reply. The thing is... these are all the options I have tried. I've removed all the irrelevant code from my source for you to look at: log.error(Add some errors to check this working !!!); errors.add(test1, new ActionError(errors.moreThanOneEmployee)); errors.add(test2, new ActionError(errors.XMLHydration)); log.debug(Wot is the size of the actionErrors: + errors.size()); saveErrors(request, errors); return (mapping.findForward(failure)); ... - As i said before... the logging statement shows two errors in the actionErrors object. - Tracing through the SaveErrors method the errors are still there... - It's on leaving the action, and entering into the html:errors tag that it appears empty. - I don't need to use the property names, as I want ALL the errors to appear on the page. This is kinda driving me nuts - not sure where else I can trace ! Is there anything I need in my struts.config? Am i right is assuming that you DON'T need a form bean for the errors page. ie - can i just put the errors on the request, and forward ? Cheers Giles PS: ohhh... and both (errors.morethanoneEmployee and errrors.XMLHy...) are defined in my app.resources -Original Message- From: Giri Alwar [mailto:[EMAIL PROTECTED]] Sent: Thursday, 16 January 2003 1:49 PM To: Struts Users Mailing List Subject: Re: ActionErrors getting lost between action and JSP You need to save the ActionErrors object in the request in order to access it from the JSP. The simplest way to do this is as follows: In your Action class, ActionErrors errors = new ActionErrors(); errors.add(some property name, new ActionError(some.key)); // The next step is important if you will use the default attribute name saveErrors(request, errors); return mapping.findForward(failure); In your JSP, html:errors/ This should output all the errors regardless of property name. - Original Message - From: Parnell, Giles (AU - Sydney) [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Wednesday, January 15, 2003 6:57 PM Subject: ActionErrors getting lost between action and JSP Hi there guys Wonder if you can help. I am trying to get the struts actionErrors to appear on my error page. I can get them working when I use the html:errors tag and specify the exact error I'm after, however I am now trying to output ALL the errors... with zero luck so far. I have added two errors to the actionErrors object in my action like so: if (true) { log.error(MAJOR DEBUGGING !!!); actionErrors.add(careerPlan.help, new ActionError (errors.updatingError, fingers, CareerPlan)); actionErrors.add(careerPlan.help, new ActionError (errors.XMLHydration )); //request.setAttribute(errors, errors); VOErrors errors = new VOErrors(actionErrors); request.setAttribute(errors,errors); log.debug(Wot is the size of the actionErrors: + actionErrors.size()); // XXX this always comes back as 2 // Try just place a string array on request /* String a = this is my first error; String b = this is my second error; String c = this is my third error; errors.add(a); errors.add(b); errors.add(c); request.setAttribute(errors, errors); //XXX this didn't work either XXX */ return (mapping.findForward(failure)); } The options i've tryed so far are: a)creating actionErrors, adding it to the request, and then forwarding to my error page b)creating a VOErrors, adding the actionErrors to the VO and forwarding this VO to my error page c)creating an arrayList of strings called errors, and forwarding to my error page When tracing through my action, on leaving the action I can see that there are two errors in the actionErrors object. However on hitting the jsp page, and tracing through the html:errors tag - the errors object is always empty. Heres my jsp: %@ page language=java import=org.apache.struts.action.ActionErrors, java.lang.*, java.util.*, au.com.eclipsegroup.egem.valueObject.VOErrors % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % % response.setHeader(Cache-Control, no-cache); response.setHeader(Pragma, no-cache
action to jsp form to action and validation failure problem.
Hi everyone, Im new to structs so please be gentle. I have an action that forwards onto a jsp page with a form. When the form buttons are pressed a different action is called. Action1 --- testform.jsp --- Action2 All works fine if the form passes validation. When the form fails validation, I expect to be returned back to the jsp form with some handy error messages. Instead all I get is a blank html page (htmlbody/body/html) and no error messages (and no errors from Jetty either). Any clue what Im doing wrong? Peter. Attached is my source code, if anyone wants a look. from my struts-config.xml ... form-bean name=testFormBean type=com.starjar.mint.webapp.TestForm /form-bean ... !-- display the testform. -- actionpath=/displayTestFormBean type=com.starjar.mint.webapp.actions.DisplayTestFormAction name=testFormBean validate=false forward name=success path=/WEB-INF/TestForm.jsp / forward name=failure path=/index.jsp/ /action !-- when one of the submit buttons on the form is pressed this action is called. with the property 'form_action' set according to which button was pressed -- actionpath=/processTestFromAction type=com.starjar.mint.webapp.actions.ProcessTestFromAction name=testFormBean validate=true input=/WEB-INF/TestForm.jsp parameter=form_action forward name=success path=/index.jsp / forward name=failure path=/WEB-INF/TestForm.jsp/ /action ... strutsProblem.zip Description: Zip compressed data -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: action to jsp form to action and validation failure problem.
On Wed, 2002-12-11 at 22:00, g h wrote: Hi everyone, Im new to structs so please be gentle. I have an action that forwards onto a jsp page with a form. When the form buttons are pressed a different action is called. Action1 --- testform.jsp --- Action2 All works fine if the form passes validation. When the form fails validation, I expect to be returned back to the jsp form with some handy error messages. Instead all I get is a blank html page (htmlbody/body/html) and no error messages (and no errors from Jetty either). Any clue what Im doing wrong? Peter. What's probably happening is an error is occuring that is being swallowed (at some point) and leaves you puzzled as to its origin. This has happened to me on occasion, and if a detailed search through my container's logs doesn't turn up anything, then its time to add more (strategically placed) debug statements to my code. That's always helped me out of whatever mess I've created. -- James Mitchell -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: action to jsp form to action and validation failure problem.
Im new to structs so please be gentle. I have an action that forwards onto a jsp page with a form. When the form buttons are pressed a different action is called. Action1 --- testform.jsp --- Action2 All works fine if the form passes validation. When the form fails validation, I expect to be returned back to the jsp form with some handy error messages. Instead all I get is a blank html page (htmlbody/body/html) and no error messages (and no errors from Jetty either). Any clue what Im doing wrong? Not exactly sure, although I've gotten similar blank pages before. Double check that you have the input=somejsp.jsp in your action mapping in the struts-config.xml. Use a debugger or put a print on the top of the jsp page to see if you are even being returned to the correct page if validation produces errors. (If all you are getting as you show above then you probably aren't). -- Rick -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Call action from JSP
Could someone help me on this code: In *.jsp: % if (condition satisfied) { // how to fill this line to call an action, say invoke.do? } % Thanks. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Call action from JSP
Why would you want to call an Action class directly from a JSP (outside a form:action block)? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:19 PM To: [EMAIL PROTECTED] Subject: Call action from JSP Could someone help me on this code: In *.jsp: % if (condition satisfied) { // how to fill this line to call an action, say invoke.do? } % Thanks. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Call action from JSP
I don't use form because I don't need to submit any data. The action will perform some logic against query string in request and data in session, and forward wither to a success page or a failure page. I could put this logic directly in JSP rather than in an action, but I don't want so many Java code in JSP. Galbreath, Mark Galbreath@tessco. To: 'Struts Users Mailing List' [EMAIL PROTECTED] com cc: Subject: RE: Call action from JSP 09/05/2002 12:27 PM Please respond to Struts Users Mailing List Why would you want to call an Action class directly from a JSP (outside a form:action block)? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:19 PM To: [EMAIL PROTECTED] Subject: Call action from JSP Could someone help me on this code: In *.jsp: % if (condition satisfied) { // how to fill this line to call an action, say invoke.do? } % Thanks. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Call action from JSP
You don't need to do it this way - you map the JSP to an Action class in struts-config.xml and Struts will automatically send the data to the class when the request URL changes. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:40 PM To: Struts Users Mailing List Subject: RE: Call action from JSP I don't use form because I don't need to submit any data. The action will perform some logic against query string in request and data in session, and forward wither to a success page or a failure page. I could put this logic directly in JSP rather than in an action, but I don't want so many Java code in JSP. Galbreath, Mark Galbreath@tessco. To: 'Struts Users Mailing List' [EMAIL PROTECTED] com cc: Subject: RE: Call action from JSP 09/05/2002 12:27 PM Please respond to Struts Users Mailing List Why would you want to call an Action class directly from a JSP (outside a form:action block)? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:19 PM To: [EMAIL PROTECTED] Subject: Call action from JSP Could someone help me on this code: In *.jsp: % if (condition satisfied) { // how to fill this line to call an action, say invoke.do? } % Thanks. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Call action from JSP
hmmm...why not check your condition and perform this logic in an action before you even forward to the JSP in the first place? b.t.w., you can always issue a response.sendRedirect( URL ) in the JSP scriplet, and give it the URL-mapping for the action you wish to redirect to. I don't think that doing this is a great idea, however. :) peace, Joe -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 10:40 AM To: Struts Users Mailing List Subject: RE: Call action from JSP I don't use form because I don't need to submit any data. The action will perform some logic against query string in request and data in session, and forward wither to a success page or a failure page. I could put this logic directly in JSP rather than in an action, but I don't want so many Java code in JSP. Galbreath, Mark Galbreath@tessco. To: 'Struts Users Mailing List' [EMAIL PROTECTED] com cc: Subject: RE: Call action from JSP 09/05/2002 12:27 PM Please respond to Struts Users Mailing List Why would you want to call an Action class directly from a JSP (outside a form:action block)? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:19 PM To: [EMAIL PROTECTED] Subject: Call action from JSP Could someone help me on this code: In *.jsp: % if (condition satisfied) { // how to fill this line to call an action, say invoke.do? } % Thanks. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Call action from JSP
The JSP is an index.jsp and condition has to be check there. If I use response.sendRedirect(URL) in the JSP scriplet, it seems that a new request is created during redirect. Is there a simple way to keep the previous request rather than create a new one? Joe Barefoot Joe.Barefoot@moti To: Struts Users Mailing List [EMAIL PROTECTED] va.com cc: Subject: RE: Call action from JSP 09/05/2002 12:42 PM Please respond to Struts Users Mailing List hmmm...why not check your condition and perform this logic in an action before you even forward to the JSP in the first place? b.t.w., you can always issue a response.sendRedirect( URL ) in the JSP scriplet, and give it the URL-mapping for the action you wish to redirect to. I don't think that doing this is a great idea, however. :) peace, Joe -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 10:40 AM To: Struts Users Mailing List Subject: RE: Call action from JSP I don't use form because I don't need to submit any data. The action will perform some logic against query string in request and data in session, and forward wither to a success page or a failure page. I could put this logic directly in JSP rather than in an action, but I don't want so many Java code in JSP. Galbreath, Mark Galbreath@tessco. To: 'Struts Users Mailing List' [EMAIL PROTECTED] com cc: Subject: RE: Call action from JSP 09/05/2002 12:27 PM Please respond to Struts Users Mailing List Why would you want to call an Action class directly from a JSP (outside a form:action block)? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:19 PM To: [EMAIL PROTECTED] Subject: Call action from JSP Could someone help me on this code: In *.jsp: % if (condition satisfied) { // how to fill this line to call an action, say invoke.do? } % Thanks. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Call action from JSP
This was sorta mentioned before, but...why not have and index.do instead of an index.jsp? Does index.jsp show something to the user or does it just do some logic and then call the server? If it does the latter, make it a .do Tim [EMAIL PROTECTED] om 09/05/2002 12:58 PM PleaseTo: Struts Users Mailing List [EMAIL PROTECTED] respond tocc: Struts Users Mailing List Subject: RE: Call action from JSP Caterpillar: Confidential Green Retain Until: 10/05/2002 Retention Category: G90 - Information and Reports The JSP is an index.jsp and condition has to be check there. If I use response.sendRedirect(URL) in the JSP scriplet, it seems that a new request is created during redirect. Is there a simple way to keep the previous request rather than create a new one? Joe Barefoot Joe.Barefoot@moti To: Struts Users Mailing List [EMAIL PROTECTED] va.com cc: Subject: RE: Call action from JSP 09/05/2002 12:42 PM Please respond to Struts Users Mailing List hmmm...why not check your condition and perform this logic in an action before you even forward to the JSP in the first place? b.t.w., you can always issue a response.sendRedirect( URL ) in the JSP scriplet, and give it the URL-mapping for the action you wish to redirect to. I don't think that doing this is a great idea, however. :) peace, Joe -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 10:40 AM To: Struts Users Mailing List Subject: RE: Call action from JSP I don't use form because I don't need to submit any data. The action will perform some logic against query string in request and data in session, and forward wither to a success page or a failure page. I could put this logic directly in JSP rather than in an action, but I don't want so many Java code in JSP. Galbreath, Mark Galbreath@tessco. To: 'Struts Users Mailing List' [EMAIL PROTECTED] com cc: Subject: RE: Call action from JSP 09/05/2002 12:27 PM Please respond to Struts Users Mailing List Why would you want to call an Action class directly from a JSP (outside a form:action block)? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:19 PM To: [EMAIL PROTECTED] Subject: Call action from JSP Could someone help me on this code: In *.jsp: % if (condition satisfied) { // how to fill this line to call an action, say invoke.do? } % Thanks. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED
RE: Call action from JSP
I am new to struts and I don't know if this is of any use or if it is even right, but when I wanted to call an Action when the user clicked a link I used something like (no forms involved): pBuild Database: a href=1-5-1_BuildDatabaseAction.doButton/a/p and in my struts-config.xml had something like: action path=/1-5-1_BuildDatabaseAction type=com.myapp.view.DBAdminClient name= input=/1-5_SAMainPage.jsp forward name=db_create_successpath=/success.html/ forward name=db_create_failed path=/fail.html/ /action I left name= because I wasn't doing anything with a form, just responding to a user clicking on a link. I welcome comments letting me know if this is the right way to be doing this or (rather more likely) that I am clueless and that there is some other struts mechanism I should be using to handle getting access to the action mappings when no forms are involved. Thanks, - Jim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:40 PM To: Struts Users Mailing List Subject: RE: Call action from JSP I don't use form because I don't need to submit any data. The action will perform some logic against query string in request and data in session, and forward wither to a success page or a failure page. I could put this logic directly in JSP rather than in an action, but I don't want so many Java code in JSP. Galbreath, Mark Galbreath@tessco. To: 'Struts Users Mailing List' [EMAIL PROTECTED] com cc: Subject: RE: Call action from JSP 09/05/2002 12:27 PM Please respond to Struts Users Mailing List Why would you want to call an Action class directly from a JSP (outside a form:action block)? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:19 PM To: [EMAIL PROTECTED] Subject: Call action from JSP Could someone help me on this code: In *.jsp: % if (condition satisfied) { // how to fill this line to call an action, say invoke.do? } % Thanks. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Call action from JSP
I see nothing wrong with what you are doing. You don't even need the name = in the xml. You might want to look at html:link in case you need to do anything more with maintaining session, etc. Tim |+- || Piper, James D CECOM SEC | || EPS | || [EMAIL PROTECTED]| || .army.mil | || | || 09/05/2002 01:12 PM| || Please respond to Struts | || Users Mailing List| || | |+- ---| | | | | | | | | | | |To: Struts Users Mailing List [EMAIL PROTECTED] | |cc: | | | | | | | | Subject: RE: Call action from JSP | ---| Caterpillar: Confidential Green Retain Until: 10/05/2002 Retention Category: G90 - Information and Reports I am new to struts and I don't know if this is of any use or if it is even right, but when I wanted to call an Action when the user clicked a link I used something like (no forms involved): pBuild Database: a href=1-5-1_BuildDatabaseAction.doButton/a/p and in my struts-config.xml had something like: action path=/1-5-1_BuildDatabaseAction type=com.myapp.view.DBAdminClient name= input=/1-5_SAMainPage.jsp forward name=db_create_successpath=/success.html/ forward name=db_create_failed path=/fail.html/ /action I left name= because I wasn't doing anything with a form, just responding to a user clicking on a link. I welcome comments letting me know if this is the right way to be doing this or (rather more likely) that I am clueless and that there is some other struts mechanism I should be using to handle getting access to the action mappings when no forms are involved. Thanks, - Jim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:40 PM To: Struts Users Mailing List Subject: RE: Call action from JSP I don't use form because I don't need to submit any data. The action will perform some logic against query string in request and data in session, and forward wither to a success page or a failure page. I could put this logic directly in JSP rather than in an action, but I don't want so many Java code in JSP. Galbreath, Mark Galbreath@tessco. To: 'Struts Users Mailing List' [EMAIL PROTECTED] com cc: Subject: RE: Call action from JSP 09/05/2002 12:27 PM Please respond to Struts Users Mailing List Why would you want to call an Action class directly from a JSP (outside a form:action block)? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:19 PM To: [EMAIL PROTECTED] Subject: Call action from JSP Could someone help me on this code: In *.jsp: % if (condition satisfied) { // how to fill this line to call an action, say invoke.do? } % Thanks. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED
RE: Call action from JSP
Not that I know of. You can put the request parameters you would like to pass on in the query string of the URL you give to response.sendRedirect though. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 10:59 AM To: Struts Users Mailing List Subject: RE: Call action from JSP The JSP is an index.jsp and condition has to be check there. If I use response.sendRedirect(URL) in the JSP scriplet, it seems that a new request is created during redirect. Is there a simple way to keep the previous request rather than create a new one? Joe Barefoot Joe.Barefoot@moti To: Struts Users Mailing List [EMAIL PROTECTED] va.com cc: Subject: RE: Call action from JSP 09/05/2002 12:42 PM Please respond to Struts Users Mailing List hmmm...why not check your condition and perform this logic in an action before you even forward to the JSP in the first place? b.t.w., you can always issue a response.sendRedirect( URL ) in the JSP scriplet, and give it the URL-mapping for the action you wish to redirect to. I don't think that doing this is a great idea, however. :) peace, Joe -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 10:40 AM To: Struts Users Mailing List Subject: RE: Call action from JSP I don't use form because I don't need to submit any data. The action will perform some logic against query string in request and data in session, and forward wither to a success page or a failure page. I could put this logic directly in JSP rather than in an action, but I don't want so many Java code in JSP. Galbreath, Mark Galbreath@tessco. To: 'Struts Users Mailing List' [EMAIL PROTECTED] com cc: Subject: RE: Call action from JSP 09/05/2002 12:27 PM Please respond to Struts Users Mailing List Why would you want to call an Action class directly from a JSP (outside a form:action block)? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:19 PM To: [EMAIL PROTECTED] Subject: Call action from JSP Could someone help me on this code: In *.jsp: % if (condition satisfied) { // how to fill this line to call an action, say invoke.do? } % Thanks. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Call action from JSP
How about: logic:equal ... !-- or whatever test you need -- logic:forward name=forward_name/ /logic:equal -- Martin Cooper -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 10:19 AM To: [EMAIL PROTECTED] Subject: Call action from JSP Could someone help me on this code: In *.jsp: % if (condition satisfied) { // how to fill this line to call an action, say invoke.do? } % Thanks. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Call action from JSP
Thank you, I had forgotten about that tag... b.t.w., the non-Struts way of forwarding (and retaining the request) is: JspFactory.getPageContext().forward( URL ); peace, Joe -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:24 PM To: 'Struts Users Mailing List' Subject: RE: Call action from JSP How about: logic:equal ... !-- or whatever test you need -- logic:forward name=forward_name/ /logic:equal -- Martin Cooper -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 10:19 AM To: [EMAIL PROTECTED] Subject: Call action from JSP Could someone help me on this code: In *.jsp: % if (condition satisfied) { // how to fill this line to call an action, say invoke.do? } % Thanks. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Call action from JSP
This is fine. Just leave out both the name and input attributes, since neither apply when there is not an ActionForm. -Ted. Piper, James D CECOM SEC EPS wrote: I am new to struts and I don't know if this is of any use or if it is even right, but when I wanted to call an Action when the user clicked a link I used something like (no forms involved): pBuild Database: a href=1-5-1_BuildDatabaseAction.doButton/a/p and in my struts-config.xml had something like: action path=/1-5-1_BuildDatabaseAction type=com.myapp.view.DBAdminClient name= input=/1-5_SAMainPage.jsp forward name=db_create_successpath=/success.html/ forward name=db_create_failed path=/fail.html/ /action I left name= because I wasn't doing anything with a form, just responding to a user clicking on a link. I welcome comments letting me know if this is the right way to be doing this or (rather more likely) that I am clueless and that there is some other struts mechanism I should be using to handle getting access to the action mappings when no forms are involved. Thanks, - Jim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:40 PM To: Struts Users Mailing List Subject: RE: Call action from JSP I don't use form because I don't need to submit any data. The action will perform some logic against query string in request and data in session, and forward wither to a success page or a failure page. I could put this logic directly in JSP rather than in an action, but I don't want so many Java code in JSP. Galbreath, Mark Galbreath@tessco. To: 'Struts Users Mailing List' [EMAIL PROTECTED] com cc: Subject: RE: Call action from JSP 09/05/2002 12:27 PM Please respond to Struts Users Mailing List Why would you want to call an Action class directly from a JSP (outside a form:action block)? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:19 PM To: [EMAIL PROTECTED] Subject: Call action from JSP Could someone help me on this code: In *.jsp: % if (condition satisfied) { // how to fill this line to call an action, say invoke.do? } % Thanks. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Ted Husted, Husted dot Com, Fairport NY US co-author, Java Web Development with Struts Order it today: http://husted.com/struts/book.html -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Call action from JSP
Without Struts (sometimes even with it), I'd use either of the following in a JSP: jsp:forward page=urlSpec/ or jsp:forward page=urlSpec jsp:param name=name value=value/ ... /jsp:forward For servlet code, I'd probably go with RequestDispatcher.forward(ServletRequest request, ServletResponse response), using ServletRequest.getRequestDispatcher(String path) to get the dispatcher. Joe Barefoot wrote: Thank you, I had forgotten about that tag... b.t.w., the non-Struts way of forwarding (and retaining the request) is: JspFactory.getPageContext().forward( URL ); peace, Joe -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:24 PM To: 'Struts Users Mailing List' Subject: RE: Call action from JSP How about: logic:equal ... !-- or whatever test you need -- logic:forward name=forward_name/ /logic:equal -- Martin Cooper -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 10:19 AM To: [EMAIL PROTECTED] Subject: Call action from JSP Could someone help me on this code: In *.jsp: % if (condition satisfied) { // how to fill this line to call an action, say invoke.do? } % Thanks. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ smime.p7s Description: S/MIME Cryptographic Signature
Re: How to take object from the Action to jsp
.jsp pages have access to the a reference named application from which you can gain access to objects stored in your servlet context. I believe you should use the following method to access context scoped objects within your jsp pages. You can extract the reference to your treemodel with the following. % Node root = (Node) application.getAttribute(treemodel); % %= new DirectoryModel(root) % Or your way %= new DirectoryModel((Node)application.getAttribute(treemodel)) % At 06:36 PM 4/3/2002, you wrote: Hello, My question might sound naive but I really eed your answer. I'm storing an object in ServletContext with the following code : servlet.getServletContext().setAttribute(treemodel,root); where root is an object of type Node(myclass). In my jsp I want to retrieve this object from the Servletontext so I do the following: %= new DirectoryModel((Node)servlet.getServletContext().getAttribute(treemodel) %. I'm wondering why I get the Exception: org.apache.jasper.compiler.ParseException: C:\jakarta\jakarta-tomcat-3.2.3\webapps\teach\main_menu.jsp(77,99) Attribute treemodel has no value at org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:519) at org.apache.jasper.compiler.JspReader.parseTagAttributes(JspReader.java:635) at org.apache.jasper.compiler.Parser$Tag.accept(Parser.java:798) My problem is that I cannot handle this object as a javabean since I want to use the object as it is and not to get the values of its properties. I would really appreciated your help. Thank you, Konstantina -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
How to take object from the Action to jsp
Hello, My question might sound naive but I really eed your answer. I'm storing an object in ServletContext with the following code : servlet.getServletContext().setAttribute(treemodel,root); where root is an object of type Node(myclass). In my jsp I want to retrieve this object from the Servletontext so I do the following: %= new DirectoryModel((Node)servlet.getServletContext().getAttribute(treemodel) %. I'm wondering why I get the Exception: org.apache.jasper.compiler.ParseException: C:\jakarta\jakarta-tomcat-3.2.3\webapps\teach\main_menu.jsp(77,99) Attribute treemodel has no value at org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader.java:519) at org.apache.jasper.compiler.JspReader.parseTagAttributes(JspReader.java:635) at org.apache.jasper.compiler.Parser$Tag.accept(Parser.java:798) My problem is that I cannot handle this object as a javabean since I want to use the object as it is and not to get the values of its properties. I would really appreciated your help. Thank you, Konstantina
RE: How to take object from the Action to jsp
Hi Constantina, Instead of servlet.getServletContext().setAttribute(treemodel,root); I use request.setAttribute(treemodel,root); In the JSP, instead of DirectoryModel((Node)servlet.getServletContext().getAttribute(treemodel) %. I use bean:write name=treemodel property=propertyOfNodeClass / to wirte one propierty into the generated html code, or % DirectoryModel((Node)this.pageContext.getAttribute(treemodel)); Hope That Help, Enrique. _ Enrique Rodriguez Lasterra -Mensaje original- De: Konstantina Stamopoulou [mailto:[EMAIL PROTECTED]] Enviado el: miercoles, 03 de abril de 2002 10:37 Para: Struts Users Mailing List Asunto: How to take object from the Action to jsp Hello, My question might sound naive but I really eed your answer. I'm storing an object in ServletContext with the following code : servlet.getServletContext().setAttribute(treemodel,root); where root is an object of type Node(myclass). In my jsp I want to retrieve this object from the Servletontext so I do the following: %= new DirectoryModel((Node)servlet.getServletContext().getAttribute(tre emodel) %. I'm wondering why I get the Exception: org.apache.jasper.compiler.ParseException: C:\jakarta\jakarta-tomcat-3.2.3\webapps\teach\main_menu.jsp(77,99) Attribute treemodel has no value at org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader .java:519) at org.apache.jasper.compiler.JspReader.parseTagAttributes(JspReader. java:635) at org.apache.jasper.compiler.Parser$Tag.accept(Parser.java:798) My problem is that I cannot handle this object as a javabean since I want to use the object as it is and not to get the values of its properties. I would really appreciated your help. Thank you, Konstantina -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: How to take object from the Action to jsp
Thanx, It finally worked by using bean. Konstantina - Original Message - From: Enrique Rodriguez [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, April 03, 2002 4:50 PM Subject: RE: How to take object from the Action to jsp Hi Constantina, Instead of servlet.getServletContext().setAttribute(treemodel,root); I use request.setAttribute(treemodel,root); In the JSP, instead of DirectoryModel((Node)servlet.getServletContext().getAttribute(treemodel) %. I use bean:write name=treemodel property=propertyOfNodeClass / to wirte one propierty into the generated html code, or % DirectoryModel((Node)this.pageContext.getAttribute(treemodel)); Hope That Help, Enrique. _ Enrique Rodriguez Lasterra -Mensaje original- De: Konstantina Stamopoulou [mailto:[EMAIL PROTECTED]] Enviado el: miercoles, 03 de abril de 2002 10:37 Para: Struts Users Mailing List Asunto: How to take object from the Action to jsp Hello, My question might sound naive but I really eed your answer. I'm storing an object in ServletContext with the following code : servlet.getServletContext().setAttribute(treemodel,root); where root is an object of type Node(myclass). In my jsp I want to retrieve this object from the Servletontext so I do the following: %= new DirectoryModel((Node)servlet.getServletContext().getAttribute(tre emodel) %. I'm wondering why I get the Exception: org.apache.jasper.compiler.ParseException: C:\jakarta\jakarta-tomcat-3.2.3\webapps\teach\main_menu.jsp(77,99) Attribute treemodel has no value at org.apache.jasper.compiler.JspReader.parseAttributeValue(JspReader .java:519) at org.apache.jasper.compiler.JspReader.parseTagAttributes(JspReader. java:635) at org.apache.jasper.compiler.Parser$Tag.accept(Parser.java:798) My problem is that I cannot handle this object as a javabean since I want to use the object as it is and not to get the values of its properties. I would really appreciated your help. Thank you, Konstantina -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Action and Jsp / passing Parameters
Hello everybody, In my web application I decided not to use frames and so I am using a table in a jsp file. my question is as follow: in the jsp file I want to know which action forwarded to this jsp file so that I will accordingly run the right code? Is der a way I could pass a Parameter from my Action class to the jsp file I am forwarding to ? Actually I want to include the corresponding jsp file into my main jsp file according to where the forward came from. Thanks for any Help Mohammed -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Action and Jsp / passing Parameters
In you action class you can set an object into the request using request.setAttribute(). This object could be of a generic type that you could examine in the jsp using a jsp:usebean tag to extract the object from the request. The action class always forwards the request object it has back to the JSP so the object that you set in it will exist in the JSP that you have forwarded to HTH Jin - Original Message - From: Mohammed [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, November 23, 2001 9:16 AM Subject: Action and Jsp / passing Parameters Hello everybody, In my web application I decided not to use frames and so I am using a table in a jsp file. my question is as follow: in the jsp file I want to know which action forwarded to this jsp file so that I will accordingly run the right code? Is der a way I could pass a Parameter from my Action class to the jsp file I am forwarding to ? Actually I want to include the corresponding jsp file into my main jsp file according to where the forward came from. Thanks for any Help Mohammed -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]