No ActionForm but want to put html objects inside the form and submit that form ??? is it possible ??
Hi Another basic question in Struts - I have 1 text fields and 1 button on the form . I do not want ActionForm . so my mapping in the struts-config.xml looks like this - actionpath="/seeorders" type="example.order.SeeOrderAction" forward name="success" path="/seeorders.jsp" / /action In this case I want to show all the orders to the user which matches the string that user enters into the status text field below . ** but as I do not have the ActionForm defined using name attribute of action tag , in that case I can not have html:form tag in the jsp file ** In this case how will I put html objects like text field , button in the jsp ??? In menu.jsp file - html:form action="/seeorders.do" bean:message key="order.status" /html:text property="status" size="10" / // status textfield. html:submitbean:message key="button.submit" //html:submit/body/html:form/html:html Regards Suhas
RE: Custom tag question
Is it possible to have custom tags that can have both child elements and attributes? I mean that in some cases it would be more elegant to use elements instead of attributes: If your question is just - Is it possible? Then the answer is Yes. However, if you are asking for the current tags to implement this, that is a totally separate question. That would take some re-work. Hey, good idea: +1 :P But I imagine it'd have to me more like: bean:message key=text.welcome bean:message-arg0bean:write name=un property=firstname//bean:message-arg0 bean:message-arg1bean:write name=un property=firstname//bean:message-arg1 /bean:message Is this necessary? I think that child elements should be able to adapt the namespace from the mother element. Here is couple more examples, what I meant about this custom tag question: bean:message key=text.welcome argbean:write name=un property=firstname//arg argbean:write name=un property=lastname//arg /bean:message or bean:message key=text.welcome arg name=un property=firstname/ arg name=un property=lastname/ /bean:message or maybe even like this bean:message name=un key=text.welcome argfirstname/arg arglastname/arg /bean:message or bean:message key=text.welcome argun.firstname/arg argun.lastname/arg /bean:message or bean:message key=text.welcome arg name=unfirstname/arg arg name=unlastname/arg /bean:message I think that those who design custom tags for struts should consider on how to make those custom tags most flexible and then implement them. Everything as attributes on every custom tag is not always the best way to do it. Reusable tags is also one thing to consider. ex. there might be a need to define something like bean:arg tag that can be used with several elements: bean:message bean:arg name=keytext.welcome/bean:arg /bean:message html:form bean:arg name=nameLogon/bean:arg /html:form Kind Regards Aapo Laakkonen
Problems with iterate
Hi, Sorry if this has been answered before, but i havent been able to find an answer! Im using iterate to display a vector containg valueobjects, i.e., html:form action=showContacts logic:iterate id=contacts name=form property=contactDataVector html:hidden name=contacts property=contactId/ tr td width=150 html:text name=contacts property=firstName size=20/ /td td width=150 html:text name=contacts property=lastName size=20/ /td /tr ... ... 'form' is my struts form bean, 'contactDataVector' is a vector of 'contactData' objects each containing (among others) the variables 'firstName' and 'lastName'. There is no problem in displaying the data, all goes well, but updating fields in the form is not working, when i want to save the changes in the struts action the vector is null! I can see that making a variable 'firstName' in the form, results in a call to its setter method, i.e., i can make it work when updating a single row, but i cant manage to get the update to work on the actual contactData objects in the vector. ?!?! Any advices out there?? ^terp
Re: No ActionForm but want to put html objects inside the form and submit that form ??? is it possible ??
suhas, i guess you need a html form when you use a html:text if you don't want form then you can use normal html for input type text. rama. - Original Message - From: suhas To: [EMAIL PROTECTED] Sent: Saturday, July 01, 2000 9:04 AM Subject: No ActionForm but want to put html objects inside the form and submit that form ??? is it possible ?? Hi Another basic question in Struts - I have 1 text fields and 1 button on the form . I do not want ActionForm . so my mapping in the struts-config.xml looks like this - actionpath="/seeorders" type="example.order.SeeOrderAction" forward name="success" path="/seeorders.jsp" / /action In this case I want to show all the orders to the user which matches the string that user enters into the status text field below . ** but as I do not have the ActionForm defined using name attribute of action tag , in that case I can not have html:form tag in the jsp file ** In this case how will I put html objects like text field , button in the jsp ??? In menu.jsp file - html:form action="/seeorders.do" bean:message key="order.status" /html:text property="status" size="10" / // status textfield. html:submitbean:message key="button.submit" //html:submit/body/html:form/html:html Regards Suhas
Struts Templates Example in VAJ 3.5.3/WTE - Problem
I have installed the Struts Templates example into VAJ 3.5.3/WTE environment. Have all the required pages and links working, the problem is that the page is not rendered as per the template. The Header, content and footer show up after the Sidebar and start at the left of the page and overlap the bottom of the Sidebar. A sample is attached. Would appreciate feeback on this porblem. Thanks Title: Templates Topics Introduction Using Templates Optional Content ... and more ... This example application is based on Using JSP templates to encapsulate Webpage layout and encourage modular design by David Geary. Follow that link for the full article, which also covers using role-based and nested templates. The template classes described in the Java World article were the basis for those included with Struts 1.0. Introduction Window toolkits typically provide a layout mechanism that positions widgets in a container; for example, AWT and Swing have layout managers, whereas VisualWorks Smalltalk has wrappers. Because layout undergoes many changes over the course of development, it's important to encapsulate that functionality so layout can be modified with minimal impact to the rest of the application. In fact, layout managers are an example of one of the tenets of object-oriented design: encapsulate the concept that varies, which is also a fundamental theme for many design patterns. JSP does not provide direct support for encapsulating layout, so web pages with identical formats usually replicate layout code; for example, A Web Page Layout shows a web page containing sections for a header, footer, sidebar, and main content. The layout of the page shown in A Web Page Layout is implemented with HTML table tags, as listed in Including Content. Including Content htmlheadtitleTemplates/title/headbody background='http://localhost:8080/jsptemplates/graphics/blueAndWhiteBackground.gif' table width='610'tr valign='top'tdjsp:include page='sidebar.jsp'//tdtdtabletrtdjsp:include page='header.html'//td/trtrtdjsp:include page='chapter.jsp'//td/trtrtdjsp:include page='footer.jsp'//td/tr/table/td/tr/table/body/html In Including Content, content is included with jsp:include which allows content to vary without modifying HTML; however, because the layout is hardcoded, layout changes require modifications to the page. If a website has many pages with identical formats, even simple layout changes require modifications to all of the pages. Using A Template %@ taglib URI='/WEB-INF/struts-template.tld' prefix='template' % template:insert template='/chapterTemplate.jsp'template:put name='title' content='Templates' direct='true'/template:put name='header' content='/header.html'/template:put name='sidebar' content='/sidebar.jsp'/template:put name='content' content='/introduction.html'/template:put name='footer' content='/footer.html'//template:insert To minimize the impact of layout changes, a mechanism is needed for dynamically including layout in addition to content. That way, both layout and content can be changed without modifying files that use them. For large websites that have many pages with identical formats, such a mechanism is valuable because it localizes changes to layout. That mechanism is JSP templates. TOP
Re: Error - MultipartIterator: no multipart request data sent
Hello I noticed the same problem when moving to 1.0. It seems that the requesthandler notices that the request is a multi-part and tries to find the multi-part data, even when the request are already handled and you are only forwarding to the next action. (I only got the problem when going to another action.) The way I handled it was to set redirect=true in struts-config.xml for the action that I forwarded to, this made the multi-part info go away from the request (and all other parameters too of course, so if you are expecting request parameters in the next action this will not work.) I guess this could be fixed in the code too, maybe by having the request reader setting a request attribute so that it knows the next time that it already has gotten the data. But I did not go deep enough into the code to know if that is feasible or not. Regards Mikael [EMAIL PROTECTED] wrote: Hi everbody, I am writing a program that needs to process form data. I have an uploadForm (that is an insatance of org.apache.struts.action.ActionForm). I have no problem with uploading a file via this form. After uploading the file, I am executing a couple of procedures inside the uploadAction(instance of org.apache.struts.action.Action) and afterwards forwarding the request to another page. While it is forwarding the request, it gives the following error: javax.servlet.ServletException: MultipartIterator: no multipart request data sent java.lang.Throwable(java.lang.String) java.lang.Exception(java.lang.String) javax.servlet.ServletException(java.lang.String) void org.apache.struts.upload.MultipartIterator.parseRequest() org.apache.struts.upload.MultipartIterator(javax.servlet.http.HttpServletRequest , int, long, java.lang.String) void org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(javax.servlet .http.HttpServletRequest) void org.apache.struts.util.RequestUtils.populate(java.lang.Object, java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest) void org.apache.struts.action.ActionServlet.processPopulate(org.apache.struts.action. ActionForm, org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest) void org.apache.struts.action.ActionServlet.process(javax.servlet.http.HttpServletReq uest, javax.servlet.http.HttpServletResponse) void com.ubs.cristal.actions.CristalActionServlet.process(javax.servlet.http.HttpServ letRequest, javax.servlet.http.HttpServletResponse) void org.apache.struts.action.ActionServlet.doPost(javax.servlet.http.HttpServletRequ est, javax.servlet.http.HttpServletResponse) void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.tomcat.core.ServletWrapper.doService(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response) void org.apache.tomcat.core.Handler.service(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response) void org.apache.tomcat.core.ServletWrapper.service(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response) void org.apache.tomcat.facade.RequestDispatcherImpl.forward(javax.servlet.ServletRequ est, javax.servlet.ServletResponse) void org.apache.struts.action.ActionServlet.processActionForward(org.apache.struts.ac tion.ActionForward, org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void org.apache.struts.action.ActionServlet.process(javax.servlet.http.HttpServletReq uest, javax.servlet.http.HttpServletResponse) void com.ubs.cristal.actions.CristalActionServlet.process(javax.servlet.http.HttpServ letRequest, javax.servlet.http.HttpServletResponse) void org.apache.struts.action.ActionServlet.doPost(javax.servlet.http.HttpServletRequ est, javax.servlet.http.HttpServletResponse) void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) void org.apache.tomcat.core.ServletWrapper.doService(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response) void org.apache.tomcat.core.Handler.service(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response) void org.apache.tomcat.core.ServletWrapper.service(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response) void org.apache.tomcat.core.ContextManager.internalService(org.apache.tomcat.core.Req uest, org.apache.tomcat.core.Response) void
RE: Problems with iterate
You need to do two things. First, you need to generate appropriate names for your input fields. If you use the current Struts tags then all the occurances of your two fields in the example below will generate names of firstName and lastName. What you want is to generate names in the format contactDataVector[x].firstName and contactDataVector[x].lastName, where x is the index number of the field. Dave Hay has posted a set of modified Struts tags which generate these names on Ted Husted's site: http://www.husted.com/about/struts/resources.htm#extensions - Indexed Tags Secondly you need to provide the appropriate getters/setters in your bean and ActionForm. Obviously in your bean you need setFirstName() and setLastName() methods - additionally you need the following getter in your ActionForm: public ContactData getContactDataVector(int index) { return (ContactData)(contactDataVector.get(index)); } Hope this helps. Niall -Original Message- From: Torsten Terp [mailto:[EMAIL PROTECTED]] Sent: 01 July 2001 19:01 To: Struts user list Subject: Problems with iterate Hi, Sorry if this has been answered before, but i havent been able to find an answer! Im using iterate to display a vector containg valueobjects, i.e., html:form action=showContacts logic:iterate id=contacts name=form property=contactDataVector html:hidden name=contacts property=contactId/ tr td width=150 html:text name=contacts property=firstName size=20/ /td td width=150 html:text name=contacts property=lastName size=20/ /td /tr ... ... 'form' is my struts form bean, 'contactDataVector' is a vector of 'contactData' objects each containing (among others) the variables 'firstName' and 'lastName'. There is no problem in displaying the data, all goes well, but updating fields in the form is not working, when i want to save the changes in the struts action the vector is null! I can see that making a variable 'firstName' in the form, results in a call to its setter method, i.e., i can make it work when updating a single row, but i cant manage to get the update to work on the actual contactData objects in the vector. ?!?! Any advices out there?? ^terp
Re: Found possible Bug in struts-form.tld (options tag)
The struts-form taglib is obsolete in Struts 1.0, as is the Options1Tag. I'm not entirely sure how they made it into the binary distribution, but they shouldn't be there. You need to switch over to using the struts-html taglib instead. -- Martin Cooper - Original Message - From: Scott Smith [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 30, 2001 3:23 PM Subject: Found possible Bug in struts-form.tld (options tag) The options tag definition should be changed FROM: tag nameoptions/name tagclassorg.apache.struts.taglib.html.OptionsTag/tagclass bodycontentempty/bodycontent ... TO: tag nameoptions/name tagclassorg.apache.struts.taglib.html.Options1Tag/tagclass bodycontentempty/bodycontent ... Notice the implementation class is Options1Tag instead of OptionsTag. I was having lots of problems getting options to work the way they are documented, so like any good hacker, I looked at the code and noticed two implementations of the options taglib. The Options1Tag solved my problems. Is this a know bug in the 1.0 distro? Are there any dangers to using the Options1Tag class? Scott P. Smith SummitLogic 790 Oak Trail Drive Marietta, GA 30062 USA email: [EMAIL PROTECTED]
Re: Opening another window from Struts
Have you looked at transaction tokens in Struts? It sounds like your serial number scheme does the same thing. Take a look at generateToken(), isTokenValie(), et al in the Action class. -- Martin Cooper - Original Message - From: Anthony Martin [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 29, 2001 2:55 PM Subject: RE: Opening another window from Struts I used frames briefly, to show the UI team it was possible. I mainly showed them how to make submits show up on a different frame, which is not quite what you're talking about: html:form action=editThingy target=overThere . . . /html:form It worked, and I stopped playing with it and let the UI team do their thing. As you probably know, just taking the controls away does not truly prevent users from accessing those controls. I use ALT + (LEFT||RIGHT) more than the nav bar. Instead of fighting with JavaScript and the user, I have a SecurityAction base class that among other things, issues a serial number that must match with one stored in the session. It can be incremented for each operation, but if you're really anal, it's a good idea to randomly issue them. Anthony -Original Message- From: Tom Miller [mailto:[EMAIL PROTECTED]] Sent: Friday, June 29, 2001 1:31 PM To: struts-user Subject: Opening another window from Struts Hello I'm trying to open a new window (without a location bar) from within my Struts application. I don't want the users to be able to page forward and back, etc. while they are on that new page editing a record in my database. I know how to open new windows via Javascript, but I'm unsure of how to do this in what with Struts passing beans and parameters through the Action servlet. Has anyone worked this out before? TIA for any ideas. -- Tom Miller Miller Associates, Inc. [EMAIL PROTECTED] 641.469.3535 Phone 413.581.6326 FAX
Report to Recipient(s)
Incident Information:- Originator:Martin Cooper [EMAIL PROTECTED] Recipients:[EMAIL PROTECTED] Subject: Re: Opening another window from Struts Message from Martin Cooper [EMAIL PROTECTED] was quarantined because it contained banned content.
RE: Found possible Bug in struts-form.tld (options tag)
Strange happenings: I looked again, and I am using struts-html. I guess it must have been a coincidence that my page started working after editing struts-form.tld. Very strange. I was sure I did not make any other changes in that iteration. I guess I have gremlins in my machine. Thanks, Scott -Original Message- From: Martin Cooper [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 01, 2001 6:19 PM To: [EMAIL PROTECTED] Subject: Re: Found possible Bug in struts-form.tld (options tag) The struts-form taglib is obsolete in Struts 1.0, as is the Options1Tag. I'm not entirely sure how they made it into the binary distribution, but they shouldn't be there. You need to switch over to using the struts-html taglib instead. -- Martin Cooper - Original Message - From: Scott Smith [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, June 30, 2001 3:23 PM Subject: Found possible Bug in struts-form.tld (options tag) The options tag definition should be changed FROM: tag nameoptions/name tagclassorg.apache.struts.taglib.html.OptionsTag/tagclass bodycontentempty/bodycontent ... TO: tag nameoptions/name tagclassorg.apache.struts.taglib.html.Options1Tag/tagclass bodycontentempty/bodycontent ... Notice the implementation class is Options1Tag instead of OptionsTag. I was having lots of problems getting options to work the way they are documented, so like any good hacker, I looked at the code and noticed two implementations of the options taglib. The Options1Tag solved my problems. Is this a know bug in the 1.0 distro? Are there any dangers to using the Options1Tag class? Scott P. Smith SummitLogic 790 Oak Trail Drive Marietta, GA 30062 USA email: [EMAIL PROTECTED]
Re: Problems with iterate
Let us see if I got this . getFirstName ( ) and getLastName( ) should be in the ContactData class and not needed in the ActionForm And in the Form bean one should have only getContactDataVector(int index) method as u said . In reset() method of the ActionForm u can instantiate the ContactData class and vector of ContactData class if it is null . So that in the jsp file u can have contactDataVector[i].firstName and contactDataVector[i].lastName fields . I think when u submit html:form then automatically ur FormBean's contactDataVector will be intialized 1. by calling reset method first where u intialize the vector of contactData . Then 2. by populating the ActionForm data ( contactDataVector) with the values from form fields Please correct me if I'm wrong . Suhas - Original Message - From: Niall Pemberton [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, July 01, 2001 11:56 PM Subject: RE: Problems with iterate You need to do two things. First, you need to generate appropriate names for your input fields. If you use the current Struts tags then all the occurances of your two fields in the example below will generate names of firstName and lastName. What you want is to generate names in the format contactDataVector[x].firstName and contactDataVector[x].lastName, where x is the index number of the field. Dave Hay has posted a set of modified Struts tags which generate these names on Ted Husted's site: http://www.husted.com/about/struts/resources.htm#extensions - Indexed Tags Secondly you need to provide the appropriate getters/setters in your bean and ActionForm. Obviously in your bean you need setFirstName() and setLastName() methods - additionally you need the following getter in your ActionForm: public ContactData getContactDataVector(int index) { return (ContactData)(contactDataVector.get(index)); } Hope this helps. Niall -Original Message- From: Torsten Terp [mailto:[EMAIL PROTECTED]] Sent: 01 July 2001 19:01 To: Struts user list Subject: Problems with iterate Hi, Sorry if this has been answered before, but i havent been able to find an answer! Im using iterate to display a vector containg valueobjects, i.e., html:form action=showContacts logic:iterate id=contacts name=form property=contactDataVector html:hidden name=contacts property=contactId/ tr td width=150 html:text name=contacts property=firstName size=20/ /td td width=150 html:text name=contacts property=lastName size=20/ /td /tr ... ... 'form' is my struts form bean, 'contactDataVector' is a vector of 'contactData' objects each containing (among others) the variables 'firstName' and 'lastName'. There is no problem in displaying the data, all goes well, but updating fields in the form is not working, when i want to save the changes in the struts action the vector is null! I can see that making a variable 'firstName' in the form, results in a call to its setter method, i.e., i can make it work when updating a single row, but i cant manage to get the update to work on the actual contactData objects in the vector. ?!?! Any advices out there?? ^terp