RE: Please Help - ClassCastException
I've been responding to your questions here and at JavaRanch on this subject. It seems like you are missing the point of DynaActionForms. Please read 4.3 and 4.4 of the user guide. http://jakarta.apache.org/struts/userGuide/building_controller.html Lots of additional comments below. Comments below look for * -Original Message- From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Sunday, January 04, 2004 10:18 PM To: Struts Users Mailing List Subject: RE: Please Help - ClassCastException Allow me to ask three more questions: 1. If I want to reset some specific text fields when the JSP is re-displayed, do I code the PostForm.java like this (please confirm): code: - import org.apache.struts.validator.DynaValidatorForm; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class PostForm extends DynaValidatorForm { public void reset(ActionMapping mapping, HttpServletRequest request) { super.reset( mapping, request ); set( receiver, new String() ); set( sender, new String() ); } public PostForm () {} } *** Why not just use the intial attribute of the form-property element? --- 2. if I want to reset all the text fields when the JSP is re-displayed, do I code like this (please confirm): code: --- import org.apache.struts.validator.DynaValidatorForm; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; public class PostForm extends DynaValidatorForm { public void reset(ActionMapping mapping, HttpServletRequest request) { initialize( mapping ); } public PostForm () {} } -- *** Why not just use the intial attribute of the form-property element? 3. What is the difference between code: --- form-bean name=postForm type=package.package.package.PostForm form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ /form-bean --- AND code: -- form-bean name=postForm type=org.apache.struts.validator.DynaValidatorForm form-property name=receiver type=java.lang.String/ form-property name=sender type=java.lang.String/ /form-bean --- Thank you very much. *** The second one makes sense. Why do you need the PostForm class? see my answer to a similar question of yours at JavaRanch http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topicf=58t= 001820 Here is a snippet of some tutorial I am working on that might help. DynaActionForms are universally loved and hated. In teaching, consulting Struts and developing with Struts, I have found that DynaActionForms are either embraced or rejected. The idea behind DynaActionForms is that instead of creating an ActionForm per form, you instead configure an ActionForm per form. Advantages of DynaActionForms: Some folks feel creating an ActionForm class for each HTML form in your Struts application is time-consuming, causes maintenance problems, and is frustrating. With DynaActionForm classes you don't have to create an ActionForm subclass for each form and a bean property for each field. Instead you configure an DynaActionForm its properties, type, and defaults in the Struts configuration file. snip To configure a DynaActionForm in struts-config.xml, you use a form-bean element as with normal ActionForm. The type of the form bean must be org.apache.struts.action.DynaActionForm or a derived class. You then add form-property elements to declare the properties of the form. To use a DynaActionForm add the following to form-beans element (example): form-bean name=userRegistrationDynaForm type=org.apache.struts.action.DynaActionForm form-property name=userName type=java.lang.String / form-property name=email type=java.lang.String / form-property name=password type=java.lang.String / form-property name=passwordCheck type=java.lang.String / form-property name=firstName type=java.lang.String / form-property name=lastName type=java.lang.String / form-property name=phone type=java.lang.String initial=(520) / form-property name=fax type=java.lang.String / form-property name=page
Struts Tiles Tutorial (free Struts training)
Master the Struts Tiles Framework Tutorial (Dec. 2003) http://www.arc-mind.com/downloads.htm The Tiles framework makes creating reusable pages and visual components easier. Developers can build Web applications by assembling reusable tiles. You can use tiles as templates or as visual components. In some respects, the tile layout is like a display function. First you pass tile layout parameters to use. The parameters can be simple strings, beans, or tiles. The parameters become attributes to the tile and get stored in the tile's tile scope. For its part, the tile scope resembles page scope, and is less general than request scope. The tile scope lets the tile's user pass arguments (called attributes) to the tile. Definitions let you define default parameters for tiles. Definitions can be defined in JSP or XML. Definitions can extend other definitions similarly to how a class can extend another class. Moreover, definitions can override parts of the definition it is extending. The Tiles framework includes its own RequestProcessor to handle tile layouts as ActionForwards. Thus you can forward to a tile definition instead of a JSP if you install the Tiles plug-in. If you are using Struts but not Tiles, then you are not fully benefiting from Struts and likely repeat yourself unnecessarily. The Tiles framework makes creating reusable site layouts and visual components feasible. In this tutorial you will cover the following: The Tiles framework and architecture How to build and use a tile layout as a site template How to use tile definitions both in XML and JSP How to move objects in and out of tile scope How to work with attributes lists How to nest tiles How to build and use tile layouts as small visual components How to subclass a definition How to create a controller for a tile How to use a tile as an ActionForward Rick Hightower Developer Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm Struts/J2EE consulting -- http://www.arc-mind.com/consulting.htm#StrutsMentoring - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Querystring builder
hi, Yes, i was referring to copyProperties(). The problem really gets complex if you have nested objects. and i doubt if there is any readymade solution to the problem you are facing. but with very little effrots you can do this You can make one and for all. Doesn't seem to be a tough job althought bit lengthy :-) Ok, allow me to get my hands dirty!! and I am not sure if this works with collections as you may want. You ca try with collections yourself. Say you have something like class A (with corresponding gettter and setter) { private B b; private String str; } class B (with corresponding gettter and setter) { private String str; } All you need to do is A a = new A(); a.setStr(navjot); B b = new B(); b.setStr(singh); a.setB(b); Map m = new HashMap(); Then call BEanUtils.copyProperties(m,a); you will get a map filled with key-value pairs str=navjot b.str=singh pass this to some function like. String getQueryStirng(Map m) { Iterator nvPairs = m.keySet().iterator(); StringBuffer nvString = new StringBuffer(); String key; while(nvPairs.hasNext()) { key = (String) nvPairs.next(); nvString.append(key + =); nvString.append(this.getString(key) + ); } String nv = nvString.toString(); if(m.keySet().size() != 0) { return nv.substring(0,nv.lastIndexOf()); } return nv; } My this function may not be efficient and does the job you want. and HURRAY!! you will get QueryString like str=navjotb.str=singh hope this helps Navjot Singh ** Wife sleeping in the middle of night suddenly wakes up and shout. Quick! My husband is back. Man get up and jumps out of window. Then realizes SHIT! I AM the husband. ** -Original Message- From: Patrick Cheng [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 12:05 PM To: Struts Users Mailing List Subject: RE: Querystring builder Hi Navjot, I have been working with the BeanUtils things on this problem. Are you referring to the 'describe' and 'populate' methods? That's what I've been working on. I am looking for yet a simpler way to do this. I should say, I wonder if there's an easier way to do this. Let me explain a bit on the situation. Multipage form. The form bean contains other value objects, and these value objects have Collection properties, pointing to another set of Value Objects. That is, in my original formbean: public MyEJBValueObject getXXX(){...} public void setXXXs(MyEJBValueObject e){...} In the MyEJBValueObject.java, I have: public Collection getYYYs(){...} public void setYYYs(Collecton c){...} And the collection YYY actually is a arraylist of AnotherEJBValueObject With this kind of structure, it's quite tedious to build the QueryString, Is that right? I suppose I have to iterate thru the Map described by BeanUtils and go into further levels, and describe again. The worst part is, I don't want to build the 'Form elements' myself. That is, I have to come up with indexed/mapped/mixed name, like, SALES.ITEMS[2].DISCOUNT['MONTHLYSPECIAL'].DISCOUNTRATE Do I have to do that manually? Thanks. Patrick. -Original Message- From: Navjot Singh [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:03 PM To: Struts Users Mailing List Subject: RE: Querystring builder that should be easy. BeanUtils gives you the way to populate a MAP object from a Bean. Now al you need to do is iterate over keys, form a querystring with each name-value pair separated by . HTH Navjot SIngh -Original Message- From: Patrick Cheng [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 11:19 AM To: Struts Users Mailing List Subject: RE: Querystring builder What I wanted to do is, at some point during the user is completing a form,(multipage) He can save the form. Instead of serializing the bean and saving Blob in oracle, I am trying to put things in a QueryString and save the string into oracle. And I want to populate that QueryString into a formbean when the user resumes. Any tools? Thanks a lot. Patrick. -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 12:14 PM To: Struts Users Mailing List Subject: Re: Querystring builder On Mon, 5 Jan 2004, Patrick Cheng wrote: Hi All, I have been trying to find helper class to build QueryString from javabean. Does anyone know of any tool like this? What are you wanting to do? Add parameters from your bean? Thanks, Patrick. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- James Mitchell Software Developer / Struts Evangelist http://www.struts-atlanta.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,
RE: Querystring builder
THANK YOU SOOO MUCH for providing such detail code in response. One of the lines in the iterating function: nvString.append(this.getString(key) + ); What's the this and the getString suppose to be? Should it be the map.get function? Rgds, Patrick. -Original Message- From: Navjot Singh [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 4:44 PM To: Struts Users Mailing List Subject: RE: Querystring builder hi, Yes, i was referring to copyProperties(). The problem really gets complex if you have nested objects. and i doubt if there is any readymade solution to the problem you are facing. but with very little effrots you can do this You can make one and for all. Doesn't seem to be a tough job althought bit lengthy :-) Ok, allow me to get my hands dirty!! and I am not sure if this works with collections as you may want. You ca try with collections yourself. Say you have something like class A (with corresponding gettter and setter) { private B b; private String str; } class B (with corresponding gettter and setter) { private String str; } All you need to do is A a = new A(); a.setStr(navjot); B b = new B(); b.setStr(singh); a.setB(b); Map m = new HashMap(); Then call BEanUtils.copyProperties(m,a); you will get a map filled with key-value pairs str=navjot b.str=singh pass this to some function like. String getQueryStirng(Map m) { Iterator nvPairs = m.keySet().iterator(); StringBuffer nvString = new StringBuffer(); String key; while(nvPairs.hasNext()) { key = (String) nvPairs.next(); nvString.append(key + =); nvString.append(this.getString(key) + ); } String nv = nvString.toString(); if(m.keySet().size() != 0) { return nv.substring(0,nv.lastIndexOf()); } return nv; } My this function may not be efficient and does the job you want. and HURRAY!! you will get QueryString like str=navjotb.str=singh hope this helps Navjot Singh ** Wife sleeping in the middle of night suddenly wakes up and shout. Quick! My husband is back. Man get up and jumps out of window. Then realizes SHIT! I AM the husband. ** -Original Message- From: Patrick Cheng [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 12:05 PM To: Struts Users Mailing List Subject: RE: Querystring builder Hi Navjot, I have been working with the BeanUtils things on this problem. Are you referring to the 'describe' and 'populate' methods? That's what I've been working on. I am looking for yet a simpler way to do this. I should say, I wonder if there's an easier way to do this. Let me explain a bit on the situation. Multipage form. The form bean contains other value objects, and these value objects have Collection properties, pointing to another set of Value Objects. That is, in my original formbean: public MyEJBValueObject getXXX(){...} public void setXXXs(MyEJBValueObject e){...} In the MyEJBValueObject.java, I have: public Collection getYYYs(){...} public void setYYYs(Collecton c){...} And the collection YYY actually is a arraylist of AnotherEJBValueObject With this kind of structure, it's quite tedious to build the QueryString, Is that right? I suppose I have to iterate thru the Map described by BeanUtils and go into further levels, and describe again. The worst part is, I don't want to build the 'Form elements' myself. That is, I have to come up with indexed/mapped/mixed name, like, SALES.ITEMS[2].DISCOUNT['MONTHLYSPECIAL'].DISCOUNTRATE Do I have to do that manually? Thanks. Patrick. -Original Message- From: Navjot Singh [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:03 PM To: Struts Users Mailing List Subject: RE: Querystring builder that should be easy. BeanUtils gives you the way to populate a MAP object from a Bean. Now al you need to do is iterate over keys, form a querystring with each name-value pair separated by . HTH Navjot SIngh -Original Message- From: Patrick Cheng [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 11:19 AM To: Struts Users Mailing List Subject: RE: Querystring builder What I wanted to do is, at some point during the user is completing a form,(multipage) He can save the form. Instead of serializing the bean and saving Blob in oracle, I am trying to put things in a QueryString and save the string into oracle. And I want to populate that QueryString into a formbean when the user resumes. Any tools? Thanks a lot. Patrick. -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 12:14 PM To: Struts Users Mailing List Subject: Re: Querystring builder On Mon, 5 Jan 2004, Patrick Cheng wrote: Hi All, I have been trying to find helper class to build QueryString from javabean. Does anyone know of any tool like this? What are you wanting to
RE: Querystring builder
oops, it's m.get(key).toString(); sometimes it happens in hurry ;-) -Original Message- From: Patrick Cheng [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:50 PM To: Struts Users Mailing List Subject: RE: Querystring builder THANK YOU SOOO MUCH for providing such detail code in response. One of the lines in the iterating function: nvString.append(this.getString(key) + ); What's the this and the getString suppose to be? Should it be the map.get function? Rgds, Patrick. -Original Message- From: Navjot Singh [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 4:44 PM To: Struts Users Mailing List Subject: RE: Querystring builder hi, Yes, i was referring to copyProperties(). The problem really gets complex if you have nested objects. and i doubt if there is any readymade solution to the problem you are facing. but with very little effrots you can do this You can make one and for all. Doesn't seem to be a tough job althought bit lengthy :-) Ok, allow me to get my hands dirty!! and I am not sure if this works with collections as you may want. You ca try with collections yourself. Say you have something like class A (with corresponding gettter and setter) { private B b; private String str; } class B (with corresponding gettter and setter) { private String str; } All you need to do is A a = new A(); a.setStr(navjot); B b = new B(); b.setStr(singh); a.setB(b); Map m = new HashMap(); Then call BEanUtils.copyProperties(m,a); you will get a map filled with key-value pairs str=navjot b.str=singh pass this to some function like. String getQueryStirng(Map m) { Iterator nvPairs = m.keySet().iterator(); StringBuffer nvString = new StringBuffer(); String key; while(nvPairs.hasNext()) { key = (String) nvPairs.next(); nvString.append(key + =); nvString.append(this.getString(key) + ); } String nv = nvString.toString(); if(m.keySet().size() != 0) { return nv.substring(0,nv.lastIndexOf()); } return nv; } My this function may not be efficient and does the job you want. and HURRAY!! you will get QueryString like str=navjotb.str=singh hope this helps Navjot Singh ** Wife sleeping in the middle of night suddenly wakes up and shout. Quick! My husband is back. Man get up and jumps out of window. Then realizes SHIT! I AM the husband. ** -Original Message- From: Patrick Cheng [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 12:05 PM To: Struts Users Mailing List Subject: RE: Querystring builder Hi Navjot, I have been working with the BeanUtils things on this problem. Are you referring to the 'describe' and 'populate' methods? That's what I've been working on. I am looking for yet a simpler way to do this. I should say, I wonder if there's an easier way to do this. Let me explain a bit on the situation. Multipage form. The form bean contains other value objects, and these value objects have Collection properties, pointing to another set of Value Objects. That is, in my original formbean: public MyEJBValueObject getXXX(){...} public void setXXXs(MyEJBValueObject e){...} In the MyEJBValueObject.java, I have: public Collection getYYYs(){...} public void setYYYs(Collecton c){...} And the collection YYY actually is a arraylist of AnotherEJBValueObject With this kind of structure, it's quite tedious to build the QueryString, Is that right? I suppose I have to iterate thru the Map described by BeanUtils and go into further levels, and describe again. The worst part is, I don't want to build the 'Form elements' myself. That is, I have to come up with indexed/mapped/mixed name, like, SALES.ITEMS[2].DISCOUNT['MONTHLYSPECIAL'].DISCOUNTRATE Do I have to do that manually? Thanks. Patrick. -Original Message- From: Navjot Singh [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:03 PM To: Struts Users Mailing List Subject: RE: Querystring builder that should be easy. BeanUtils gives you the way to populate a MAP object from a Bean. Now al you need to do is iterate over keys, form a querystring with each name-value pair separated by . HTH Navjot SIngh -Original Message- From: Patrick Cheng [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 11:19 AM To: Struts Users Mailing List Subject: RE: Querystring builder What I wanted to do is, at some point during the user is completing a form,(multipage) He can save the form. Instead of serializing the bean and saving Blob in oracle, I am trying to put things in a QueryString and save the string into oracle. And I want to populate that QueryString into a formbean when the user resumes. Any tools? Thanks a lot. Patrick. -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 12:14 PM To: Struts Users Mailing List
javax.servlet.ServletException: Exception creating bean of class
i have this error, i don't know where goes wrong.. please help.. javax.servlet.ServletException: Exception creating bean of class net.foong.newitemForm: {1} org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800) org.apache.jsp.pages.newitemForm_jsp._jspService(newitemForm_jsp.java:80) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) this is my struts-config.xml Struts-config.xml !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.1//EN http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd; struts-config !-- Form Bean Definitions -- form-beans form-bean name=newitemForm type=net.foong.newitemForm /form-bean /form-beans !-- = Global Exception Definitions -- global-exceptions /global-exceptions !-- === Global Forward Definitions -- global-forwards forward name=welcome path=/do/Welcome / /global-forwards !-- === Action Mapping Definitions -- action-mappings !-- Default Welcome action -- !-- Forwards to Welcome.jsp -- action path=/newitemForm forward=/pages/newitemForm.jsp / action path=/Welcome type=org.apache.struts.actions.ForwardAction parameter=/pages/Welcome.jsp / action path=/newitem type=net.foong.newitemAction name=newitemForm scope=request validate=false forward name=success path=/pages/cofirmation.jsp / /action /action-mappings !-- = Controller Configuration -- controller processorClass=org.apache.struts.tiles.TilesRequestProcessor / !-- Message Resources Definitions -- message-resources parameter=resources.application / !-- === Plug Ins Configuration -- !-- comment following if struts1.0.x -- plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml / set-property property=moduleAware value=true / set-property property=definitions-parser-validate value=true / /plug-in !-- end comment if struts1.0.x -- plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml / /plug-in /struts-config This is my web.xml web.xml = ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN http://java.sun.com/j2ee/dtds/web-app_2_2.dtd; web-app display-nameStruts Blank Application/display-name !-- Standard Action Servlet Configuration (with debugging) -- servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param init-param param-namedebug/param-name param-value2/param-value /init-param init-param param-namedetail/param-name param-value2/param-value /init-param load-on-startup2/load-on-startup /servlet !-- Standard Action Servlet Mapping -- servlet-mapping servlet-nameaction/servlet-name url-pattern/do/*/url-pattern /servlet-mapping !-- The Usual Welcome File List -- welcome-file-list welcome-fileindex.jsp/welcome-file /welcome-file-list !-- Struts Tag Library Descriptors -- taglib taglib-uri/tags/struts-bean/taglib-uri taglib-location/WEB-INF/struts-bean.tld/taglib-location /taglib taglib taglib-uri/tags/struts-html/taglib-uri taglib-location/WEB-INF/struts-html.tld/taglib-location /taglib taglib taglib-uri/tags/struts-logic/taglib-uri taglib-location/WEB-INF/struts-logic.tld/taglib-location /taglib taglib taglib-uri/tags/struts-nested/taglib-uri taglib-location/WEB-INF/struts-nested.tld/taglib-location /taglib taglib taglib-uri/tags/struts-tiles/taglib-uri taglib-location/WEB-INF/struts-tiles.tld/taglib-location /taglib /web-app this is my newitemForm.jsp newitemForm.jsp %@ taglib uri=/tags/struts-bean prefix=bean % %@ taglib uri=/tags/struts-html prefix=html % html html:html locale=true head link href=html:rewrite page=/pages/rr.css / rel=stylesheet type=text/css titlebean:message key=welcome.title//title body html:form action=newitem focus=itemName table tr tdItem Name :
RE: Custom Link Tag
Thanks Nico. However, I'm facing a problem with using my custom linktag. I am trying to specify the href attribute from which I shall get the path by using: dtag:dlink href=/sample.html showAlways=truetest tag/dtag:dlink However, my jsp is giving me the error: Error(12): Attribute: href is not a valid attribute name I suspect that since it is looking up the tld which I've written, which doesn't have the href attribute, that's causing the error. Now, my tag class extends the struts html LinkTag, but how do I get it (my TLD) to include the attributes of the LinkTag in the original struts-html.tld. Thanks. Sanjay -Original Message- From: Nicolas De Loof [mailto:[EMAIL PROTECTED] Sent: Friday, January 02, 2004 3:32 PM To: Struts Users Mailing List Subject: Re: Custom Link Tag public int doStartTag() { if (skip_condition) { return SKIP_BODY; } return super.doStartTag() } Nico. Nico, Thanks for your response. However, what will happen to the existing code in the doStartTag of the org.apache.struts.taglib.html.LinkTag? Because I will still need the existing functionality of the org.apache.struts.taglib.html.LinkTag as well !! Should I make a call to the super.doStartTag()? Please advise. Thanks. Sanjay -Original Message- From: Nicolas De Loof [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 31, 2003 6:25 PM To: Struts Users Mailing List Subject: Re: Custom Link Tag Place your code in doStartTag as it can return SKIP_BODY to exclude body from resulting HTML. return EVAL_BODY_INCLUDE if you want the body to be included Nico. Hi, I am writing a custom tag: MyLinkTag that extends the org.apache.struts.taglib.html.LinkTag. MyLinkTag has two fields. They are showAlways : Boolean alternateLink : String. The functionality of the MyLinkTag is captured in the following code snippet: *** HttpServletRequest request = pageContext.getRequest(); ActionMappings actionMappings = (ActionMappings)request.getAttribute(Action.MAPPINGS_KEY); String path = getHref(); ActionMapping actionMapping = actionMappings.findMapping(path); String[] roleNames = actionMapping.getRoleNames(); boolean userInRole = false; for(int i=0; iroleNames.length(); i++) { userInRole = request.isUserInRole(roleNames); if(!userInRole){ if((alternateLink != null) !(.equals(alternateLink))){ setHref(alternateLink); } else{ if(showAlways){ setDisabled(true); } else{ //don't show the link return SKIP_BODY; } } }//end if !userInRole }//end for loop *** The problem is I don't know where to place this code i.e. in which method: doStartTag() or doEndTag() or doAfterBody() or any other?? What method should I override?? And what should be the return [integer] values?? Thanks in advance. Sanjay This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Custom Link Tag
You have to copy/paste extended taglib description in your custom tld. You should write a simplest custom tag that includes it's body into response (the way logic: tags do) on some application-specific conditions, and use it this way : myTag:isUserInRole path=/sample.html html:link href=/sample.htmltest/html:link /myTag:isUserInRole Your tag will be reusable for various presentation items. Nico. Thanks Nico. However, I'm facing a problem with using my custom linktag. I am trying to specify the href attribute from which I shall get the path by using: dtag:dlink href=/sample.html showAlways=truetest tag/dtag:dlink However, my jsp is giving me the error: Error(12): Attribute: href is not a valid attribute name I suspect that since it is looking up the tld which I've written, which doesn't have the href attribute, that's causing the error. Now, my tag class extends the struts html LinkTag, but how do I get it (my TLD) to include the attributes of the LinkTag in the original struts-html.tld. Thanks. Sanjay -Original Message- From: Nicolas De Loof [mailto:[EMAIL PROTECTED] Sent: Friday, January 02, 2004 3:32 PM To: Struts Users Mailing List Subject: Re: Custom Link Tag public int doStartTag() { if (skip_condition) { return SKIP_BODY; } return super.doStartTag() } Nico. Nico, Thanks for your response. However, what will happen to the existing code in the doStartTag of the org.apache.struts.taglib.html.LinkTag? Because I will still need the existing functionality of the org.apache.struts.taglib.html.LinkTag as well !! Should I make a call to the super.doStartTag()? Please advise. Thanks. Sanjay -Original Message- From: Nicolas De Loof [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 31, 2003 6:25 PM To: Struts Users Mailing List Subject: Re: Custom Link Tag Place your code in doStartTag as it can return SKIP_BODY to exclude body from resulting HTML. return EVAL_BODY_INCLUDE if you want the body to be included Nico. Hi, I am writing a custom tag: MyLinkTag that extends the org.apache.struts.taglib.html.LinkTag. MyLinkTag has two fields. They are showAlways : Boolean alternateLink : String. The functionality of the MyLinkTag is captured in the following code snippet: *** HttpServletRequest request = pageContext.getRequest(); ActionMappings actionMappings = (ActionMappings)request.getAttribute(Action.MAPPINGS_KEY); String path = getHref(); ActionMapping actionMapping = actionMappings.findMapping(path); String[] roleNames = actionMapping.getRoleNames(); boolean userInRole = false; for(int i=0; iroleNames.length(); i++) { userInRole = request.isUserInRole(roleNames); if(!userInRole){ if((alternateLink != null) !(.equals(alternateLink))){ setHref(alternateLink); } else{ if(showAlways){ setDisabled(true); } else{ //don't show the link return SKIP_BODY; } } }//end if !userInRole }//end for loop *** The problem is I don't know where to place this code i.e. in which method: doStartTag() or doEndTag() or doAfterBody() or any other?? What method should I override?? And what should be the return [integer] values?? Thanks in advance. Sanjay This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - 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: javax.servlet.ServletException: Exception creating bean of class
To borrow from the title of a movie: Dude, where's my constructor? this is my newitemForm.java newitemForm.java = package net.foong; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; public class newitemForm extends ActionForm { private String itemName; private int quantity; public void setItemName(String itemName) { this.itemName=itemName; } public void setQuantity(int quantity) { this.quantity=quantity; } public String getItemName() { return itemName; } public int getQuantity() { return quantity; } public void reset(ActionMapping mapping, HttpServletRequest request) { this.itemName = null; this.quantity = 0; } } -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Warning: Page has Expired
Hi I have a page which calls an action. Depending on certain condition I will forward it to suitable pages. After this steps if user clicks the Browser's back button, it gives typical browser error Warning: Page has Expired (I am using IE). This happens especially after the validation failure. How to overcome this problem? I don't want to use GET method in html:form/ Thanks in advance M Bhat
Custom page for roles rejection
Dear All, I have extended the RequestProcessor.processRoles() function. When it returns false (i.e. user rejected) I get a blank screen. How/where do I set a custom page or action to perform? Thanks, Paul Global Equity Derivatives Technology Deutsche Bank [/] Office +44 (0)20 754 55458 Mobile +44 (0)7736 299483 Fax +44 (0)20 7547 2752 -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Warning: Page has Expired
Did you try to turn off expire? e.g. % response.setDateHeader (Expires, 0); response.setHeader(Pragma, no-cache); response.setHeader(Cache-Control, no-store); response.setDateHeader(max-age, 0); response.setDateHeader(Expires, 0); % Regards, Martin - Original Message - From: Manjunath Bhat [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, January 05, 2004 6:55 AM Subject: Warning: Page has Expired Hi I have a page which calls an action. Depending on certain condition I will forward it to suitable pages. After this steps if user clicks the Browser's back button, it gives typical browser error Warning: Page has Expired (I am using IE). This happens especially after the validation failure. How to overcome this problem? I don't want to use GET method in html:form/ Thanks in advance M Bhat - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Custom page for roles rejection
You have to write the response before returning from processRole. For example, you can set response status to some error so that default associated error-page is displayed : response.sendError(HttpServletResponse.SC_FORBIDDEN, getInternal().getMessage(notAuthorized, mapping.getPath())); Nico. - Original Message - From: Paul-J Woodward [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, January 05, 2004 1:05 PM Subject: Custom page for roles rejection Dear All, I have extended the RequestProcessor.processRoles() function. When it returns false (i.e. user rejected) I get a blank screen. How/where do I set a custom page or action to perform? Thanks, Paul Global Equity Derivatives Technology Deutsche Bank [/] Office +44 (0)20 754 55458 Mobile +44 (0)7736 299483 Fax +44 (0)20 7547 2752 -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - 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]
Announce: JPlates 3.0.1 released - object-oriented template processing for Java, JSP, and Struts
JPlates Inc has announced the general availability of JPlates 3.0.1. JPlates 3.0.1 adds template processing to Java, providing fully compiled, object-oriented template processing with template objects and template methods. JPlates dramatically improves productivity for Java and JSP and Struts developers. A free evaluation version is available. The new features in JPlates 3.0.1 include support for using JPlates template components with JSPs, even more support for Struts applications, dynamic class and configuration reloading for JPlates and Struts, enhanced Ant integration, and a new template visualization tool. For more information and JPlates examples, visit http://www.jplates.com. JPlates 3.0.1 syntax extends Java 1.4 syntax with JPlates template methods. Template methods are called just like other methods, but use JPlates template syntax for their method bodies. The result is callable, executable templates. The template method syntax combines template literal text with: substitution and i18n expressions, control flow statements and method calls, variable declarations and assignments, and output format control statements. JPlates classes are compiled into Java to ensure 100% compatibility with Java. The JPlates compiler is fast and robust, and maintains line numbers between the JPlates source and the generated Java to support easy debugging. The JPlates 3.0.1 runtime provides high performance template processing support for Servlets, Struts, JSP, J2EE, and J2SE applications. JPlates 3.0.1 offers the most usable, flexible, and powerful technology for dynamic content generation on the web, for XML transformation, for source code generation, for generating personalized email, or for any other application involving template-based processing. Use JPlates 3.0.1 along with or in place of JSP, XSLT, and other template processors, wherever you generate stylized text, whether in a web-application, a code-generator, or any other kind of Java application.
Filling select with options and getting description from ids: Providers
Using Struts tags, you do this for creating a select filled with options tags: html:select property=idDocument html:options collection=documents property=id labelProperty=descrip/ /html:select In this case, you should create a collection with beans for each document type (Passport, Cedule, Document, SSN, etc) and set it in the request to be collected by options tag. My questions are: Are you creating and filling this collection in the action previous the JSP? If you have this combo in multiples JSPs, Do you copypaste the collection creation in each action previous the JSP rendering? In my case, we created a new tag that uses a tinny framework we made for managing these collections, called Providers. Providers let you define collections from diferent datasources and you use this like this: html:select property=idDocument providers:options provider=DOCUMENTS property=id labelProperty=descrip/ /html:select Here, DOCUMENTS is the name of the provider, defined like this: provider name=DOCUMENTS className=ar.com.koalas.providers.FixedProvider set-property property=keyName value=key/ set-property property=description value=value/ value key=1 value=Passport/ value key=2 value=Cedule/ value key=3 value=SSN/ /provider You can use JDBCProvider to query from a database, or RefProvider to filter other Provider. And you could add new providers types Another problem is having an id, get a description. If you have an id (for instance, idDocument) you can get the description, in a bean:write fashion: providers:write provider=DOCUMENTS property=idDocument/ This displays Document description acording to idDocument property value, so you don't need to query it before JSP display. You can create providers to display, for example, boolean values in diferent ways: (Yes/No, True/False, a checked or unchecked html:checkbox tag, 2 different gifs images, etc). providers:write provider=TRUEFALSE property=isValid/ providers:write provider=YESNO property=isValid/ providers:write provider=IMAGESBOOLEAN property=isValid/ IMAGESBOOLEAN could be: provider name=IMAGESBOOLEAN className=ar.com.koalas.providers.FixedProvider set-property property=keyName value=key/ set-property property=description value=value/ value key=true ![CDATA[ img src=/images/true.gif ]] /value value key=false ![CDATA[ img src=/images/false.gif ]] /value /provider This solution helps us a lot in filling selects, displaying ids descriptions and increases reusability. What do you think of these solution? Does it goes against MVC? We are planing to upload this tiny framework to sourceforge.net in next week. Is there anything like this anywhere? Are we reinventing the wheel? Cheers. Guillermo. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: javax.servlet.ServletException: Exception creating bean of class
In this case, the only constructor for the class is the default one. Equivalent to: public newitemForm() { super(); } I think the link should be: html:link action=/newitem but I only took a quick look through the code... Quoting Joe Hertz [EMAIL PROTECTED]: To borrow from the title of a movie: Dude, where's my constructor? this is my newitemForm.java newitemForm.java = package net.foong; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; public class newitemForm extends ActionForm { private String itemName; private int quantity; public void setItemName(String itemName) { this.itemName=itemName; } public void setQuantity(int quantity) { this.quantity=quantity; } public String getItemName() { return itemName; } public int getQuantity() { return quantity; } public void reset(ActionMapping mapping, HttpServletRequest request) { this.itemName = null; this.quantity = 0; } } -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
simple question
How can i have a dynamic value in the action ? The following is not working . bean:define id=url value=/setUp.do?action=all type=String/ html:form action=%=url% Thanks !
artimus 1.1
Hello, this may be a bit off topic but there it goes: how do I deploy the artimus example application? What kind of database structure do I have to create? Kelly. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javax.servlet.ServletException: Exception creating bean of class
If I am not mistaken some IDEs create a default public constructor for you.. *My 2 pennies* Martin - Original Message - From: Kris Schneider [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, January 05, 2004 8:05 AM Subject: RE: javax.servlet.ServletException: Exception creating bean of class In this case, the only constructor for the class is the default one. Equivalent to: public newitemForm() { super(); } I think the link should be: html:link action=/newitem but I only took a quick look through the code... Quoting Joe Hertz [EMAIL PROTECTED]: To borrow from the title of a movie: Dude, where's my constructor? this is my newitemForm.java newitemForm.java = package net.foong; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; public class newitemForm extends ActionForm { private String itemName; private int quantity; public void setItemName(String itemName) { this.itemName=itemName; } public void setQuantity(int quantity) { this.quantity=quantity; } public String getItemName() { return itemName; } public int getQuantity() { return quantity; } public void reset(ActionMapping mapping, HttpServletRequest request) { this.itemName = null; this.quantity = 0; } } -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - 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: simple question
It should work (I use it !) Did you include the taglib directive for struts-bean ? Nico. How can i have a dynamic value in the action ? The following is not working . bean:define id=url value=/setUp.do?action=all type=String/ html:form action=%=url% Thanks ! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Custom page for roles rejection
That's perfect. Thanks, Paul Nicolas De Loof [EMAIL PROTECTED]To: Struts Users Mailing List [EMAIL PROTECTED] gey.com cc: Subject: Re: Custom page for roles rejection 05/01/2004 12:32 Please respond to Struts Users Mailing List You have to write the response before returning from processRole. For example, you can set response status to some error so that default associated error-page is displayed : response.sendError(HttpServletResponse.SC_FORBIDDEN, getInternal().getMessage(notAuthorized, mapping.getPath())); Nico. - Original Message - From: Paul-J Woodward [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, January 05, 2004 1:05 PM Subject: Custom page for roles rejection Dear All, I have extended the RequestProcessor.processRoles() function. When it returns false (i.e. user rejected) I get a blank screen. How/where do I set a custom page or action to perform? Thanks, Paul Global Equity Derivatives Technology Deutsche Bank [/] Office +44 (0)20 754 55458 Mobile +44 (0)7736 299483 Fax +44 (0)20 7547 2752 -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - 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] -- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: simple question
hi, perhaps it is this: (look at: http://jakarta.apache.org/struts/userGuide/struts-bean.html#define ) type: Specifies the fully qualified class name of the value to be exposed as the id attribute. [ java.lang.String (if you specify a value attribute) or java.lang.Object otherwise. ] [RT Expr] greetings -Original Message- From: Nicolas De Loof [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:41 PM To: Struts Users Mailing List Subject: Re: simple question It should work (I use it !) Did you include the taglib directive for struts-bean ? Nico. How can i have a dynamic value in the action ? The following is not working . bean:define id=url value=/setUp.do?action=all type=String/ html:form action=%=url% Thanks ! - 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: artimus 1.1
1)get the artimus example app at http://sourceforge.net/project/showfiles.php?group_id=49385 2)change to the artimus folder which contains appfuse.sql C:\cd artimus C:\Artimusdir Volume in drive C has no label. Volume Serial Number is 1CB0-1E6D Directory of C:\Artimus 01/05/2004 08:31a DIR . 01/05/2004 08:31a DIR .. 01/05/2004 08:31a 4,315,758 appfuse-1.2-bin.zip 11/30/2003 04:01p 2,931 appfuse.sql 12/20/2003 04:47p 4,275,886 appfuse.war 12/20/2003 04:46p 6,882 appfuse.xml 01/05/2004 08:31a DIR docs 05/28/2003 11:37p 564 LICENSE.txt 12/20/2003 04:49p 3,059 README.txt 12/20/2003 04:46p 851 WHATSNEW.txt 7 File(s) 8,605,931 bytes 3 Dir(s) 23,079,976,960 bytes free 3)connect to mysql as root/mysql C:\Artimusmysql -u root mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 15 to server version: 4.0.17-max-debug Type 'help;' or '\h' for help. Type '\c' to clear the buffer. 4)execute the mySQL DB creation utility mysql source appfuse.sql Query OK, 1 row affected (0.02 sec) Query OK, 0 rows affected (0.04 sec) Query OK, 0 rows affected (0.00 sec) Database changed Query OK, 0 rows affected (0.07 sec) Query OK, 1 row affected (0.01 sec) Query OK, 1 row affected (0.00 sec) Query OK, 0 rows affected (0.05 sec) Query OK, 1 row affected (0.01 sec) Query OK, 1 row affected (0.00 sec) Query OK, 0 rows affected (0.05 sec) Query OK, 1 row affected (0.00 sec) Query OK, 1 row affected (0.00 sec) mysql this Should get you started..be sure to read readme,.txt that comes with artimus! Let me know when you have gotten this far.. -Martin - Original Message - From: Kelly Goedert [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, January 05, 2004 8:28 AM Subject: artimus 1.1 Hello, this may be a bit off topic but there it goes: how do I deploy the artimus example application? What kind of database structure do I have to create? Kelly. - 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: simple question
I can write bean:write name=url/ but not %=url% then i get an org.apache.jasper.JasperException: Unable to compile class for JSP any idea ? Thanks ! - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:40 PM Subject: Re: simple question It should work (I use it !) Did you include the taglib directive for struts-bean ? Nico. How can i have a dynamic value in the action ? The following is not working . bean:define id=url value=/setUp.do?action=all type=String/ html:form action=%=url% Thanks ! - 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: simple question
No thats not it, It's not working with or without type... org.apache.jasper.JasperException Thx - Original Message - From: Matthias Wessendorf [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:42 PM Subject: RE: simple question hi, perhaps it is this: (look at: http://jakarta.apache.org/struts/userGuide/struts-bean.html#define ) type: Specifies the fully qualified class name of the value to be exposed as the id attribute. [ java.lang.String (if you specify a value attribute) or java.lang.Object otherwise. ] [RT Expr] greetings -Original Message- From: Nicolas De Loof [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:41 PM To: Struts Users Mailing List Subject: Re: simple question It should work (I use it !) Did you include the taglib directive for struts-bean ? Nico. How can i have a dynamic value in the action ? The following is not working . bean:define id=url value=/setUp.do?action=all type=String/ html:form action=%=url% Thanks ! - 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: simple question
I think it may depend on the servlet container. Currently i am unable to do it (tomcat 5) however I know I have done it before in one of the 4.x versions. Camron G. Levanger The Dreamlab www.dreamlabmedia.com (866) 890-3705 On Jan 5, 2004, at 7:12 AM, dirk wrote: I can write bean:write name=url/ but not %=url% then i get an org.apache.jasper.JasperException: Unable to compile class for JSP any idea ? Thanks ! - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:40 PM Subject: Re: simple question It should work (I use it !) Did you include the taglib directive for struts-bean ? Nico. How can i have a dynamic value in the action ? The following is not working . bean:define id=url value=/setUp.do?action=all type=String/ html:form action=%=url% Thanks ! - 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] smime.p7s Description: S/MIME cryptographic signature
Re: simple question
Here are some random guesses.. Looks like it should work to me. I use html-el:form action=${url} usually url is defined in a tiles def but what you're doing should work fine.. what about c:set var=url value=/foo.do / to test if its some problem with the bean:define tag you could try. % java.lang.String url = /foo.do; pageContext.setAttribute(url,url); % or perhaps your container is storing your variable as an object. so html:form action=%= url.toString() % Cheers Mark On 5 Jan 2004, at 15:15, Camron G. Levanger wrote: I think it may depend on the servlet container. Currently i am unable to do it (tomcat 5) however I know I have done it before in one of the 4.x versions. Camron G. Levanger The Dreamlab www.dreamlabmedia.com (866) 890-3705 On Jan 5, 2004, at 7:12 AM, dirk wrote: I can write bean:write name=url/ but not %=url% then i get an org.apache.jasper.JasperException: Unable to compile class for JSP any idea ? Thanks ! - Original Message - From: Nicolas De Loof [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, January 05, 2004 2:40 PM Subject: Re: simple question It should work (I use it !) Did you include the taglib directive for struts-bean ? Nico. How can i have a dynamic value in the action ? The following is not working . bean:define id=url value=/setUp.do?action=all type=String/ html:form action=%=url% Thanks ! - 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: artimus 1.1
I did all this you said and followed also the steps in readme.txt. But when I click on create resources button, I get this: 05/01/2004 13:10:15 org.apache.struts.action.RequestProcessor process INFO: Processing a 'POST' for path '/menu/Manager' processActionForward(/do/CreateResources, false) '/do/CreateResources' - processed as uri 05/01/2004 13:10:15 org.apache.struts.action.RequestProcessor process INFO: Processing a 'POST' for path '/CreateResources' java.lang.NullPointerException at org.apache.artimus.article.Access.index(Unknown Source) at org.apache.artimus.CreateResources.execute(Unknown Source) at org.apache.struts.scaffold.ProcessAction.executeLogic(Unknown Source) at org.apache.struts.scaffold.BaseHelperAction.executeLogic(Unknown Source) at org.apache.struts.scaffold.BaseAction.execute(Unknown Source) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1014) at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:257) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:417) at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:300) at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:390) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:271) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache. Martin Gainty wrote: 1)get the artimus example app at http://sourceforge.net/project/showfiles.php?group_id=49385 2)change to the artimus folder which contains appfuse.sql C:\cd artimus C:\Artimusdir Volume in drive C has no label. Volume Serial Number is 1CB0-1E6D Directory of C:\Artimus 01/05/2004 08:31a DIR . 01/05/2004 08:31a DIR .. 01/05/2004 08:31a 4,315,758 appfuse-1.2-bin.zip 11/30/2003 04:01p 2,931 appfuse.sql 12/20/2003 04:47p 4,275,886 appfuse.war 12/20/2003 04:46p 6,882 appfuse.xml 01/05/2004 08:31a DIR docs 05/28/2003 11:37p 564 LICENSE.txt 12/20/2003 04:49p 3,059 README.txt 12/20/2003 04:46p 851 WHATSNEW.txt 7 File(s) 8,605,931 bytes 3 Dir(s) 23,079,976,960 bytes free 3)connect to mysql as root/mysql C:\Artimusmysql -u root mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 15 to server version: 4.0.17-max-debug Type 'help;' or '\h' for help. Type
selecting a value from drop down list
Hi, I have a drop down list in my jsp page the code is shown below td width=100bName/b/td td select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName //option /logic:iterate /select /td When I run this jsp page it displays a list of all names in a drop down list on the jsp page. What i want to do is User will select one of the names from the above select drop down list and i want to get that value from the jsp page and store it into the database. how should i get that value from the jsp page Please help me Regards Kamal - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Proper use of ProcessAction, ProcessResult and ResultList
Dear Struts users: For a couple of weeks now, I've been trying to use the ProcessAction class in Struts Scaffold, following the book Struts in Action and the example Artimus application in which it was demonstrated. It's pretty convenient in that it simplifies the design of my business logic classes, making them completely reusable outside of Struts or even a web app. I just have a number of issues with it that I haven't resolved, despite having stepped through the source code and closely studying the Artimus app: 1. How do you display a confirmation message when, say, a record was successfully saved? I use a ProcessResult to wrap the results, and there is a method ProcessResult.addMessage() which seems to allow you to add a message to it. Here is the snippet of code... start of Java code snippet -- ... UserManager manager = getUserManager(); List users = manager.getAllUsers(); ResultList resultList = new ResultListBase(users); result = new ProcessResultBase(resultList); if (resultList.getSize() 0) { result.addMessage(users.found); result.addMessage(new Integer(resultList.getSize())); } else { result.addMessage(users.none.found); } result.setDispatch(success); end of Java code snippet -- and here is the JSP fragment that attempts to display the message... start of JSP fragment - ... logic:messagesPresent UL html:messages id=error LIbean:write name=error//LI /html:messages /UL /logic:messagesPresent logic:messagesPresent message=true UL html:messages id=message LIbean:write name=message//LI /html:messages /UL /logic:messagesPresent ... end of JSP fragment - This is a verbatim copy of the message.jsp in the example Artimus application. However, when I hit the page, an exception is thrown with the message could not find bean message... END OF FIRST ISSUE == 2. How do you set a transactional token? From the code in ProcessAction (at the very end of the preProcess() method), it appears that I have to define a forward whose name is stored in Tokens.SET_TOKEN for a token to be set. Does this mean that I have to define a local forward for each data entry form that I need to guard against multiple submissions? END OF SECOND ISSUE = I hope I've explained the issues above clearly. I've been looking at this for two weeks, searching through the archives for answers without much success. I hope that with this post, someone can give me some clues as to where to look. Thank you very much, and a Happy New Year to all! Noel Lecaros - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: selecting a value from drop down list
Assuming you are using Struts to process the form submission, once the user selects a value from the drop down list and submits the form to be processed, the action which you have configured to handle this form submission, will have access to the selected value via the form configured to store the posted request information. Once inside your action you would do something like the following: MyForm myForm = (MyForm) form; String sName = myForm.getSname(); // update database with sName value robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 10:42 AM To: Struts Users Mailing List Subject: selecting a value from drop down list Hi, I have a drop down list in my jsp page the code is shown below td width=100bName/b/td td select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName //option /logic:iterate /select /td When I run this jsp page it displays a list of all names in a drop down list on the jsp page. What i want to do is User will select one of the names from the above select drop down list and i want to get that value from the jsp page and store it into the database. how should i get that value from the jsp page Please help me Regards Kamal - 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: selecting a value from drop down list
You'll find the docs here http://jakarta.apache.org/struts/userGuide/struts-html.html#select You need something like the following, please don't copy and paste and then immediately post the list. html:select property=sName html:options name=myList property=sName / /html:select Judging by the vagueness of you question i guess you'll also have to read some stuff on action forms also. Cheers Mark On 5 Jan 2004, at 16:42, Kamal Gupta wrote: Hi, I have a drop down list in my jsp page the code is shown below td width=100bName/b/td td select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName //option /logic:iterate /select /td When I run this jsp page it displays a list of all names in a drop down list on the jsp page. What i want to do is User will select one of the names from the above select drop down list and i want to get that value from the jsp page and store it into the database. how should i get that value from the jsp page Please help me Regards Kamal - 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: selecting a value from drop down list
Hi, Thanks for your reply robert. I am using struts and in the action i am using request.getParameter(sname); for all other text boxes i get the value using request.getParamter(); but I dont get any value for the drop down list. Can you help me more Regards Kamal -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: 05 January 2004 16:01 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: selecting a value from drop down list Assuming you are using Struts to process the form submission, once the user selects a value from the drop down list and submits the form to be processed, the action which you have configured to handle this form submission, will have access to the selected value via the form configured to store the posted request information. Once inside your action you would do something like the following: MyForm myForm = (MyForm) form; String sName = myForm.getSname(); // update database with sName value robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 10:42 AM To: Struts Users Mailing List Subject: selecting a value from drop down list Hi, I have a drop down list in my jsp page the code is shown below td width=100bName/b/td td select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName //option /logic:iterate /select /td When I run this jsp page it displays a list of all names in a drop down list on the jsp page. What i want to do is User will select one of the names from the above select drop down list and i want to get that value from the jsp page and store it into the database. how should i get that value from the jsp page Please help me Regards Kamal - 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: selecting a value from drop down list
umm.. ehhh perhaps option value= could be why you get no value (in fact i suspect thats it).. The parameter will be whatever is in the value attribute, if you leave the value attribute out then it will default to the display string presented between the option tags.. On 5 Jan 2004, at 17:05, Kamal Gupta wrote: Hi, Thanks for your reply robert. I am using struts and in the action i am using request.getParameter(sname); for all other text boxes i get the value using request.getParamter(); but I dont get any value for the drop down list. Can you help me more Regards Kamal -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: 05 January 2004 16:01 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: selecting a value from drop down list Assuming you are using Struts to process the form submission, once the user selects a value from the drop down list and submits the form to be processed, the action which you have configured to handle this form submission, will have access to the selected value via the form configured to store the posted request information. Once inside your action you would do something like the following: MyForm myForm = (MyForm) form; String sName = myForm.getSname(); // update database with sName value robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 10:42 AM To: Struts Users Mailing List Subject: selecting a value from drop down list Hi, I have a drop down list in my jsp page the code is shown below td width=100bName/b/td td select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName //option /logic:iterate /select /td When I run this jsp page it displays a list of all names in a drop down list on the jsp page. What i want to do is User will select one of the names from the above select drop down list and i want to get that value from the jsp page and store it into the database. how should i get that value from the jsp page Please help me Regards Kamal - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FW: selecting a value from drop down list
-Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 11:43 AM To: [EMAIL PROTECTED] Subject: RE: selecting a value from drop down list Okay. I just saw something in your original post. select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName//option /logic:iterate /select You are not supplying any values in your option! Try this: select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName/bean:write name=results property =sName//option /logic:iterate /select You can also try using the Struts-html tags: html:select style=width:225px property=sName html:optionsCollection name=sNameSetup property=nameList label=sName value=sName/ /html:select robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 11:29 AM To: Robert Taylor Subject: RE: selecting a value from drop down list Hi, Thanks robert. I tried that but it doesnt return any values Regards Kamal -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: 05 January 2004 16:18 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: selecting a value from drop down list Try request.getParameter(sName); robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 11:06 AM To: Struts Users Mailing List Subject: RE: selecting a value from drop down list Hi, Thanks for your reply robert. I am using struts and in the action i am using request.getParameter(sname); for all other text boxes i get the value using request.getParamter(); but I dont get any value for the drop down list. Can you help me more Regards Kamal -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: 05 January 2004 16:01 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: selecting a value from drop down list Assuming you are using Struts to process the form submission, once the user selects a value from the drop down list and submits the form to be processed, the action which you have configured to handle this form submission, will have access to the selected value via the form configured to store the posted request information. Once inside your action you would do something like the following: MyForm myForm = (MyForm) form; String sName = myForm.getSname(); // update database with sName value robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 10:42 AM To: Struts Users Mailing List Subject: selecting a value from drop down list Hi, I have a drop down list in my jsp page the code is shown below td width=100bName/b/td td select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName //option /logic:iterate /select /td When I run this jsp page it displays a list of all names in a drop down list on the jsp page. What i want to do is User will select one of the names from the above select drop down list and i want to get that value from the jsp page and store it into the database. how should i get that value from the jsp page Please help me Regards Kamal - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: selecting a value from drop down list
Hi, Thanks for your reply Mark. I tried the option you suggested. but that thing gives me a null value Regards Kamal -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: 05 January 2004 16:23 To: Struts Users Mailing List Subject: Re: selecting a value from drop down list umm.. ehhh perhaps option value= could be why you get no value (in fact i suspect thats it).. The parameter will be whatever is in the value attribute, if you leave the value attribute out then it will default to the display string presented between the option tags.. On 5 Jan 2004, at 17:05, Kamal Gupta wrote: Hi, Thanks for your reply robert. I am using struts and in the action i am using request.getParameter(sname); for all other text boxes i get the value using request.getParamter(); but I dont get any value for the drop down list. Can you help me more Regards Kamal -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: 05 January 2004 16:01 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: selecting a value from drop down list Assuming you are using Struts to process the form submission, once the user selects a value from the drop down list and submits the form to be processed, the action which you have configured to handle this form submission, will have access to the selected value via the form configured to store the posted request information. Once inside your action you would do something like the following: MyForm myForm = (MyForm) form; String sName = myForm.getSname(); // update database with sName value robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 10:42 AM To: Struts Users Mailing List Subject: selecting a value from drop down list Hi, I have a drop down list in my jsp page the code is shown below td width=100bName/b/td td select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName //option /logic:iterate /select /td When I run this jsp page it displays a list of all names in a drop down list on the jsp page. What i want to do is User will select one of the names from the above select drop down list and i want to get that value from the jsp page and store it into the database. how should i get that value from the jsp page Please help me Regards Kamal - 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] - 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: selecting a value from drop down list
Hi, It works now. It was just that the value was in double quotes and as its a string it already has double quotes So i changed the option value from option value=bean:write name=results property =pnDescription /bean:write name=results property =pnDescription / to option value=bean:write name=results property =pnDescription /bean:write name=results property =pnDescription //option Thanks Mark and Robert Regards Kamal Gupta -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: 05 January 2004 16:23 To: Struts Users Mailing List Subject: Re: selecting a value from drop down list umm.. ehhh perhaps option value= could be why you get no value (in fact i suspect thats it).. The parameter will be whatever is in the value attribute, if you leave the value attribute out then it will default to the display string presented between the option tags.. On 5 Jan 2004, at 17:05, Kamal Gupta wrote: Hi, Thanks for your reply robert. I am using struts and in the action i am using request.getParameter(sname); for all other text boxes i get the value using request.getParamter(); but I dont get any value for the drop down list. Can you help me more Regards Kamal -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: 05 January 2004 16:01 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: selecting a value from drop down list Assuming you are using Struts to process the form submission, once the user selects a value from the drop down list and submits the form to be processed, the action which you have configured to handle this form submission, will have access to the selected value via the form configured to store the posted request information. Once inside your action you would do something like the following: MyForm myForm = (MyForm) form; String sName = myForm.getSname(); // update database with sName value robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 10:42 AM To: Struts Users Mailing List Subject: selecting a value from drop down list Hi, I have a drop down list in my jsp page the code is shown below td width=100bName/b/td td select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName //option /logic:iterate /select /td When I run this jsp page it displays a list of all names in a drop down list on the jsp page. What i want to do is User will select one of the names from the above select drop down list and i want to get that value from the jsp page and store it into the database. how should i get that value from the jsp page Please help me Regards Kamal - 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] - 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: selecting a value from drop down list
Try request.getParameter(sName); robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 11:06 AM To: Struts Users Mailing List Subject: RE: selecting a value from drop down list Hi, Thanks for your reply robert. I am using struts and in the action i am using request.getParameter(sname); for all other text boxes i get the value using request.getParamter(); but I dont get any value for the drop down list. Can you help me more Regards Kamal -Original Message- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: 05 January 2004 16:01 To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: RE: selecting a value from drop down list Assuming you are using Struts to process the form submission, once the user selects a value from the drop down list and submits the form to be processed, the action which you have configured to handle this form submission, will have access to the selected value via the form configured to store the posted request information. Once inside your action you would do something like the following: MyForm myForm = (MyForm) form; String sName = myForm.getSname(); // update database with sName value robert -Original Message- From: Kamal Gupta [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 10:42 AM To: Struts Users Mailing List Subject: selecting a value from drop down list Hi, I have a drop down list in my jsp page the code is shown below td width=100bName/b/td td select name=sName style=width:225px logic:iterate id=results name=sNameSetup property=nameList scope=session option value=bean:write name=results property =sName //option /logic:iterate /select /td When I run this jsp page it displays a list of all names in a drop down list on the jsp page. What i want to do is User will select one of the names from the above select drop down list and i want to get that value from the jsp page and store it into the database. how should i get that value from the jsp page Please help me Regards Kamal - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with Java 1.4 and BeanUtils and maybe PropertyUtils...
Hello, I will do my best to explain what's going on and hopefully someone can help me out. If more information is needed, please let me know. Here is the situation. We're upgrading our servers to user java 1.4.1. We were previously running 1.3 A few of our web pages loop through collections and the user can modify something in the collection then save the changes. In 1.3 everything worked fine, no problems. However, when I switched to 1.4.1 (and tried 1.4.2) we started getting this error. I've tracked it down to this line in the PropertyUtils.java class: --- if(descriptor instanceof IndexedPropertyDescriptor) --- In 1.3 this was true. In 1.4 this returns false, and things go downhill from there. Please, any help would be terrific. Thank you. Code snippets error are below: .jsp page w/code: % int counter = 0; % logic:iterate id=day name=manualadjemplform property=employeeWorkDay bean:define id=idWorkDay name=day property=workDay type=java.lang.String/ bean:define id=idCases name=day property=cases type=java.lang.String/ bean:define id=idManualAdjId name=day property=manualAdjId type=java.lang.String/ % String baseProperty = employeeWorkDay[ + (counter++) + ]; String workDayProperty = baseProperty + .workDay; String commentProperty = baseProperty + .comment; String manualAdjIdProperty = baseProperty + .manualAdjId; % tr td align=left nowrap bean:write name=day property=workDay/ html:hidden name=day property=%=workDayProperty% value=%=idWorkDay.toString()% bean:write name=day property=workDay/ /html:hidden /td td align=left nowrap html:text name=day property=%=casesProperty% value=%=idCases.toString()% size=6 maxlength=6 logic:present name=day property=cases bean:write name=day property=cases/ /logic:present logic:notPresent name=day property=cases nbsp /logic:notPresent /html:text /td html:hidden name=day property=%=manualAdjIdProperty% value=%=idManualAdjId.toString()% bean:write name=day property=manualAdjId/ /html:hidden /tr /logic:iterate .jsp page rendered: tr td align=left nowrap Sunday input type=hidden name=employeeWorkDay[0].workDay value=Sunday /td td align=left nowrap input type=text name=employeeWorkDay[0].cases maxlength=6 size=6 value=25 /td input type=hidden name=employeeWorkDay[0].manualAdjId value=2203.0 /tr tr td align=left nowrap Monday input type=hidden name=employeeWorkDay[1].workDay value=Monday /td td align=left nowrap input type=text name=employeeWorkDay[1].cases maxlength=6 size=6 value= /td input type=hidden name=employeeWorkDay[1].manualAdjId value= /tr FormBean: public class ManualAdjustmentEmployeeFormBean extends FormBean { private List employeeWorkDay= new ArrayList(); public void reset() { this.employeeWorkDay = new ArrayList(); } public List getEmployeeWorkDay() { return employeeWorkDay; } public void setEmployeeWorkDay(List employeeWorkDay) { this.employeeWorkDay = employeeWorkDay; } public ManualAdjustmentEmployeeVO getEmployeeWorkDay(int index) { while(index =this.employeeWorkDay.size() ){ this.employeeWorkDay.add(new ManualAdjustmentEmployeeVO()); } return (ManualAdjustmentEmployeeVO) this.employeeWorkDay.get(index); } } Error: javax.servlet.ServletException: BeanUtils.populate - Root Cause - java.lang.IndexOutOfBoundsException: Index: 1, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:507) at java.util.ArrayList.get(ArrayList.java:324) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:586) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:474) at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:883) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:917) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1005) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:919) at com.ciber.arch.util.RequestUtils.populate(RequestUtils.java:513) at com.ciber.arch.web.ArchServlet.process(ArchServlet.java:190) at com.ciber.arch.web.ArchServlet.doPost(ArchServlet.java:64) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at
Re: Problem with Java 1.4 and BeanUtils and maybe PropertyUtils...
I haven't had any of these sorts of problems even when moving struts app from 1.3 to 1.4 (i generally just follow what apple provide on osx and then just match it on linux for live servers and such like. What i can tell you though it that I've used c:set .. in the same way as you're using bean define and works just great. c:set var=idWorkDay value=${day.workDay} / I tend to keep this sort of thing out of my jsp's, but looking at the way you seem to code jsp I think you'd really like jstl. And it defiantly works with 1.4. Hope this helps Mark On 5 Jan 2004, at 18:37, Brad Harris wrote: Hello, I will do my best to explain what's going on and hopefully someone can help me out. If more information is needed, please let me know. Here is the situation. We're upgrading our servers to user java 1.4.1. We were previously running 1.3 A few of our web pages loop through collections and the user can modify something in the collection then save the changes. In 1.3 everything worked fine, no problems. However, when I switched to 1.4.1 (and tried 1.4.2) we started getting this error. I've tracked it down to this line in the PropertyUtils.java class: --- if(descriptor instanceof IndexedPropertyDescriptor) --- In 1.3 this was true. In 1.4 this returns false, and things go downhill from there. Please, any help would be terrific. Thank you. Code snippets error are below: .jsp page w/code: % int counter = 0; % logic:iterate id=day name=manualadjemplform property=employeeWorkDay bean:define id=idWorkDay name=day property=workDay type=java.lang.String/ bean:define id=idCases name=day property=cases type=java.lang.String/ bean:define id=idManualAdjId name=day property=manualAdjId type=java.lang.String/ % String baseProperty = employeeWorkDay[ + (counter++) + ]; String workDayProperty = baseProperty + .workDay; String commentProperty = baseProperty + .comment; String manualAdjIdProperty = baseProperty + .manualAdjId; % tr td align=left nowrap bean:write name=day property=workDay/ html:hidden name=day property=%=workDayProperty% value=%=idWorkDay.toString()% bean:write name=day property=workDay/ /html:hidden /td td align=left nowrap html:text name=day property=%=casesProperty% value=%=idCases.toString()% size=6 maxlength=6 logic:present name=day property=cases bean:write name=day property=cases/ /logic:present logic:notPresent name=day property=cases nbsp /logic:notPresent /html:text /td html:hidden name=day property=%=manualAdjIdProperty% value=%=idManualAdjId.toString()% bean:write name=day property=manualAdjId/ /html:hidden /tr /logic:iterate .jsp page rendered: tr td align=left nowrap Sunday input type=hidden name=employeeWorkDay[0].workDay value=Sunday /td td align=left nowrap input type=text name=employeeWorkDay[0].cases maxlength=6 size=6 value=25 /td input type=hidden name=employeeWorkDay[0].manualAdjId value=2203.0 /tr tr td align=left nowrap Monday input type=hidden name=employeeWorkDay[1].workDay value=Monday /td td align=left nowrap input type=text name=employeeWorkDay[1].cases maxlength=6 size=6 value= /td input type=hidden name=employeeWorkDay[1].manualAdjId value= /tr FormBean: public class ManualAdjustmentEmployeeFormBean extends FormBean { private List employeeWorkDay= new ArrayList(); public void reset() { this.employeeWorkDay = new ArrayList(); } public List getEmployeeWorkDay() { return employeeWorkDay; } public void setEmployeeWorkDay(List employeeWorkDay) { this.employeeWorkDay = employeeWorkDay; } public ManualAdjustmentEmployeeVO getEmployeeWorkDay(int index) { while(index =this.employeeWorkDay.size() ){ this.employeeWorkDay.add(new ManualAdjustmentEmployeeVO()); } return (ManualAdjustmentEmployeeVO) this.employeeWorkDay.get(index); } } Error: javax.servlet.ServletException: BeanUtils.populate - Root Cause - java.lang.IndexOutOfBoundsException: Index: 1, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:507) at java.util.ArrayList.get(ArrayList.java:324) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyU tils.java:586) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyU tils.java:474) at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUt ils.java:883) at
Adding items to a vector of formbean in the jsp
Struters, I need help from somebody. I have a formbean that has a vector property, and my jsp has a iterator that renderizes this: input type=hidden name=userList[0].id value=1 id=id0 input type=hidden name=userList[0].name value=paul id=name0 input type=hidden name=userList[1].id value=2 id=id1 input type=hidden name=userList[1].name value=john id=name1 If i change the value of any of these inputs and submit the page, the requestprocessor parse and update the values of the vector in the formbean correctly. But if i, dinamicly with dom, create new inputs increasing the index (like in the example below) and submit the page, i get a exception of Beans.populate(), a out of ranger error. newInput = document.createElement(input); newInput.type = hidden; newInput.name = userList[2].id; newInput.id = id2; myHmtlBody.appendChild(inp); document.getElementById(id2).value = 3; newInput = document.createElement(input); newInput.type = hidden; newInput.name = userList[2].name; newInput.id = name2; myHmtlBody.appendChild(inp); document.getElementById(name2).value = peter; What i really want is that, when i submit the page, the requestprocessor add a new item in the vector and set the values of the new item with the values of the new inputs. Anybody have any thing to say or suggest, any idea? thanks, Paulo
RE: Adding items to a vector of formbean in the jsp
Look at ListUtils.lazyList() http://jakarta.apache.org/commons/collections/api/org/apache/commons/collect ions/ListUtils.html#lazyList(java.util.List,%20org.apache.commons.collection s.Factory) robert -Original Message- From: Paulo Rezende [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 1:03 PM To: Struts Users Mailing List Subject: Adding items to a vector of formbean in the jsp Struters, I need help from somebody. I have a formbean that has a vector property, and my jsp has a iterator that renderizes this: input type=hidden name=userList[0].id value=1 id=id0 input type=hidden name=userList[0].name value=paul id=name0 input type=hidden name=userList[1].id value=2 id=id1 input type=hidden name=userList[1].name value=john id=name1 If i change the value of any of these inputs and submit the page, the requestprocessor parse and update the values of the vector in the formbean correctly. But if i, dinamicly with dom, create new inputs increasing the index (like in the example below) and submit the page, i get a exception of Beans.populate(), a out of ranger error. newInput = document.createElement(input); newInput.type = hidden; newInput.name = userList[2].id; newInput.id = id2; myHmtlBody.appendChild(inp); document.getElementById(id2).value = 3; newInput = document.createElement(input); newInput.type = hidden; newInput.name = userList[2].name; newInput.id = name2; myHmtlBody.appendChild(inp); document.getElementById(name2).value = peter; What i really want is that, when i submit the page, the requestprocessor add a new item in the vector and set the values of the new item with the values of the new inputs. Anybody have any thing to say or suggest, any idea? thanks, Paulo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Adding items to a vector of formbean in the jsp
Paulo, The problem is that Vectors or Arrays are not created and sized for you automatically. When your form is submitted, the populate() method attempts to set the Vector element of new element which is beyond the size of your vector. To fix this problem, you can either size the Vector with empty slots in your action before you display the form or use a LazyList (search the archives for LazyList) Regards, Richard -Original Message- From: Paulo Rezende [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 10:03 AM To: Struts Users Mailing List Subject: Adding items to a vector of formbean in the jsp Struters, I need help from somebody. I have a formbean that has a vector property, and my jsp has a iterator that renderizes this: input type=hidden name=userList[0].id value=1 id=id0 input type=hidden name=userList[0].name value=paul id=name0 input type=hidden name=userList[1].id value=2 id=id1 input type=hidden name=userList[1].name value=john id=name1 If i change the value of any of these inputs and submit the page, the requestprocessor parse and update the values of the vector in the formbean correctly. But if i, dinamicly with dom, create new inputs increasing the index (like in the example below) and submit the page, i get a exception of Beans.populate(), a out of ranger error. newInput = document.createElement(input); newInput.type = hidden; newInput.name = userList[2].id; newInput.id = id2; myHmtlBody.appendChild(inp); document.getElementById(id2).value = 3; newInput = document.createElement(input); newInput.type = hidden; newInput.name = userList[2].name; newInput.id = name2; myHmtlBody.appendChild(inp); document.getElementById(name2).value = peter; What i really want is that, when i submit the page, the requestprocessor add a new item in the vector and set the values of the new item with the values of the new inputs. Anybody have any thing to say or suggest, any idea? thanks, Paulo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: FormFile NULL when uploading large file
A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglass Adams | __ |\\ .. || 0 0|| | . . Edward Patterson (President) . . ||J || | . . Milwaukee Computer Club (MCC) . . || [___] || | . . Quantum Tech Design, inc. . . ||__|| | . . Milwaukee, WI 53206. . | __ | | . . 414-933-7823 . . | __ | | . . [EMAIL PROTECTED] . . | __ | | . .. . ||/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . From: Matthias Wessendorf [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: FormFile NULL when uploading large file Date: Sat, 3 Jan 2004 00:16:41 +0100 Hi, the default size in Class org.apache.struts.config.ControllerConfig is: /** * The maximum file size to process for file uploads. */ protected String maxFileSize = 250M; perhaps in struts-config this will help: controller maxFileSize=2G / greetings matthias -Original Message- From: Ling Wu [mailto:[EMAIL PROTECTED] Sent: Friday, January 02, 2004 7:44 PM To: [EMAIL PROTECTED] Subject: FormFile NULL when uploading large file Hi, I have a problem when uploading large file using FormFile. It works fine with modest sized file. But when the file size goes to 1GB, the FormFile returned from PropertyUtils.getSimpleProperty(...) is null. Does anyone know the reason behind this? Is there any file size limit with FormFile? Thanks. Ling __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ - 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] _ Check your PC for viruses with the FREE McAfee online computer scan. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with Java 1.4 and BeanUtils and maybe PropertyUtils...
Well, oddly enough, when I changed: private List employeeWorkDay= new ArrayList(); to: private ArrayList employeeWorkDay= new ArrayList(); in my FormBean, it worked. It appears that List was the problem. Very odd. Thank you! From: Mark Lowe [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Problem with Java 1.4 and BeanUtils and maybe PropertyUtils... Date: Mon, 5 Jan 2004 18:51:31 +0100 I haven't had any of these sorts of problems even when moving struts app from 1.3 to 1.4 (i generally just follow what apple provide on osx and then just match it on linux for live servers and such like. What i can tell you though it that I've used c:set .. in the same way as you're using bean define and works just great. c:set var=idWorkDay value=${day.workDay} / I tend to keep this sort of thing out of my jsp's, but looking at the way you seem to code jsp I think you'd really like jstl. And it defiantly works with 1.4. Hope this helps Mark On 5 Jan 2004, at 18:37, Brad Harris wrote: Hello, I will do my best to explain what's going on and hopefully someone can help me out. If more information is needed, please let me know. Here is the situation. We're upgrading our servers to user java 1.4.1. We were previously running 1.3 A few of our web pages loop through collections and the user can modify something in the collection then save the changes. In 1.3 everything worked fine, no problems. However, when I switched to 1.4.1 (and tried 1.4.2) we started getting this error. I've tracked it down to this line in the PropertyUtils.java class: --- if(descriptor instanceof IndexedPropertyDescriptor) --- In 1.3 this was true. In 1.4 this returns false, and things go downhill from there. Please, any help would be terrific. Thank you. Code snippets error are below: .jsp page w/code: % int counter = 0; % logic:iterate id=day name=manualadjemplform property=employeeWorkDay bean:define id=idWorkDay name=day property=workDay type=java.lang.String/ bean:define id=idCases name=day property=cases type=java.lang.String/ bean:define id=idManualAdjId name=day property=manualAdjId type=java.lang.String/ % String baseProperty = employeeWorkDay[ + (counter++) + ]; String workDayProperty = baseProperty + .workDay; String commentProperty = baseProperty + .comment; String manualAdjIdProperty = baseProperty + .manualAdjId; % tr td align=left nowrap bean:write name=day property=workDay/ html:hidden name=day property=%=workDayProperty% value=%=idWorkDay.toString()% bean:write name=day property=workDay/ /html:hidden /td td align=left nowrap html:text name=day property=%=casesProperty% value=%=idCases.toString()% size=6 maxlength=6 logic:present name=day property=cases bean:write name=day property=cases/ /logic:present logic:notPresent name=day property=cases nbsp /logic:notPresent /html:text /td html:hidden name=day property=%=manualAdjIdProperty% value=%=idManualAdjId.toString()% bean:write name=day property=manualAdjId/ /html:hidden /tr /logic:iterate .jsp page rendered: tr td align=left nowrap Sunday input type=hidden name=employeeWorkDay[0].workDay value=Sunday /td td align=left nowrap input type=text name=employeeWorkDay[0].cases maxlength=6 size=6 value=25 /td input type=hidden name=employeeWorkDay[0].manualAdjId value=2203.0 /tr tr td align=left nowrap Monday input type=hidden name=employeeWorkDay[1].workDay value=Monday /td td align=left nowrap input type=text name=employeeWorkDay[1].cases maxlength=6 size=6 value= /td input type=hidden name=employeeWorkDay[1].manualAdjId value= /tr FormBean: public class ManualAdjustmentEmployeeFormBean extends FormBean { private List employeeWorkDay= new ArrayList(); public void reset() { this.employeeWorkDay = new ArrayList(); } public List getEmployeeWorkDay() { return employeeWorkDay; } public void setEmployeeWorkDay(List employeeWorkDay) { this.employeeWorkDay = employeeWorkDay; } public ManualAdjustmentEmployeeVO getEmployeeWorkDay(int index) { while(index =this.employeeWorkDay.size() ){ this.employeeWorkDay.add(new ManualAdjustmentEmployeeVO()); } return (ManualAdjustmentEmployeeVO) this.employeeWorkDay.get(index); } } Error: javax.servlet.ServletException: BeanUtils.populate -
struts help using logic:iterate
I'm very new to struts so please be kindly. I have two Arraylist call itemList and errorCodeList. The itemList contains list of Item object. The item object has a property calls errorCode which returns an error code in int (1-50). I want to display the error description associates to that error code. How can I pass in the error code to the errorCodeList the get the error description. Item Error Description - item1description1 item2description2 item3description1 .. ..
weird
please, i got a weird problem with struts. I haven't done anything different from what i do hundres of times a day: edit something in an Action or FormAction file, change small things in a jsp...ant build, shutdown, startup...well, no matter what i do, it has never given me any problem. But sundenly all the browser returns to me is a tomcat erros messagem like this: java.lang.NullPointerException at org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:521) at org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:436) at org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:396) at org.apache.struts.taglib.logic.RedirectTag.doEndTag(RedirectTag.java:294) at org.apache.jsp.admin_jsp._jspx_meth_logic_redirect_0(admin_jsp.java:153) at org.apache.jsp.admin_jsp._jspx_meth_logic_empty_0(admin_jsp.java:130) at org.apache.jsp.admin_jsp._jspService(admin_jsp.java:86) this message comes from a page where i have a logic:empty tag. it used to work just as i expected. but even the logon page does not work. it has nothing more than two fields and.. well, the last time i touched this page was one week ago. it does not work any more ;( This is the error i get when trying to access the logon page: org.apache.jasper.JasperException: Cannot find ActionMappings or ActionFormBeans collection at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) I've already checked if any file is missing...but everything is there. just like 5 minutes ago, when everything was working fine. What may be the problem?? Please, if someone can help me, do it. If i don't solve this, i'll be stuck in my tasks. Otávio Augusto - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: weird
It looks to me like in your admin.jsp file you have something like logic:empty logic:redirect /logic:redirect /logic:empty Something is wrong with your redirect tag.. make sure you are giving it the correct parameters that are required etc... when all else fails use a debugger and find out where exactly the null pointer exception is coming from in the code. -David - Original Message - From: Otávio Augusto [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 05, 2004 3:03 PM Subject: weird please, i got a weird problem with struts. I haven't done anything different from what i do hundres of times a day: edit something in an Action or FormAction file, change small things in a jsp...ant build, shutdown, startup...well, no matter what i do, it has never given me any problem. But sundenly all the browser returns to me is a tomcat erros messagem like this: java.lang.NullPointerException at org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:521) at org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:436) at org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:396) at org.apache.struts.taglib.logic.RedirectTag.doEndTag(RedirectTag.java:294) at org.apache.jsp.admin_jsp._jspx_meth_logic_redirect_0(admin_jsp.java:153) at org.apache.jsp.admin_jsp._jspx_meth_logic_empty_0(admin_jsp.java:130) at org.apache.jsp.admin_jsp._jspService(admin_jsp.java:86) this message comes from a page where i have a logic:empty tag. it used to work just as i expected. but even the logon page does not work. it has nothing more than two fields and.. well, the last time i touched this page was one week ago. it does not work any more ;( This is the error i get when trying to access the logon page: org.apache.jasper.JasperException: Cannot find ActionMappings or ActionFormBeans collection at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2 54) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) I've already checked if any file is missing...but everything is there. just like 5 minutes ago, when everything was working fine. What may be the problem?? Please, if someone can help me, do it. If i don't solve this, i'll be stuck in my tasks. Otávio Augusto - 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]
Link Tag
Hi, I am using a custom link tag that extenjds the struts LinkTag. I am using the custom tag in my jsp in the following way: dtag:dlink href=dcsi/logoff.do showAlways=trueLogout/dtag:dlink I have the following entry in my struts-config.xml file: action path=dcsi/logoff.do type=com.dcsi.LogoffAction roles=role1 forward name=logout path=/login.jsp/ /action However, the link that gets formed is: http://10.48.142.7:8988/dcsi/dcsi/logoff.do which is an invalid link. Can you please point out what I'm doing incorrectly here? What is the entry required in the struts-config.xml file? Thanks, Sanjay This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Link Tag
if the link you are looking for is ... http://10.48.142.7:8988/dcsi/logoff.do try dropping off the dcsi prefix in the path=dcsi/logoff.do - Original Message - From: Duggal, Sanjay [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, January 05, 2004 8:49 AM Subject: Link Tag Hi, I am using a custom link tag that extenjds the struts LinkTag. I am using the custom tag in my jsp in the following way: dtag:dlink href=dcsi/logoff.do showAlways=trueLogout/dtag:dlink I have the following entry in my struts-config.xml file: action path=dcsi/logoff.do type=com.dcsi.LogoffAction roles=role1 forward name=logout path=/login.jsp/ /action However, the link that gets formed is: http://10.48.142.7:8988/dcsi/dcsi/logoff.do which is an invalid link. Can you please point out what I'm doing incorrectly here? What is the entry required in the struts-config.xml file? Thanks, Sanjay This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - 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]
split table
Hi all is it posible to split table with struts or jstl ? thank's for your opinion
Re: split table
On Tuesday 06 January 2004 12:21, Hari_s wrote: is it posible to split table with struts or jstl ? What do you mean by split table - two tables separated at some abitory point in the data ? -- Regards, Derek Clarkson .O. Analyst/Programmer ..O Waterwerks Pty Ltd OOO Melbourne, Australia - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Link Tag
Struts automatically append the 'CONTEXT' for you in preparing the link url. So use it with care. I had this problem before. For example, when the tile (I'm not sure if you're using tile, but it's my case) belongs to the root context (), and you want to link to a page in another context, say 'dcsi', then you need the '/dcsi/logoff.do', But in the body tile, I suppose it's already in the dcsi context, you only need to link to '/logoff.do'. Patrick -Original Message- From: Mike Deegan [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 06, 2004 8:13 AM To: Struts Users Mailing List Subject: Re: Link Tag if the link you are looking for is ... http://10.48.142.7:8988/dcsi/logoff.do try dropping off the dcsi prefix in the path=dcsi/logoff.do - Original Message - From: Duggal, Sanjay [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, January 05, 2004 8:49 AM Subject: Link Tag Hi, I am using a custom link tag that extenjds the struts LinkTag. I am using the custom tag in my jsp in the following way: dtag:dlink href=dcsi/logoff.do showAlways=trueLogout/dtag:dlink I have the following entry in my struts-config.xml file: action path=dcsi/logoff.do type=com.dcsi.LogoffAction roles=role1 forward name=logout path=/login.jsp/ /action However, the link that gets formed is: http://10.48.142.7:8988/dcsi/dcsi/logoff.do which is an invalid link. Can you please point out what I'm doing incorrectly here? What is the entry required in the struts-config.xml file? Thanks, Sanjay This message contains information that may be privileged or confidential and is the property of the Cap Gemini Ernst Young Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - 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]
Doubts about FacesRequestProcessor on struts-faces
Ok, I suppose this is a direct question to Craig as the maintainer ofstruts-faces:I'm studying JSF and I need to integrate a Struts application with it,so I am studying struts-faces too. My problem is that this applicationuses a custom RequestProcessor that implements the ProcessingFilterpattern and in the *KNOWN LIMITATIONS* of struts-faces it says that Ihave to subclass FacesRequestProcessor (I'm not using Tiles). Thequestion is: ¿this behaviour is planned to be stable? ¿will I have tochange the implementation later? I will also be grateful for some adviceon how to do it.Thanks in advance. -- Diego Louzán Martínez - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts help using logic:iterate
If you make your Item class returns an Error object, you can avoid the errorCodeList, something like this: public class Item { private int id=0; private MyError error; /** * @return Returns the error. */ public MyError getError() { return error; } /** * @param error The error to set. */ public void setError(MyError error) { this.error = error; } /** * @return Returns the id. */ public int getId() { return id; } /** * @param id The id to set. */ public void setId(int id) { this.id = id; } /** * @param id */ public Item(int id) { super(); this.id = id; } } assume that you have MyError class defined as a JavaBean with two properties errorCode (int) and errorString (String). in your jsp: % java.util.Collection itemList = new java.util.ArrayList(); hqn.Item item1 = new hqn.Item(1); item1.setError( new hqn.MyError(1, Error Description 1) ); itemList.add( item1 ); hqn.Item item2 = new hqn.Item(2); item2.setError( new hqn.MyError(2, Error Description 2) ); request.setAttribute(itemList, itemList ); % Using JSTL forEach tag: c:forEach items=${itemList} var=item Item ID= c:out value=${item.id}/BR Error Code: c:out value=${item.error.errorCode}/BR Error Desc: c:out value=${item.error.errorString}/BR /c:forEach Using logic:iterate tag: logic:iterate id=item name=itemList Item Id= bean:write name=item property=id/BR bean:define id=error name=item property=error/ Error Code: bean:write name=error property=errorCode/BR Error Desc: bean:write name=error property=errorString/BR /logic:iterate I'd recommend you to use JSTL. --hqn On Jan 5, 2004, at 4:39 PM, ngonqua wrote: I'm very new to struts so please be kindly. I have two Arraylist call itemList and errorCodeList. The itemList contains list of Item object. The item object has a property calls errorCode which returns an error code in int (1-50). I want to display the error description associates to that error code. How can I pass in the error code to the errorCodeList the get the error description. Item Error Description - item1description1 item2description2 item3description1 .. ..
Re: split table
thank for your response derek... I mean it's split table into separate page, i have 100 data and i want display 10 data every pages... - Original Message - From: Derek Clarkson [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, January 06, 2004 8:27 AM Subject: Re: split table On Tuesday 06 January 2004 12:21, Hari_s wrote: is it posible to split table with struts or jstl ? What do you mean by split table - two tables separated at some abitory point in the data ? -- Regards, Derek Clarkson .O. Analyst/Programmer ..O Waterwerks Pty Ltd OOO Melbourne, Australia - 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: Doubts about FacesRequestProcessor on struts-faces
Quoting Diego Louzán Martínez [EMAIL PROTECTED]: Ok, I suppose this is a direct question to Craig as the maintainer ofstruts-faces:I'm studying JSF and I need to integrate a Struts application with it,so I am studying struts-faces too. My problem is that this applicationuses a custom RequestProcessor that implements the ProcessingFilterpattern and in the *KNOWN LIMITATIONS* of struts-faces it says that Ihave to subclass FacesRequestProcessor (I'm not using Tiles). Thequestion is: ¿this behaviour is planned to be stable? ¿will I have tochange the implementation later? I will also be grateful for some adviceon how to do it.Thanks in advance. -- For use with Struts 1.1, this behavior is indeed planned to be stable -- you should plan on subclassing FacesRequestProcessor (if you're not using Tiles) or FacesTilesRequestProcessor (if you are). As of the latest nightly builds of the struts-faces library, you specify your overridden class name in the usual way (with the controller element in struts-config.xml). At some point during the development of Struts 1.2 and 2.0, we'll switch our primary approach to something like commons-chain (see this package in the Jakarta Commons Sandbox, and the source code in the contrib/struts-chain directory of the Struts source archive, to get a feel for where we're going). At that point, you will be able to configure and customize your own processing chains based on the combination of technologies that you are using, without having to explicitly subclass a monolithic RequestProcessor base class. In terms of mechanics, it's really no different than subclassing the standard RequestProcessor -- simply create a class that extends the base one, and override the methods you need to change. You'll need struts-faces.jar on your compile classpath, of course. Diego Louzán Martínez Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: split table
On Tuesday 06 January 2004 16:50, Hari_s wrote: I mean it's split table into separate page, i have 100 data and i want display 10 data every pages... Ok, kool. I had a similar thing that I wanted to do. I wanted to be able to determine odd or event numbered rows in a table so I could alternate the background colour like old fashioned printouts. I decided to do it as custom tags. Look up your J2EE tutorials for creating these. http://java.sun.com/j2ee/1.4/docs/tutorial/doc/ I ended up with 4 custom tags: counterReset - creates the counter variable in the page context set to 0. counterIncrement - adds 1 to the variable. counterNumber - outputs the current value. counterEvenOrOdd - Outputs the strings Odd or Even Each tag has 1 required parameter called var which is the name of the variable in the page context to be used. By specifying a variable name (same as other struts tags do) I was able to run more than one counter when necessary. Writing these tags was simplicity itself once I got the hang of it. If you go this way you will find you can do all sorts of wizzo things with them. For example: mytags:counterReset var=counter / c:forEach mytags:counterIncrement var=counter / c:if test=${counter == 10} ... /c:if /c:forEach If you do this you can just add /tabletable tags inside the if statements to achieve the break up of your data. I used the odd or event tag inside class values on table cells so that the CSS classes Odd or Even where applied to the cells. -- Regards, Derek Clarkson .O. Analyst/Programmer ..O Waterwerks Pty Ltd OOO Melbourne, Australia - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Warning: Page has Expired
Thanks for the reply. I tried this but no luck. Actually my web form contains some form fields plus a file upload element. Some thing similar to online resume submission. So I have to POST method inorder to achieve the result. -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 5:49 PM To: Struts Users Mailing List Subject: Re: Warning: Page has Expired Did you try to turn off expire? e.g. % response.setDateHeader (Expires, 0); response.setHeader(Pragma, no-cache); response.setHeader(Cache-Control, no-store); response.setDateHeader(max-age, 0); response.setDateHeader(Expires, 0); % Regards, Martin - Original Message - From: Manjunath Bhat [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, January 05, 2004 6:55 AM Subject: Warning: Page has Expired Hi I have a page which calls an action. Depending on certain condition I will forward it to suitable pages. After this steps if user clicks the Browser's back button, it gives typical browser error Warning: Page has Expired (I am using IE). This happens especially after the validation failure. How to overcome this problem? I don't want to use GET method in html:form/ Thanks in advance M Bhat - 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]