AW: Struts and HttpUnit
download httpunit; try the examples; there is no difference between struts generated frontend or not struts generated. you will need the jtidy too, to parse the html files (response). with httpunit you can test the functionality from websites -named black box tests. the interessting thing with httpunit woud be, when you connect them with ant and do them continous as a cron job. you can then create then xml logs with ant .. juraj -Ursprüngliche Nachricht- Von: Matt Raible [mailto:[EMAIL PROTECTED]] Gesendet: Freitag, 24. August 2001 00:07 An: [EMAIL PROTECTED] Betreff: Struts and HttpUnit Has anyone used HttpUnit to test their struts application? I'd be willing to help compose a bunch of tests for the struts-example if someone can point me in the right direction. Matt __ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
Problem with org.apache.struts.taglib.form and VAJ3.5.3 and WTE
Sarica GRATUITAMENTE MSN Explorer all'indirizzo http://explorer.msn.com
template tags
I put a special header and footer on all my pages. I'd like to do this with the template tags. Template tags allow you to pass named parameters to the template. However, I need to pass a list of things (navigation URLs) into my header so it can print a list of hyperlinks. It doesn't seem possible to pass a list of items with the template tags. Can anyone suggest anything? Devon
R: Index within iterate tags
Hi, ... I don't understand you answer ... :-o how can you get the indexId value? What is somevalue? Suppose you have: !--The property getTitoliStudio of class Curriculum return a Vector-- logic:iterate id=iterateId property=titoliStudio name=curriculum html:form action=/addTitoloStudio bean: !- I'd like to have the iterator index in an hidden field-- html:text property=myProperty/ html:submit property=addTitoloStudio value=Aggiungi/ /html /logic How can I put the iterator index in an hidden field in the form? Thank you -Messaggio originale- Da: Assenza, Chris [mailto:[EMAIL PROTECTED]] Inviato: martedì 14 agosto 2001 18.47 A: '[EMAIL PROTECTED]' Oggetto: RE: Index within iterate tags When you write your iterator tag add the attribute: indexId=somevalue Then you can use the bean tags to access indexId which returns the current index of the iterator! :-) -Chris Christopher Assenza Phone: 412.201.6026 Fax: 412.201.6060 Email: [EMAIL PROTECTED] ACCESSDATA Moving Your Business from Point A to Point e.SM http://www.accessdc.com/ -Original Message- From: Nicola Taylor [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 14, 2001 12:00 PM To: Struts-User (E-mail) Subject: Index within iterate tags Hi, were using the indexed properties tags and it'd be useful to know the current index in the jsp (to do some javascript stuff). Is there any standard way to access the current index in the iterator? 1) write a custom tag to return: IterateTag iterateTag = (IterateTag) findAncestorWithClass(this, IterateTag.class); iterateTag.getIndex(); 2) have a counter variable that we increment within the iterate loop. Cheers ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **
RE: Index within iterate tags
What Chris want to say is to use the indexId attribute like this : !--The property getTitoliStudio of class Curriculum return a Vector-- logic:iterate id=iterateId property=titoliStudio name=curriculum indexId=myId html:form action=/addTitoloStudio .. bean:write name=myId scope=page/ ... html:text property=myProperty/ html:submit property=addTitoloStudio value=Aggiungi/ /html /logic arno -Message d'origine- De: Paolo Balzarotti [SMTP:[EMAIL PROTECTED]] Date: vendredi 24 aout 2001 10:55 A: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Objet: R: Index within iterate tags Hi, ... I don't understand you answer ... :-o how can you get the indexId value? What is somevalue? Suppose you have: !--The property getTitoliStudio of class Curriculum return a Vector-- logic:iterate id=iterateId property=titoliStudio name=curriculum html:form action=/addTitoloStudio bean: !- I'd like to have the iterator index in an hidden field-- html:text property=myProperty/ html:submit property=addTitoloStudio value=Aggiungi/ /html /logic How can I put the iterator index in an hidden field in the form? Thank you -Messaggio originale- Da: Assenza, Chris [mailto:[EMAIL PROTECTED]] Inviato: martedi 14 agosto 2001 18.47 A: '[EMAIL PROTECTED]' Oggetto: RE: Index within iterate tags When you write your iterator tag add the attribute: indexId=somevalue Then you can use the bean tags to access indexId which returns the current index of the iterator! :-) -Chris Christopher Assenza Phone: 412.201.6026 Fax: 412.201.6060 Email: [EMAIL PROTECTED] ACCESSDATA Moving Your Business from Point A to Point e.SM http://www.accessdc.com/ -Original Message- From: Nicola Taylor [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 14, 2001 12:00 PM To: Struts-User (E-mail) Subject: Index within iterate tags Hi, were using the indexed properties tags and it'd be useful to know the current index in the jsp (to do some javascript stuff). Is there any standard way to access the current index in the iterator? 1) write a custom tag to return: IterateTag iterateTag = (IterateTag) findAncestorWithClass(this, IterateTag.class); iterateTag.getIndex(); 2) have a counter variable that we increment within the iterate loop. Cheers ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **
Re: Hard time understanding tld(s)...
Hi, there. These are tag library declarations that are modified into your application web.xml and thus declared in your JSP FILE ( %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % )as an example. Thus you can refer to ie the prefix=bean bean:write/ or bean:message/ as write and message tags and create resources ( MyApplicationResource.properties.FILE)for message and write as it's uri location are mapped in web.xml.The Best course of action is to read the documentation as im still getting to grips with struts however i find the material very good. I personally found very imformative mat's at http://www.husted.com/about/struts. Good Reading plenty of it.NOTE this is my current understanding im still learning . Cheers Chuck Venkat Jonnalagadda wrote: Hi all, can somebody point me to some documentation describing what struts.tld, struts-bean.tld, struts-logic.tld, struts-html.tld etc., are and what context(s) they are used Venkat. -- The views expressed by the sender of this message don't necessarily represent those of Brecon Beacons National Park Authority. This message is intended for the addressee(s) only and is sent in confidence; if you receive it in error, please can you let us know (at [EMAIL PROTECTED]) and then destroy all copies. Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog. Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn mewn camgymeriad, a fyddech gystal â rhoi gwybod i ni (yn [EMAIL PROTECTED]) ac yna dilëwch bob copi.
The index number of iterate tag
Hi, Could any one tell me how to get the index number in a iterate tag? For example, I want to show a html table in screen like below. No. Name. Address.. --- 1 AAAXX 2 BBB xxY 3 CCC ffxx .. And I have a collection of objects which have attribute name and address ... etc. I can use logic:iterate to display this collection. But I don't know how to get the item number number. Now, I use a variable i and use scriptlet %= ++i % in JSP, but I think the codes are ugly. Is there a tag or implicit variable to get the index number of logic:iterate ? Regards, Vincent(¹¡¢·*.úÞ{¡¢(§]ë,jØm¶ÿ¨¥É¨h¡Ê
RE: Re: template tags
I put a special header and footer on all my pages. I'd like to do this with the template tags. Template tags allow you to pass named parameters to the template. However, I need to pass a list of things (navigation URLs) into my header so it can print a list of hyperlinks. It doesn't seem possible to pass a list of items with the template tags. Can anyone suggest anything? You can put the list in an request scoped bean with defined name. The template can then access it, e.g. with ligic:iterate That's what I'm doing at the moment with the old jsp:setProperty and jsp:include tags. I guess what I'm asking is can I do this cleaner somehow with the template tags? Devon
R: Index within iterate tags
WOW!!! It's magic! Is it possible to put the index value in an hidden field? Thank you! -Messaggio originale- Da: Heritier Arnaud [mailto:[EMAIL PROTECTED]] Inviato: venerdì 24 agosto 2001 11.05 A: '[EMAIL PROTECTED]' Oggetto: RE: Index within iterate tags What Chris want to say is to use the indexId attribute like this : !--The property getTitoliStudio of class Curriculum return a Vector-- logic:iterate id=iterateId property=titoliStudio name=curriculum indexId=myId html:form action=/addTitoloStudio .. bean:write name=myId scope=page/ ... html:text property=myProperty/ html:submit property=addTitoloStudio value=Aggiungi/ /html /logic arno -Message d'origine- De: Paolo Balzarotti [SMTP:[EMAIL PROTECTED]] Date: vendredi 24 aout 2001 10:55 A: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Objet: R: Index within iterate tags Hi, ... I don't understand you answer ... :-o how can you get the indexId value? What is somevalue? Suppose you have: !--The property getTitoliStudio of class Curriculum return a Vector-- logic:iterate id=iterateId property=titoliStudio name=curriculum html:form action=/addTitoloStudio bean: !- I'd like to have the iterator index in an hidden field-- html:text property=myProperty/ html:submit property=addTitoloStudio value=Aggiungi/ /html /logic How can I put the iterator index in an hidden field in the form? Thank you -Messaggio originale- Da: Assenza, Chris [mailto:[EMAIL PROTECTED]] Inviato: martedi 14 agosto 2001 18.47 A: '[EMAIL PROTECTED]' Oggetto: RE: Index within iterate tags When you write your iterator tag add the attribute: indexId=somevalue Then you can use the bean tags to access indexId which returns the current index of the iterator! :-) -Chris Christopher Assenza Phone: 412.201.6026 Fax: 412.201.6060 Email: [EMAIL PROTECTED] ACCESSDATA Moving Your Business from Point A to Point e.SM http://www.accessdc.com/ -Original Message- From: Nicola Taylor [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 14, 2001 12:00 PM To: Struts-User (E-mail) Subject: Index within iterate tags Hi, were using the indexed properties tags and it'd be useful to know the current index in the jsp (to do some javascript stuff). Is there any standard way to access the current index in the iterator? 1) write a custom tag to return: IterateTag iterateTag = (IterateTag) findAncestorWithClass(this, IterateTag.class); iterateTag.getIndex(); 2) have a counter variable that we increment within the iterate loop. Cheers ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **
How to include an .do from a jsp
Hi all, some time ago I've written about my problem including *.do in jsps. E.g. in the template tags. The problem is caused be the way, how Action/ActionServlet controls the invocation of its view. The request is either forwarded or redirected to the view and neither forwarding nor redirecting work, when the action is included. My workaround is, to let the Action's perform() method to return null and then in my composite view include the sub-view. So something like: jsp:include page=thing.do / jsp:inlcude page=thing-success.jsp / This definitely breaks the MVC pattern, since the composite view controls the view of the sub-action. My proposal: Now I can specify in struts-config.xml that a forward should be redirected with redirect=true. What about allowing include as well? Even better would be, it ActionServlet recognised, the action is beeing included and it would include the view instead of forwarding/redirecting to it. I'll try to have a look at it in September and submit a patch. -- gR
Re: Re: template tags
[EMAIL PROTECTED] wrote: You can put the list in an request scoped bean with defined name. The template can then access it, e.g. with ligic:iterate That's what I'm doing at the moment with the old jsp:setProperty and jsp:include tags. I guess what I'm asking is can I do this cleaner somehow with the template tags? Devon You mean something like this? logic:iterate id=x template:get name=%= x % / /logic:iterate I am not sure, whether this is possible in the soon-to-be-deprecated template tags or in the tiles tags, but the idea is good. -- gR
RE: Index within iterate tags
You should do it like this but I didn't test it : html:hidden name=my_hidden_field_name value=%=myId%% -Message d'origine- De: Paolo Balzarotti [SMTP:[EMAIL PROTECTED]] Date: vendredi 24 aout 2001 11:40 A: '[EMAIL PROTECTED]' Objet: R: Index within iterate tags WOW!!! It's magic! Is it possible to put the index value in an hidden field? Thank you! -Messaggio originale- Da: Heritier Arnaud [mailto:[EMAIL PROTECTED]] Inviato: venerdi 24 agosto 2001 11.05 A: '[EMAIL PROTECTED]' Oggetto: RE: Index within iterate tags What Chris want to say is to use the indexId attribute like this : !--The property getTitoliStudio of class Curriculum return a Vector-- logic:iterate id=iterateId property=titoliStudio name=curriculum indexId=myId html:form action=/addTitoloStudio .. bean:write name=myId scope=page/ ... html:text property=myProperty/ html:submit property=addTitoloStudio value=Aggiungi/ /html /logic arno -Message d'origine- De: Paolo Balzarotti [SMTP:[EMAIL PROTECTED]] Date: vendredi 24 aout 2001 10:55 A: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Objet: R: Index within iterate tags Hi, ... I don't understand you answer ... :-o how can you get the indexId value? What is somevalue? Suppose you have: !--The property getTitoliStudio of class Curriculum return a Vector-- logic:iterate id=iterateId property=titoliStudio name=curriculum html:form action=/addTitoloStudio bean: !- I'd like to have the iterator index in an hidden field-- html:text property=myProperty/ html:submit property=addTitoloStudio value=Aggiungi/ /html /logic How can I put the iterator index in an hidden field in the form? Thank you -Messaggio originale- Da: Assenza, Chris [mailto:[EMAIL PROTECTED]] Inviato: martedi 14 agosto 2001 18.47 A: '[EMAIL PROTECTED]' Oggetto: RE: Index within iterate tags When you write your iterator tag add the attribute: indexId=somevalue Then you can use the bean tags to access indexId which returns the current index of the iterator! :-) -Chris Christopher Assenza Phone: 412.201.6026 Fax: 412.201.6060 Email: [EMAIL PROTECTED] ACCESSDATA Moving Your Business from Point A to Point e.SM http://www.accessdc.com/ -Original Message- From: Nicola Taylor [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 14, 2001 12:00 PM To: Struts-User (E-mail) Subject: Index within iterate tags Hi, were using the indexed properties tags and it'd be useful to know the current index in the jsp (to do some javascript stuff). Is there any standard way to access the current index in the iterator? 1) write a custom tag to return: IterateTag iterateTag = (IterateTag) findAncestorWithClass(this, IterateTag.class); iterateTag.getIndex(); 2) have a counter variable that we increment within the iterate loop. Cheers ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **
RE: The index number of iterate tag
logic:iterate name=myBeanName property=myBeanProp id=indexedBeanName indexId=myIndexName this will: 1) iterate over the collection / array obtained by calling 'getMyBeanProp()' on the bean named 'myBeanName' 2) place the current element in the iteration in page context against the name 'indexedBeanName' 3) place the current index in the page context against the name myIndexName -Original Message- From: Vincent Lin [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 9:26 AM To: [EMAIL PROTECTED] Subject: The index number of iterate tag Hi, Could any one tell me how to get the index number in a iterate tag? For example, I want to show a html table in screen like below. No. Name. Address.. --- 1 AAAXX 2 BBB xxY 3 CCC ffxx .. And I have a collection of objects which have attribute name and address ... etc. I can use logic:iterate to display this collection. But I don't know how to get the item number number. Now, I use a variable i and use scriptlet %= ++i % in JSP, but I think the codes are ugly. Is there a tag or implicit variable to get the index number of logic:iterate ? Regards, Vincent??¡¢??.úÞ{¡¢?§]ë,jØm?ÿ¨¥É¨h¡Ê ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper at LevelSeas for the presence of computer viruses. www.mimesweeper.com **
Struts Fast collections, deprecation
I've just tried using FastTreeMap, and found that it had been deprecated. Why? Is there replacement (other than the standard classes)? Can someone update the online documentation to reflect this deprecation? Thanks. David Corbin
RE: Re: Re: template tags
You mean something like this? logic:iterate id=x template:get name=%= x % / /logic:iterate I am not sure, whether this is possible in the soon-to-be-deprecated template tags or in the tiles tags, but the idea is good. No, I mean a caller like: template:insert template='/chapterTemplate.jsp' template:put name='name[0]' content='name_0'/ template:put name='name[1]' content='name_1'/ template:put name='name[2]' content='name_2'/ /template:insert Then in the template itself: logic:iterate id=x name=name bean:write name=x/ /logic:iterate So the template:put would recognize that name needs to be a list and create the bean accordingly. Devon
Error... Instanciate a new bean
Hi, i have a problem in using Struts. My home.do launch my homeAction.class and my homeForm.class . So all attributes of my bean are filled . But, when my jsp desire to use my bean (homeForm.class) using jsp:useBean.., it instanciate a new bean of homeForm.class (So all attribute are null) and it doesn't use the bean that i filled . Does someone can help me please? Regards, stephaneStéphane RODIERE 0622087230 [EMAIL PROTECTED] Téléchargez MSN Explorer gratuitement à l'adresse http://explorer.msn.com
Security, authentication and authorisation with Struts
Hi Guys, I wondered what approach you guys took when implementing security, authentication and authorisation. I have the common scenario where the application I am creating allocates roles to certain types of users, allows them to login, then restricts access to certain pages and within the pages certain content. As this is a very common problem/scenario I wondered what approach you guys took when using Struts. Do you utilise container managed security or do you use application managed security? - what have you found works best with Struts? Does anyone have any suggestions or example applications I could take a look at? Thanks in advance, Simon. For optimum solutions that save you time, visit www.ds-s.com.
Problem with org.apache.struts.taglib.form avd VAJ3.5.3 and WTE -errata corrige-
Hi all. I'm sorry..but the previous mailwas empty :-) I downloaded from the web a struts-logon example and executed it successfully using Tomcat 3.2.3. Then I've tryed to run the same example using VAJ e WebSphere Test Environment, butthe server throws aRuntimeExceptionwhenparses the tag form:link page="/page.jsp"Sign in/form:link The server is not able to load a class of org.apache.struts.taglib.form packageThen I've noticed this package is included into /lib/struts.jar of the struts-logon sample, while it is not in the Struts source code (release 1.0). Anyone could help me? thanks, bye Ernesto Sarica GRATUITAMENTE MSN Explorer all'indirizzo http://explorer.msn.com
Re: Error... Instanciate a new bean
Take a look at the bean:write tag. If you use"homeForm" for the "name" property and one of the form's properties for the "property" property you're all set. Example: bean:write name="homeForm" property="someproperty"/ Regards, Guus - Original Message - From: stephane roro To: [EMAIL PROTECTED] Sent: Friday, August 24, 2001 13:31 Subject: Error... Instanciate a new bean Hi, i have a problem in using Struts. My home.do launch my homeAction.class and my homeForm.class . So all attributes of my bean are filled . But, when my jsp desire to use my bean (homeForm.class) using jsp:useBean.., it instanciate a new bean of homeForm.class (So all attribute are null) and it doesn't use the bean that i filled . Does someone can help me please? Regards, stephaneStéphane RODIERE 0622087230 [EMAIL PROTECTED] Téléchargez MSN Explorer gratuitement à l'adresse http://explorer.msn.com
Re: Hi All, especially Nial Pemberton and Ted Husted - Re Logic Tags
Personally, I would tend to want to stand pat on the Struts tag extensions while the JSPTL is being sorted out. Ideally, I believe we would want to include a bare minimum number of tags with Struts, and leave everything else to places like Jakarta Taglibs. It's possible that Nial might want to propose his Taglibs over there, for wider distribution. We'll probably be moving our own logic tags there too eventually. An important point generally is that Struts is not meant to be an omnibus platform for Web development. We do not want to include everything any developer might ever want to use to write an application. Struts is designed as a lightweight platform that fills the gaps between Servlets, JavaServer Pages, i18n, and a MVC type design. We included some general purpose tags to begin with, because when we started, places like Jakarta Taglibs and the Commons didn't exist. Now that they do, we'll be moving whatever functionality we can over there, so Struts can focus on only doing the things Struts absolutely needs to do. When Craig decided to name the framework Struts, I think part of what he had in mind was that the less of it that shows, the better ;-) -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ Dudley Butt@i-Commerce wrote: Hi All, I just want to know wether Nials extra logic tags will ever be put into the Struts build? Thanx Regards, Dudley Butt
Digester Help PLEASE
Ok, after spending over 2 hours trying to debug this can I get some eyes on this please? Does anyone see anything wrong with this method ran against the attached datafile: protected void initMappings(InputStream input) { Digester digester = new Digester(); digester.setDebug(1); digester.setValidating(false); digester.push(this); digester.addObjectCreate(factory-selector/factory, com.company.Factory); digester.addSetProperties(factory-selector/factory); digester.addSetNext(factory-selector/factory, addFactory, com.company.Factory); digester.addObjectCreate(*/patternset, com.company.PatternSet); digester.addSetProperties(*/patternset); digester.addSetNext(*/patternset, addPatternSet, com.parlano.web.struts.mapping.PatternSet); digester.addCallMethod(*/pattern, addPattern, 0); try { digester.parse(input); } catch (Exception e) { System.out.println(DAMN ERRORS); e.printStackTrace(); } } PLEASE, any help would be greatly appreciated ... I can't figure out why NONE of my objects are getting created nor are they getting populated. No methods are getting called ...I get no exceptions no nothing ... I put print statements around things and it is getting through all of this. I also tried breaking the XML in the datafile and it breaks and errors out so I know it is parsing the file. ANY help would be appreciated, Thanks ... Sean ?xml version=1.0 ? factory-selector factory name=ie patternset comparator=and patternMSIE/pattern patternWindows NT/pattern /patternset /factory factory name=default patternset comparator=and patternMozilla/pattern patternLinux/pattern /patternset /factory factory name=ns patternset comparator=or patternMozilla/5/pattern patternNetscape6//pattern patternMozilla/pattern /patternset /factory factory name=default patternset comparator=or patternMSPIE/pattern patternHandHTTP/pattern patternAvantGo/pattern patternDoCoMo/pattern patternOpera/pattern patternLynx/pattern patternJava/pattern patternNokia/pattern patternUP/pattern patternWapalizer/pattern pattern*/pattern /patternset /factory /factory-selector
Re: Digester Help PLEASE
Hello Sean, You can create only ONE instance of Digester in your application. If it can help you... Friday, August 24, 2001, 5:26:22 PM, you wrote: S Ok, after spending over 2 hours trying to debug this can I get some eyes on S this please? Does anyone see anything wrong with this method ran against S the attached datafile: S protected void initMappings(InputStream input) { S Digester digester = new Digester(); S digester.setDebug(1); S digester.setValidating(false); S digester.push(this); S digester.addObjectCreate(factory-selector/factory, S com.company.Factory); S digester.addSetProperties(factory-selector/factory); S digester.addSetNext(factory-selector/factory, addFactory, S com.company.Factory); S digester.addObjectCreate(*/patternset, com.company.PatternSet); S digester.addSetProperties(*/patternset); S digester.addSetNext(*/patternset, addPatternSet, S com.parlano.web.struts.mapping.PatternSet); S digester.addCallMethod(*/pattern, addPattern, 0); S try { S digester.parse(input); S } S catch (Exception e) { S System.out.println(DAMN ERRORS); S e.printStackTrace(); S } S } S PLEASE, any help would be greatly appreciated ... I can't figure out why S NONE of my objects are getting created nor are they getting populated. No S methods are getting called ...I get no exceptions no nothing ... I put print S statements around things and it is getting through all of this. I also S tried breaking the XML in the datafile and it breaks and errors out so I S know it is parsing the file. ANY help would be appreciated, Thanks ... S Sean -- Best regards, Olegmailto:[EMAIL PROTECTED]
Re: Digester Help PLEASE
Oleg, I am running this from a main() test program and only one instance it being created. Do you see anything wrong with the rules? XML file? Sean
Re[2]: Digester Help PLEASE
Hello Sean, What is wrong with your code - explane please. P.S. May be I am wrong but try to avoid such patterns as */patternset Friday, August 24, 2001, 5:37:58 PM, you wrote: S Oleg, S I am running this from a main() test program and only one instance it being S created. Do you see anything wrong with the rules? XML file? S Sean -- Best regards, Olegmailto:[EMAIL PROTECTED]
RE: Security, authentication and authorisation with Struts
We actually do more or less the same. During the login phase we retrieve the user profile which includes the authorization information and store this in the session context. Each action can then take some access control decision based on this information. However I am currently trying to use JAAS (Java Authentication and Authorization Service) just for the authorization part. I have written a doc on the various issues of doing so and how I'm planning to do so. I'm still working on it but it may be useful to some of you, so I attach it. This document mentions eShell: this is the name of the framework we use, and it is extending Struts. As usual, any comments on this is welcome :) Fr. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 24 August 2001 15:27 To: [EMAIL PROTECTED] Subject: RE: Security, authentication and authorisation with Struts I wondered what approach you guys took when implementing security, authentication and authorisation. I have the common scenario where the application I am creating allocates roles to certain types of users, allows them to login, then restricts access to certain pages and within the pages certain content. I use a subclass of ActionServlet that ensures that the username (a String) and authorization info (a bean) for this user are saved in the session scope before any Actions are called. (They aren't combined into one object because I need the username for other situations when I may not require auth information.) At the top of each Action I consult the authorization bean to see if this user has the appropriate permissions to call this Action. If so, I just keep going. If not, I forward to a JSP that tells them no. If the authorization bean doesn't exist anymore it's because the session timed out in which case I forward to another JSP asking them to start over. The ability to choose your view in the Action is really, really nice. I don't have a login procedure because there is a front-end that they need to pass through before they get to my application and this guarentees me a username in the HTTP headers. So I just need to pull it out of the headers in the special ActionServlet subclass and put it in the scope. But it would be easy enough for a login page to do the same thing. Devon The information in this email is confidential and is intended solely for the addressee(s). Access to this email by anyone else is unauthorised. If you are not an intended recipient, you must not read, use or disseminate the information contained in the email. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Capco. http://www.capco.com *** Title: Using JAAS within eShell web applications Using JAAS within eShell web applications [Introduction] [JAAS support in eShell] [Configuration] Introduction The Java Authentication and Authorization Service (JAAS) is a standard Java API that extends the standard Java security model in order to: Provide a standard API of authenticating users while allowing different authentication methods to be plugged-in (pluggable login modules). Provide subject-based access control by extending the standard Java 2 security model: access control can be based on who is running the code in addition to which code source is running. Allow the use of a custom policy object which can retrieve user permissions from any storage. JAAS is distributed as a standard extension to the J2SE 1.3 platform, and is completely integrated into J2SE 1.4. However despite this integration, there are important issues that makes it difficult to integrate JAAS in the context of a web application. Integration Issues The issues one faces when using JAAS within a web application relate on one side to the current state of the J2EE specifications, and on the other side to the way JAAS is currently defined. At present there is no way to provide a portable solutions to these issues. Issues with the J2EE specification The issues with the current J2EE 1.2 specification is that it does not integrate JAAS. Indeed, container providers are not required to use JAAS for implementing authentication and authorization. In the case of the Servlet specification, web containers are just required to support: Basic authentication: browser asks for userid/password Form-based authentication: allow a custom screen for userid/pwd Client certificate authentication: based on PKI infrastructure Role-based access control to web resource Therefore it's only through these standard authentication and authorization mechanisms that one can benefit from container managed security (e.g. propagation of the user identity to an EJB container). The J2EE specification v1.3 goes a little further in integrating JAAS within the J2EE
Re: Security, authentication and authorisation with Struts
rey-- that seems like a reasonable approach, but i've read in more than one post on this board that subclassing the ActionServlet should be avoided. wouldn't it be better to put this code directly into the action servlet and rebuild struts? i'd also be interested in hearing the rationale behind the desire not to subclass ActionServlet from those of you who prefer to avoid it. jon Rey Francois wrote: We actually do more or less the same. During the login phase we retrieve the user profile which includes the authorization information and store this in the session context. Each action can then take some access control decision based on this information. However I am currently trying to use JAAS (Java Authentication and Authorization Service) just for the authorization part. I have written a doc on the various issues of doing so and how I'm planning to do so. I'm still working on it but it may be useful to some of you, so I attach it. This document mentions eShell: this is the name of the framework we use, and it is extending Struts. As usual, any comments on this is welcome :) Fr. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 24 August 2001 15:27 To: [EMAIL PROTECTED] Subject: RE: Security, authentication and authorisation with Struts I wondered what approach you guys took when implementing security, authentication and authorisation. I have the common scenario where the application I am creating allocates roles to certain types of users, allows them to login, then restricts access to certain pages and within the pages certain content. I use a subclass of ActionServlet that ensures that the username (a String) and authorization info (a bean) for this user are saved in the session scope before any Actions are called. (They aren't combined into one object because I need the username for other situations when I may not require auth information.) At the top of each Action I consult the authorization bean to see if this user has the appropriate permissions to call this Action. If so, I just keep going. If not, I forward to a JSP that tells them no. If the authorization bean doesn't exist anymore it's because the session timed out in which case I forward to another JSP asking them to start over. The ability to choose your view in the Action is really, really nice. I don't have a login procedure because there is a front-end that they need to pass through before they get to my application and this guarentees me a username in the HTTP headers. So I just need to pull it out of the headers in the special ActionServlet subclass and put it in the scope. But it would be easy enough for a login page to do the same thing. Devon The information in this email is confidential and is intended solely for the addressee(s). Access to this email by anyone else is unauthorised. If you are not an intended recipient, you must not read, use or disseminate the information contained in the email. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Capco. http://www.capco.com *** Name: JAAS and eShell.html JAAS and eShell.htmlType: Hypertext Markup Language (text/html) Encoding: quoted-printable
RE: Security, authentication and authorisation with Struts
I would highly recommend looking at JAAS for authentication/authorization. I'm using it in conjunction with Struts right now (using JBoss/Tomcat) and everything is working fine. I'm still in development and haven't gone live yet, but so far so good. JAAS takes a little while to get your head around. Lots of terminology to decipher. But the promise of implementation independent security in your application was worth it for me. It's pretty straight forward in JBoss, but again it'll take you some time reading and playing with it before it starts making sense. See http://java.sun.com/products/jaas/index-10.html for more details. -ryan -Original Message- From: Prior, Simon To: '[EMAIL PROTECTED]' Sent: 8/24/2001 8:11 AM Subject: Security, authentication and authorisation with Struts Hi Guys, I wondered what approach you guys took when implementing security, authentication and authorisation. I have the common scenario where the application I am creating allocates roles to certain types of users, allows them to login, then restricts access to certain pages and within the pages certain content. As this is a very common problem/scenario I wondered what approach you guys took when using Struts. Do you utilise container managed security or do you use application managed security? - what have you found works best with Struts? Does anyone have any suggestions or example applications I could take a look at? Thanks in advance, Simon. For optimum solutions that save you time, visit www.ds-s.com.
Re: Re[2]: Digester Help PLEASE
Sean, If it means anything to you, I had a working use of Digester (for months) that suddenly failed when I upgraded to a recent (sorry, don't recall which) post-1.0 nightly binary release. My app suddenly failed. As best I could determine, none of the rules were firing. I did not have the time to figure this out, so I reverted to 1.0. Worked again. (I had to make a couple of import changes going both ways because of the move to Commons, but no other changes were made to code.) Good luck. -r - Original Message - From: Sean [EMAIL PROTECTED] To: Struts Users [EMAIL PROTECTED] Sent: Friday, August 24, 2001 6:51 AM Subject: Re[2]: Digester Help PLEASE Oleg, The problem is that none of the rules are being fired at all, no objects are getting created, nothing at all. The patterns match what is in the file, the file is valid, I should see some Factory objects get created, some PatternSet objects get created, and a whole bunch of sets etc happen but nothing is happening at all ... no a single object is getting consucted. I have placed print statements in the constructors and nothing, nada ... That is what is wrong ... It's like the digester is parsing the file but for some weird reason it doesn't see any matches to my rules I added to the Digester. Any ideas? Sean
Re: Security, authentication and authorisation with Struts
Jonathan M Crater wrote: i'd also be interested in hearing the rationale behind the desire not to subclass ActionServlet from those of you who prefer to avoid it. Offering alternatives to subclassing ActionServlet so that other resources (like things for ValidatorForm and Tiles) can be loaded has come up a lot, and Oleg has come up with a good solution that we are testing. So, the context here is why should I subclass the ActionServlet *just* to do this. And if we all start offering cool resources that require the ActionServlet to be subclassed, the heirarchy can get out of control. But, I don't believe there are systemic problems with sublassing ActionServlet for appliation-specific needs. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/
Re[3]: Digester Help PLEASE
Hello Sean, Friday, August 24, 2001, 5:51:33 PM, you wrote: S Oleg, S The problem is that none of the rules are being fired at all, no objects are S getting created, nothing at all. The patterns match what is in the file, S the file is valid, I should see some Factory objects get created, some S PatternSet objects get created, and a whole bunch of sets etc happen but S nothing is happening at all ... no a single object is getting consucted. I S have placed print statements in the constructors and nothing, nada ... That S is what is wrong ... It's like the digester is parsing the file but for some S weird reason it doesn't see any matches to my rules I added to the Digester. What version of Digester are you use? -- Best regards, Olegmailto:[EMAIL PROTECTED]
RE: Re: Security, authentication and authorisation with Struts
wouldn't it be better to put this code directly into the action servlet and rebuild struts? That goes against my code-reusability instincts. I strive to use the default struts build and default tag libraries. The other possibility would be to put this in the Action class. Before it checks the authorization, it could verify that it is in the session. If not, put it there. I don't do this because I also put an object in the application scope (for complicated reasons) and it seems silly to put this code in the Action code which is rather far from the application level. i'd also be interested in hearing the rationale behind the desire not to subclass ActionServlet from those of you who prefer to avoid it. Me too. Works fine for me. Devon
Re: Re[2]: Digester Help PLEASE
I am using the 1.0 release, just again downloaded from the jakarta set fresh in case something else is wrong. Nada, a no go still ... Any other ideas? Sean P.S. URL used: http://jakarta.apache.org/builds/jakarta-commons/release/commons-digester/v1 .0/
Re: welcome file in web.xml with pre-compiled jsp's?
Hello, I don't know if I understand your question completely, but are you saying that having a servlet (or the ActionServlet) as a welcome page would solve your problem? Or must it be a .jsp? I am using the ActionServlet to forward to my welcome page. I have index.do listed as my welcome file. To get this to work, I had to put a blank file called index.do in my WEB-INF directory. This seems to work fine in both resin and orion. Bill [EMAIL PROTECTED] wrote: Hi everyone, I am pre-compiling my jsp's in my struts web app, and everything works fine, except specifying the welcome file in the web.xml. If I do not pre-compile everything, having index.jsp as the first page works great. However, when I pre-compile index.jsp it doesn't work. Putting an uncompiled index.jsp back in the root directory makes it work again. I guess it is because I am now calling a servlet instead of page, but not sure how to get around this. Does anyone know if there is something special I have to do, or if there is anywhere else I can specify the first page as a servlet? Thanks, Dave 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.xml for use with PRE-COMPILED JSP's -- web-app !-- The Welcome File List -- welcome-file-list !-- call index.jsp as first page -- welcome-fileindex.jsp/welcome-file /welcome-file-list !-- Action Servlet Configuration -- servlet servlet-nameaction/servlet-name !-- central Action Servlet Controller to use -- servlet-classbeans.AppController/servlet-class !-- Java class name of the application resources bundle base class -- init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param !-- Context-relative path to the XML resource containing our configuration information -- init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param !-- The debugging detail level for this servlet, which controls how much information is logged. [0] -- init-param param-namedebug/param-name param-value2/param-value /init-param !-- The debugging detail level for the Digester we utilize in initMapping(), which logs to System.out instead of the servlet log. [0] -- init-param param-namedetail/param-name param-value2/param-value /init-param load-on-startup2/load-on-startup /servlet !-- Catch any exceptions, and redirect to error page -- error-page exception-typejava.lang.Exception/exception-type location/error.jsp/location /error-page servlet servlet-name changeLogFileName /servlet-name servlet-class JspServ.changeLogFileName /servlet-class /servlet servlet servlet-name chooseDevice /servlet-name servlet-class JspServ.chooseDevice /servlet-class /servlet servlet servlet-name dataDir /servlet-name servlet-class JspServ.dataDir /servlet-class /servlet servlet servlet-name dataDirFrame /servlet-name servlet-class JspServ.dataDirFrame /servlet-class /servlet servlet servlet-name error /servlet-name servlet-class JspServ.error /servlet-class /servlet servlet servlet-name index /servlet-name servlet-class JspServ.index /servlet-class /servlet servlet servlet-name indexBar /servlet-name servlet-class JspServ.indexBar /servlet-class /servlet servlet servlet-name log /servlet-name servlet-class JspServ.log /servlet-class /servlet servlet servlet-name logFilter /servlet-name servlet-class JspServ.logFilter /servlet-class /servlet servlet servlet-name logFrame /servlet-name servlet-class JspServ.logFrame /servlet-class /servlet servlet servlet-name logging /servlet-name servlet-class JspServ.logging /servlet-class /servlet servlet servlet-name loggingFrame /servlet-name servlet-class JspServ.loggingFrame /servlet-class /servlet servlet servlet-name loggingSaveCancel /servlet-name servlet-class JspServ.loggingSaveCancel /servlet-class /servlet servlet servlet-name login /servlet-name servlet-class JspServ.login /servlet-class /servlet servlet servlet-name messages /servlet-name
Re: Security, authentication and authorisation with Struts
i would prefer not to put the authentication code in the action because it opens the possibility of having authentication logic in each and every action, which would essentially defeat one of the main purposes of having a controller in the first place--one point of access for security reasons. it seems to me that subclassing ActionServlet and/or adding authentication code to it are preferable to distributing the authentication logic across x number of action classes. [EMAIL PROTECTED] wrote: wouldn't it be better to put this code directly into the action servlet and rebuild struts? That goes against my code-reusability instincts. I strive to use the default struts build and default tag libraries. The other possibility would be to put this in the Action class. Before it checks the authorization, it could verify that it is in the session. If not, put it there. I don't do this because I also put an object in the application scope (for complicated reasons) and it seems silly to put this code in the Action code which is rather far from the application level. i'd also be interested in hearing the rationale behind the desire not to subclass ActionServlet from those of you who prefer to avoid it. Me too. Works fine for me. Devon
Digester and Factory methods
Greetings. I'm using the digester to read a poor-person's DB and am wondering if there is a way for the digester to call my own factory methods for creating objects instead of using the Digester's addCreateObject method. If there was a way of registering factory methods for object creation, that would be way cool. Thanks, Tom Tibbetts Confusion is a high state of being
referring to a formBean property in a scriptlet
Hello, I'm new to Struts, and really like what I see. I didn't see this in the docs, so maybe someone can answer this. I'm working on a small sample app that displays an Employee Id on a form for maintenance. I need to display the ID as static text if the Employee record already exists, or in a textfield if the Employee record does not yet exist. So I put a boolean flag 'isNew' in the formBean. What's the best way to refer to that flag within a scriptlet? That is, % if ( ??FORMBEAN??.getIsNew() ) { % html:text property=employeeId size=30 maxlength=30/ % } else { % %= ??FORMBEAN??.getEmployeeId() % % } % Does Struts provide a standard id I can use to refer to my formBean? Or do I have to put in a 'useBean' directive and access the bean directly? Thanks, Scott Esbrook Software Developer Compuware Corporation
URL Encode for a JSP Page using Struts
Hi, I have an elementary question. I want to encode the URL of my jsp page that I call using findForward() say something like a mode parameter. So my jsp url will look like: http://localhost:8080/someURL/doSomething?mode=21 How can I do that? Krishna _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
Re: referring to a formBean property in a scriptlet
You probably want to take a look at the logic tags. Here's some code from one of mine that tests whether the key is null. Records with null keys are new. tr td align=right nowrapArticle ID:/td logic:notPresent name=articleForm property=key td align=leftnbsp;html:hidden property=key/font color=#CCinot assigned/i/font/td /logic:notPresent logic:present name=articleForm property=key td align=leftnbsp;html:hidden property=key/bean:write name=articleForm property=key//td /logic:present tdnbsp;/td /tr -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ Esbrook, Scott wrote: Hello, I'm new to Struts, and really like what I see. I didn't see this in the docs, so maybe someone can answer this. I'm working on a small sample app that displays an Employee Id on a form for maintenance. I need to display the ID as static text if the Employee record already exists, or in a textfield if the Employee record does not yet exist. So I put a boolean flag 'isNew' in the formBean. What's the best way to refer to that flag within a scriptlet? That is, % if ( ??FORMBEAN??.getIsNew() ) { % html:text property=employeeId size=30 maxlength=30/ % } else { % %= ??FORMBEAN??.getEmployeeId() % % } % Does Struts provide a standard id I can use to refer to my formBean? Or do I have to put in a 'useBean' directive and access the bean directly? Thanks, Scott Esbrook Software Developer Compuware Corporation
Re: Security, authentication and authorisation with Struts
I would agree that subclassing the ActionServlet is usually preferable, but would point out that the strategy is to provide a BASE action with the authentication code, that others would subclass. So the authentication code would only exist once, in the base class. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ Jonathan M Crater wrote: i would prefer not to put the authentication code in the action because it opens the possibility of having authentication logic in each and every action, which would essentially defeat one of the main purposes of having a controller in the first place--one point of access for security reasons. it seems to me that subclassing ActionServlet and/or adding authentication code to it are preferable to distributing the authentication logic across x number of action classes. [EMAIL PROTECTED] wrote: wouldn't it be better to put this code directly into the action servlet and rebuild struts? That goes against my code-reusability instincts. I strive to use the default struts build and default tag libraries. The other possibility would be to put this in the Action class. Before it checks the authorization, it could verify that it is in the session. If not, put it there. I don't do this because I also put an object in the application scope (for complicated reasons) and it seems silly to put this code in the Action code which is rather far from the application level. i'd also be interested in hearing the rationale behind the desire not to subclass ActionServlet from those of you who prefer to avoid it. Me too. Works fine for me. Devon
RE: referring to a formBean property in a scriptlet
Struts has logic tags so you don't need to use your scriptlet at all for this. See the tag documentation for this. -- Larry Maturo -Original Message- From: Esbrook, Scott [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 9:58 AM To: [EMAIL PROTECTED] Subject: referring to a formBean property in a scriptlet Hello, I'm new to Struts, and really like what I see. I didn't see this in the docs, so maybe someone can answer this. I'm working on a small sample app that displays an Employee Id on a form for maintenance. I need to display the ID as static text if the Employee record already exists, or in a textfield if the Employee record does not yet exist. So I put a boolean flag 'isNew' in the formBean. What's the best way to refer to that flag within a scriptlet? That is, % if ( ??FORMBEAN??.getIsNew() ) { % html:text property=employeeId size=30 maxlength=30/ % } else { % %= ??FORMBEAN??.getEmployeeId() % % } % Does Struts provide a standard id I can use to refer to my formBean? Or do I have to put in a 'useBean' directive and access the bean directly? Thanks, Scott Esbrook Software Developer Compuware Corporation
Help! Unable to open taglibrary
We're trying to get struts installed on an intranet server with no internet connection. We're running tomcat 3.2.3 and struts 1.0. We're just trying to get a simple little app running that uses the struts-bean tag to pull a hello world message from the resource file. I've changed the DOCTYPE elements in struts-config.xml, web.xml and struts-bean.tld to be like this !DOCTYPE taglib SYSTEM http://localhost/dtd/web-jsptaglibrary_1_1.dtd;. I believe everything is working except the taglib because when i remove the bean:message ... tag and just do straight jsp, everything works. We're getting a NullPointerException and I can't figure out why. The exact exception that we are getting is: Error: 500 Location: /hello-world/hello.jsp Internal Servlet Error: org.apache.jasper.compiler.CompileException: /javahome/tomcat/jakarta-tomcat-3.2.3/webapps/hello-world/hello.jsp(1,0) Unable to open taglibrary /WEB-INF/struts-bean.tld : Parse Error in the tag library descriptor: java.lang.NullPointerException at java.lang.Exception.(Compiled Code) at javax.servlet.ServletException.(Compiled Code) at org.apache.jasper.JasperException.(Compiled Code) at org.apache.jasper.compiler.CompileException.(Compiled Code) at org.apache.jasper.compiler.JspParseEventListener.handleDirective(Compiled Code) at org.apache.jasper.compiler.DelegatingListener.handleDirective(Compiled Code) at org.apache.jasper.compiler.Parser$Directive.accept(Compiled Code) at org.apache.jasper.compiler.Parser.parse(Compiled Code) at org.apache.jasper.compiler.Parser.parse(Compiled Code) at org.apache.jasper.compiler.Parser.parse(Compiled Code) at org.apache.jasper.compiler.Compiler.compile(Compiled Code) at org.apache.jasper.servlet.JspServlet.doLoadJSP(Compiled Code) at org.apache.jasper.servlet.JasperLoader.loadJSP(Compiled Code) at org.apache.jasper.servlet.JspServlet.loadJSP(Compiled Code) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(Compi led Code) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(Compiled Code) at org.apache.jasper.servlet.JspServlet.serviceJspFile(Compiled Code) at org.apache.jasper.servlet.JspServlet.service(Compiled Code) at javax.servlet.http.HttpServlet.service(Compiled Code) at org.apache.tomcat.core.ServletWrapper.doService(Compiled Code) at org.apache.tomcat.core.Handler.service(Compiled Code) at org.apache.tomcat.core.ServletWrapper.service(Compiled Code) at org.apache.tomcat.core.ContextManager.internalService(Compiled Code) at org.apache.tomcat.core.ContextManager.service(Compiled Code) at org.apache.tomcat.service.connector.Ajp13ConnectionHandler.processConnection (Compiled Code) at org.apache.tomcat.service.TcpWorkerThread.runIt(Compiled Code) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(Compiled Code) at java.lang.Thread.run(Compiled Code) If anyone can shed some light on what's wrong here, I'd really appreciate it. Thanks, pb WorldSecure Freightliner.com made the following annotations on 08/24/01 08:28:38 -- [INFO] -- Content Manager: The information contained in this communication is confidential and intended solely for the use of the individual to whom it is addressed and others authorized to receive it. If you are not the intended recipient, any disclosure, copying, distribution or taking of any action in reliance on the contents of this information is prohibited. If you have received this communication in error, please immediately notify the sender by phone if possible or via email message. ==
RE: Re: Security, authentication and authorisation with Struts
i would prefer not to put the authentication code in the action because it opens the possibility of having authentication logic in each and every action In my case, each action needs a different authentication. For example, some users have read-only access and some have modify access. Devon
Re: Security, authentication and authorisation with Struts
Have you looked at Nic's extensions for Role-Based Actions? http://husted.com/about/struts/struts-security.htm [EMAIL PROTECTED] wrote: i would prefer not to put the authentication code in the action because it opens the possibility of having authentication logic in each and every action In my case, each action needs a different authentication. For example, some users have read-only access and some have modify access. Devon -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/
Re: URL Encode for a JSP Page using Struts
Just put it in as a Global Forward, something like this forward name=itemFindScript path=/do/item/Search?column=script/ or in your case forward name=something path=/do/Something?mode=21/ or, using extension mapping forward name=something path=/Something.do?mode=21/ You can also refer to Global Forwards in the link tag, and Struts will append any other parameters you supply (paramID, paramProperty). Bhamidi Krishna wrote: Hi, I have an elementary question. I want to encode the URL of my jsp page that I call using findForward() say something like a mode parameter. So my jsp url will look like: http://localhost:8080/someURL/doSomething?mode=21 How can I do that? Krishna _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/
Re: URL Encode for a JSP Page using Struts
Hi Ted, thankyou for the mail, but what if mode and value (either one or both) keep getting generated dynamically dependent on the actionForm ? Krishna Just put it in as a Global Forward, something like this forward name=itemFindScript path=/do/item/Search?column=script/ or in your case forward name=something path=/do/Something?mode=21/ or, using extension mapping forward name=something path=/Something.do?mode=21/ You can also refer to Global Forwards in the link tag, and Struts will append any other parameters you supply (paramID, paramProperty). Bhamidi Krishna wrote: Hi, I have an elementary question. I want to encode the URL of my jsp page that I call using findForward() say something like a mode parameter. So my jsp url will look like: http://localhost:8080/someURL/doSomething?mode=21 How can I do that? Krishna _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
Re: URL Encode for a JSP Page using Struts
Then you would use a html:link tag with the actionForm as the source. http://jakarta.apache.org/struts/struts-html.html#link Bhamidi Krishna wrote: Hi Ted, thankyou for the mail, but what if mode and value (either one or both) keep getting generated dynamically dependent on the actionForm ? Krishna Just put it in as a Global Forward, something like this forward name=itemFindScript path=/do/item/Search?column=script/ or in your case forward name=something path=/do/Something?mode=21/ or, using extension mapping forward name=something path=/Something.do?mode=21/ You can also refer to Global Forwards in the link tag, and Struts will append any other parameters you supply (paramID, paramProperty). Bhamidi Krishna wrote: Hi, I have an elementary question. I want to encode the URL of my jsp page that I call using findForward() say something like a mode parameter. So my jsp url will look like: http://localhost:8080/someURL/doSomething?mode=21 How can I do that? Krishna _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/
Re: welcome file in web.xml with pre-compiled jsp's?
Hi Bill, I just want to have what works with uncompiled jsp's work with compiled jsps! My welcome page is called index.jsp, but when I compile it and put it in a jar file, it is not found for the first page (though I can call it directly). Is this some kind of bug? Cheers, Dave PS I can work around it with a index.htm as a welcome page that redirects you with javascript to index.jsp, but that's very clumsy! Bill Clinton [EMAIL PROTECTED] on 08/24/2001 10:37:46 AM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc:(bcc: David Hay/Lex/Lexmark) Subject: Re: welcome file in web.xml with pre-compiled jsp's? Hello, I don't know if I understand your question completely, but are you saying that having a servlet (or the ActionServlet) as a welcome page would solve your problem? Or must it be a .jsp? I am using the ActionServlet to forward to my welcome page. I have index.do listed as my welcome file. To get this to work, I had to put a blank file called index.do in my WEB-INF directory. This seems to work fine in both resin and orion. Bill [EMAIL PROTECTED] wrote: Hi everyone, I am pre-compiling my jsp's in my struts web app, and everything works fine, except specifying the welcome file in the web.xml. If I do not pre-compile everything, having index.jsp as the first page works great. However, when I pre-compile index.jsp it doesn't work. Putting an uncompiled index.jsp back in the root directory makes it work again. I guess it is because I am now calling a servlet instead of page, but not sure how to get around this. Does anyone know if there is something special I have to do, or if there is anywhere else I can specify the first page as a servlet? Thanks, Dave 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.xml for use with PRE-COMPILED JSP's -- web-app !-- The Welcome File List -- welcome-file-list !-- call index.jsp as first page -- welcome-fileindex.jsp/welcome-file /welcome-file-list !-- Action Servlet Configuration -- servlet servlet-nameaction/servlet-name !-- central Action Servlet Controller to use -- servlet-classbeans.AppController/servlet-class !-- Java class name of the application resources bundle base class -- init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param !-- Context-relative path to the XML resource containing our configuration information -- init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param !-- The debugging detail level for this servlet, which controls how much information is logged. [0] -- init-param param-namedebug/param-name param-value2/param-value /init-param !-- The debugging detail level for the Digester we utilize in initMapping(), which logs to System.out instead of the servlet log. [0] -- init-param param-namedetail/param-name param-value2/param-value /init-param load-on-startup2/load-on-startup /servlet !-- Catch any exceptions, and redirect to error page -- error-page exception-typejava.lang.Exception/exception-type location/error.jsp/location /error-page servlet servlet-name changeLogFileName /servlet-name servlet-class JspServ.changeLogFileName /servlet-class /servlet servlet servlet-name chooseDevice /servlet-name servlet-class JspServ.chooseDevice /servlet-class /servlet servlet servlet-name dataDir /servlet-name servlet-class JspServ.dataDir /servlet-class /servlet servlet servlet-name dataDirFrame /servlet-name servlet-class JspServ.dataDirFrame /servlet-class /servlet servlet servlet-name error /servlet-name servlet-class JspServ.error /servlet-class /servlet servlet servlet-name index /servlet-name servlet-class JspServ.index /servlet-class /servlet servlet servlet-name indexBar /servlet-name servlet-class JspServ.indexBar /servlet-class /servlet servlet servlet-name log /servlet-name servlet-class JspServ.log /servlet-class /servlet servlet servlet-name logFilter /servlet-name servlet-class JspServ.logFilter /servlet-class /servlet servlet servlet-name logFrame /servlet-name servlet-class JspServ.logFrame /servlet-class /servlet servlet servlet-name logging /servlet-name
RE: Hard time understanding tld(s)...
Thanks chuck,Ted...I am on my way to the suggested URL(s)... Venkat. -Original Message- From: Chuck Amadi [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:10 AM To: [EMAIL PROTECTED] Subject: Re: Hard time understanding tld(s)... Hi, there. These are tag library declarations that are modified into your application web.xml and thus declared in your JSP FILE ( %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % )as an example. Thus you can refer to ie the prefix=bean bean:write/ or bean:message/ as write and message tags and create resources ( MyApplicationResource.properties.FILE)for message and write as it's uri location are mapped in web.xml.The Best course of action is to read the documentation as im still getting to grips with struts however i find the material very good. I personally found very imformative mat's at http://www.husted.com/about/struts. Good Reading plenty of it.NOTE this is my current understanding im still learning . Cheers Chuck Venkat Jonnalagadda wrote: Hi all, can somebody point me to some documentation describing what struts.tld, struts-bean.tld, struts-logic.tld, struts-html.tld etc., are and what context(s) they are used Venkat. -- The views expressed by the sender of this message don't necessarily represent those of Brecon Beacons National Park Authority. This message is intended for the addressee(s) only and is sent in confidence; if you receive it in error, please can you let us know (at [EMAIL PROTECTED]) and then destroy all copies. Nid yw'r farn a fynegir gan anfonwr y neges hon o anghenraid yn adlewyrchu barn Awdurdod Parc Cenedlaethol Bannau Brycheiniog. Neges yw hon a fwriadwyd ar gyfer y derbynnydd/derbynyddion yn unig ac fe'i hanfonir yn gyfrinachol; os ydych yn ei dderbyn mewn camgymeriad, a fyddech gystal â rhoi gwybod i ni (yn [EMAIL PROTECTED]) ac yna dilëwch bob copi.
Re: welcome file in web.xml with pre-compiled jsp's?
On Fri, 24 Aug 2001 12:40:04 -0400, [EMAIL PROTECTED] wrote: ||| PS I can work around it with a index.htm as a welcome page that redirects you ||| with javascript to index.jsp, but that's very clumsy! An ever-so-slightly-less-clumsy way to do this it to have an index.jsp that looks like this: jsp:forward page=/myaction.do/ This at least avoids the javascript and browser redirection. Joey -- Sun Certified Java2 Programmer -- My Pocket Smalltalk Stuff: www.joeygibson.com/st -- -- We thought about killin' him, but we kinda -- hated to go that far - Briscoe Darling
Re: welcome file in web.xml with pre-compiled jsp's?
Joey Gibson wrote: An ever-so-slightly-less-clumsy way to do this it to have an index.jsp that looks like this: jsp:forward page=/myaction.do/ But if index.jsp is precompiled (and removed) this won't function as a welcome file (i.e. something that will be shown if they request http://host/app/ ).
RE: Index of an arrayList in a options tag
With minimal changes, the best way is to do something like this: html:select property=singleSelect size=5 html:options property=indexList labelProperty=selectList/ /html:select where indexList is an array of your index values. The other way is to create say a collection(say, allOptions) of OptionLabelValue beans. Each of this bean holds one 'option'(label-value pair). then in your JSP: html:select property=singleSelect size=5 html:options collection=allOptions property=value labelProperty=label/ /html:select (They have examples in the struts-example app.) Hope that helps! - Aparna -Original Message- From: Ganendran Kumaraswamy [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 1:28 AM To: '[EMAIL PROTECTED]' Subject: Index of an arrayList in a options tag Hi All, I am using an arraylist to hold some values and display them in a select box as follows. html:select property=singleSelect size=5 html:options property=selectList labelProperty=selectList/ /html:select I have created the arraylist in my action class and added some values to it. Then I set it to the form (to the selectList variable). Of course I have the getter and setter methods in my bean and it works fine. My question is, can I display the index of the arraylist as the value property in my option html tag ? How do I do it ? For e.g. I would ideally like the output to be like option value=0Some text /option option value=1Some other text/option Cheers, Gane
is the userguide wrong or am i wrong...
I was going through the userguide for struts on the apache site.Under the subsection 3.3.1 there is this html using the tags, I think that the prefix html is wrongly used for the message as i failed to see a tag message in struts-html.tld. I enclosed the html below and used the ##--## to point what i think might be wrong. Any idea? Venkat %@ page language=java % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % html:html head title bean:message key=logon.title/ /title body bgcolor=white html:errors/ html:form action=/logon focus=username table border=0 width=100% tr th align=right html:message key=prompt.username/ is this prefix correct? ## /th td align=left html:text property=username size=16/ /td /tr tr th align=right html:message key=prompt.password/ is this prefix correct? ## /th td align=left html:password property=password size=16/ /td /tr tr td align=right html:submit bean:message key=button.submit/ /html:submit /td td align=right html:reset bean:message key=button.reset/ /html:reset /td /tr /table /html:form /body /html:html
Re: welcome file in web.xml with pre-compiled jsp's?
On Fri, 24 Aug 2001 10:34:03 -0700, John Raley [EMAIL PROTECTED] wrote: ||| Joey Gibson wrote: ||| ||| |||An ever-so-slightly-less-clumsy way to do this it to have an index.jsp ||| that looks like this: ||| |||jsp:forward page=/myaction.do/ ||| ||| But if index.jsp is precompiled (and removed) this won't function as a ||| welcome file (i.e. something that will be shown if they request ||| http://host/app/ ). True. I've not done pre-compiled jsps before, but I would imagine you could just not precompile this one file? If not, then forget what I just said. Joey -- Sun Certified Java2 Programmer -- My Pocket Smalltalk Stuff: www.joeygibson.com/st -- -- We thought about killin' him, but we kinda -- hated to go that far - Briscoe Darling
Re: URGENT: PLEASE HELP
Hi, It does not work. It complains about ending the template:put tag Shelly Assenza, Chris wrote: template:put name=abc direct=truebHello, I'm HTML in a template/b/template:put Chris Christopher Assenza Phone: 412.201.6026 Fax: 412.201.6060 Email: [EMAIL PROTECTED] ACCESSDATA Moving Your Business from Point A to Point e.SM http://www.accessdc.com/ -Original Message- From: Shelly Dhiman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 15, 2001 1:51 PM To: [EMAIL PROTECTED] Subject: URGENT: PLEASE HELP In template:put name='abc' content='' tag can we put direct html code fragment Shelly
RE: URGENT: PLEASE HELP
Shelly, I've cut and paste the template for one of our pages (minus a lot of extra puts). This does indeed work. template:insert template=/template.jsp template:put name=title direct=truebean:message key=acctmaint.window.title //template:put template:put name=test direct=trueHTML Text/template:put /template:insert Make sure you aren't closing the opening put tag with a slash before the content (ie. DO NOT DO: template:put name=title direct=true /html/template:put) (note the slash before html/) Chris Christopher Assenza Phone: 412.201.6026 Fax: 412.201.6060 Email: [EMAIL PROTECTED] ACCESSDATA Moving Your Business from Point A to Point e.SM http://www.accessdc.com/ -Original Message- From: Shelly Dhiman [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:30 PM To: [EMAIL PROTECTED] Subject: Re: URGENT: PLEASE HELP Hi, It does not work. It complains about ending the template:put tag Shelly Assenza, Chris wrote: template:put name=abc direct=truebHello, I'm HTML in a template/b/template:put Chris Christopher Assenza Phone: 412.201.6026 Fax: 412.201.6060 Email: [EMAIL PROTECTED] ACCESSDATA Moving Your Business from Point A to Point e.SM http://www.accessdc.com/ -Original Message- From: Shelly Dhiman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 15, 2001 1:51 PM To: [EMAIL PROTECTED] Subject: URGENT: PLEASE HELP In template:put name='abc' content='' tag can we put direct html code fragment Shelly
RE: URGENT: PLEASE HELP
Ignore the word wrapping, sorry. :) Chris Christopher Assenza Phone: 412.201.6026 Fax: 412.201.6060 Email: [EMAIL PROTECTED] ACCESSDATA Moving Your Business from Point A to Point e.SM http://www.accessdc.com/ -Original Message- From: Assenza, Chris [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:34 PM To: '[EMAIL PROTECTED]' Subject: RE: URGENT: PLEASE HELP Shelly, I've cut and paste the template for one of our pages (minus a lot of extra puts). This does indeed work. template:insert template=/template.jsp template:put name=title direct=truebean:message key=acctmaint.window.title //template:put template:put name=test direct=trueHTML Text/template:put /template:insert Make sure you aren't closing the opening put tag with a slash before the content (ie. DO NOT DO: template:put name=title direct=true /html/template:put) (note the slash before html/) Chris Christopher Assenza Phone: 412.201.6026 Fax: 412.201.6060 Email: [EMAIL PROTECTED] ACCESSDATA Moving Your Business from Point A to Point e.SM http://www.accessdc.com/ -Original Message- From: Shelly Dhiman [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:30 PM To: [EMAIL PROTECTED] Subject: Re: URGENT: PLEASE HELP Hi, It does not work. It complains about ending the template:put tag Shelly Assenza, Chris wrote: template:put name=abc direct=truebHello, I'm HTML in a template/b/template:put Chris Christopher Assenza Phone: 412.201.6026 Fax: 412.201.6060 Email: [EMAIL PROTECTED] ACCESSDATA Moving Your Business from Point A to Point e.SM http://www.accessdc.com/ -Original Message- From: Shelly Dhiman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 15, 2001 1:51 PM To: [EMAIL PROTECTED] Subject: URGENT: PLEASE HELP In template:put name='abc' content='' tag can we put direct html code fragment Shelly
RE: URGENT: PLEASE HELP
maybe you're having problems with the b tag, try removing it to see if you get the same complaint. -Original Message- From: Shelly Dhiman [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:30 PM To: [EMAIL PROTECTED] Subject: Re: URGENT: PLEASE HELP Hi, It does not work. It complains about ending the template:put tag Shelly Assenza, Chris wrote: template:put name=abc direct=truebHello, I'm HTML in a template/b/template:put Chris Christopher Assenza Phone: 412.201.6026 Fax: 412.201.6060 Email: [EMAIL PROTECTED] ACCESSDATA Moving Your Business from Point A to Point e.SM http://www.accessdc.com/ -Original Message- From: Shelly Dhiman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 15, 2001 1:51 PM To: [EMAIL PROTECTED] Subject: URGENT: PLEASE HELP In template:put name='abc' content='' tag can we put direct html code fragment Shelly
tags build upon tags
I would like to write a tag that is essentially html:select + html:options + domain data from a database. Is there a standard way to construct such a tag? Should I just write the whole thing by hand? Should I write it be calling the other tag classes? David Corbin
Most Urgent - html:select tag
Hi all... Please, inform me how to implement html:select tag? I'm stuck up there. Please, help. Sandeep
RE: Most Urgent - html:select tag
Short answer: html:select property=designId html:options collection=designs property=id labelProperty=name/ /html:select Long answer can be found at http://jakarta.apache.org Jay Patel 972-701-9773 972-849-0373 Mobile [EMAIL PROTECTED] -Original Message- From: s k m [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:10 PM To: [EMAIL PROTECTED] Subject: Most Urgent - html:select tag Hi all... Please, inform me how to implement html:select tag? I'm stuck up there. Please, help. Sandeep
Re: Most Urgent - html:select tag
Hi Sandeep --Hope this helps html:select property=facCd html:options collection=FACILITY property=facCd labelProperty=facDes / /html:select From: s k m [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Most Urgent - html:select tag Date: 24 Aug 2001 19:09:43 - Hi all... Please, inform me how to implement html:select tag? I'm stuck up there. Please, help. Sandeep _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
Re: tags build upon tags
Funny, I was just griping about this to a friend last night: that tags aren't composable like functions and classes. IMO it's a major weakness in JSP. There was some discussion earlier on this list, see Using tags from Java code. The short answer is you do it all yourself. David Corbin wrote: I would like to write a tag that is essentially html:select + html:options + domain data from a database. Is there a standard way to construct such a tag? Should I just write the whole thing by hand? Should I write it be calling the other tag classes? David Corbin
Re: RE: Most Urgent - html:select tag
Hi jay... Thank you for your urgent reply. i'm trying out , but confused. will u please, send one example? sandeep On Sat, 25 Aug 2001 Jay Patel wrote : Short answer: html:select property=designId html:options collection=designs property=id labelProperty=name/ /html:select Long answer can be found at http://jakarta.apache.org Jay Patel 972-701-9773 972-849-0373 Mobile [EMAIL PROTECTED] -Original Message- From: s k m [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:10 PM To: [EMAIL PROTECTED] Subject: Most Urgent - html:select tag Hi all... Please, inform me how to implement html:select tag? I'm stuck up there. Please, help. Sandeep
Re: Re: Most Urgent - html:select tag
Hi Supriya.. thank you.. will u please send me one example on it? how to iterate it? Sandeep On Sat, 25 Aug 2001 SUPRIYA MISRA wrote : Hi Sandeep --Hope this helps html:select property=facCd html:options collection=FACILITY property=facCd labelProperty=facDes / /html:select From: s k m [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Most Urgent - html:select tag Date: 24 Aug 2001 19:09:43 - Hi all... Please, inform me how to implement html:select tag? I'm stuck up there. Please, help. Sandeep - _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
RE: RE: Most Urgent - html:select tag
From the subscription.jsp of the struts-example: %-- In real life, these would be loaded from a database --% % java.util.ArrayList list = new java.util.ArrayList(); list.add(new org.apache.struts.webapp.example.LabelValueBean(IMAP Protocol, imap)); list.add(new org.apache.struts.webapp.example.LabelValueBean(POP3 Protocol, pop3)); pageContext.setAttribute(serverTypes, list); % html:select property=type html:options collection=serverTypes property=value labelProperty=label/ /html:select Iteration is done by the tag, so don't worry. Each element of the collection will be looked up, from each object in the collection, two properties will be looked up; namely value and label ( in above example ). You may have different properties that you may want to look-up. Previous example I sent you *was* a real code I am using. Jay Patel 972-701-9773 972-849-0373 Mobile [EMAIL PROTECTED] -Original Message- From: s k m [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:24 PM To: [EMAIL PROTECTED] Subject: Re: RE: Most Urgent - html:select tag Hi jay... Thank you for your urgent reply. i'm trying out , but confused. will u please, send one example? sandeep On Sat, 25 Aug 2001 Jay Patel wrote : Short answer: html:select property=designId html:options collection=designs property=id labelProperty=name/ /html:select Long answer can be found at http://jakarta.apache.org Jay Patel 972-701-9773 972-849-0373 Mobile [EMAIL PROTECTED] -Original Message- From: s k m [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:10 PM To: [EMAIL PROTECTED] Subject: Most Urgent - html:select tag Hi all... Please, inform me how to implement html:select tag? I'm stuck up there. Please, help. Sandeep
Cannot retrieve mapping for action /j_security_check
Hello all, I looked in the archives but couldn't find an answer to my question. I'd like to convert my working form-based login page to use struts' html form taglib. I get the following Exception when trying to load login.jsp: javax.servlet.ServletException: Cannot retrieve mapping for action /j_security_check I was hoping someone could help out with the conversion. This works: form name=login action=j_security_check method=POST table border=3 cellpadding=2 cellspacing=2 align=center tr th align=rightUsername:/th tdinput type=text name=j_username size=20/td /tr tr th align=rightPassword:/th tdinput type=password name=j_password size=20/td /tr tr align=center td colspan=2input type=submit value=Login/td /tr /table /form This does not: html:form action=j_security_check focus=j_username table border=3 cellpadding=2 cellspacing=2 align=center tr th align=rightUsername:/th tdhtml:text property=j_username//td /tr tr th align=rightPassword:/th tdhtml:password property=j_password//td /tr tr align=center td colspan=2html:submitLogin/html:submit/td /tr /table /html:form I'm hoping all I need to do is add an entry in struts-config.xml, but I'm not sure what that entry should be. Any help would be appreciated. -ryan
RE: Cannot retrieve mapping for action /j_security_check
You will need to add the Action mapping in your struts-config.xml file. You will also need the form-bean mapping that your form will use to pass the form data to the action class. Here is an example. form-beans !-- Loin form bean -- form-bean name=loginForm type=com.dextera.examples.forms.LoginForm/ /form-beans action-mappings !-- Process a user login -- actionpath=/login type=com.dextera.examples.actions.LoginAction name=loginForm scope=request input=/login.jsp forward name=success path=/home.jsp/ /action-mappings All in all you will need the following: 1. A form bean to carry the data 2. Action servlet to perform your action 3. Form bean declaration in struts-config 4. Action mapping in struts-config Good luck. Jay Patel 972-701-9773 972-849-0373 Mobile [EMAIL PROTECTED] -Original Message- From: Shriver, Ryan [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:26 PM To: '[EMAIL PROTECTED]' Subject: Cannot retrieve mapping for action /j_security_check Hello all, I looked in the archives but couldn't find an answer to my question. I'd like to convert my working form-based login page to use struts' html form taglib. I get the following Exception when trying to load login.jsp: javax.servlet.ServletException: Cannot retrieve mapping for action /j_security_check I was hoping someone could help out with the conversion. This works: form name=login action=j_security_check method=POST table border=3 cellpadding=2 cellspacing=2 align=center tr th align=rightUsername:/th tdinput type=text name=j_username size=20/td /tr tr th align=rightPassword:/th tdinput type=password name=j_password size=20/td /tr tr align=center td colspan=2input type=submit value=Login/td /tr /table /form This does not: html:form action=j_security_check focus=j_username table border=3 cellpadding=2 cellspacing=2 align=center tr th align=rightUsername:/th tdhtml:text property=j_username//td /tr tr th align=rightPassword:/th tdhtml:password property=j_password//td /tr tr align=center td colspan=2html:submitLogin/html:submit/td /tr /table /html:form I'm hoping all I need to do is add an entry in struts-config.xml, but I'm not sure what that entry should be. Any help would be appreciated. -ryan
Re: RE: RE: Most Urgent - html:select tag
Hi Jay, this will add only text which will be displyed in drop down box. how do I set values for it? i ve hash table from which i want to keep keys as values and hashtable values as displyed text in drop down box. Sandeep On Sat, 25 Aug 2001 Jay Patel wrote : From the subscription.jsp of the struts-example: %-- In real life, these would be loaded from a database --% % java.util.ArrayList list = new java.util.ArrayList(); list.add(new org.apache.struts.webapp.example.LabelVal- ueBean(IMAP Protocol, imap)); list.add(new org.apache.struts.webapp.example.LabelVal- ueBean(POP3 Protocol, pop3)); pageContext.setAttribute(serverTypes, list); % html:select property=type html:options collection=serverTypes property=value labelProperty=label/ /html:select Iteration is done by the tag, so don't worry. Each element of the collection will be looked up, from each object in the collection, two properties will be looked up; namely value and label ( in above example ). You may have different properties that you may want to look-up. Previous example I sent you *was* a real code I am using. Jay Patel 972-701-9773 972-849-0373 Mobile [EMAIL PROTECTED] -Original Message- From: s k m [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:24 PM To: [EMAIL PROTECTED] Subject: Re: RE: Most Urgent - html:select tag Hi jay... Thank you for your urgent reply. i'm trying out , but confused. will u please, send one example? sandeep On Sat, 25 Aug 2001 Jay Patel wrote : Short answer: html:select property=designId html:options collection=designs property=id labelProperty=name/ /html:select Long answer can be found at http://jakarta.apache.org Jay Patel 972-701-9773 972-849-0373 Mobile [EMAIL PROTECTED] -Original Message- From: s k m [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:10 PM To: [EMAIL PROTECTED] Subject: Most Urgent - html:select tag Hi all... Please, inform me how to implement html:select tag? I'm stuck up there. Please, help. Sandeep
RE: RE: RE: Most Urgent - html:select tag
You are seeing that behavior is because Hashtable returns a Collection of Values when values() is invoked. It would be easier if you just had a bean that contained key and value information and have that bean in a Collection. Jay Patel 972-701-9773 972-849-0373 Mobile [EMAIL PROTECTED] -Original Message- From: s k m [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:41 PM To: [EMAIL PROTECTED] Subject: Re: RE: RE: Most Urgent - html:select tag Hi Jay, this will add only text which will be displyed in drop down box. how do I set values for it? i ve hash table from which i want to keep keys as values and hashtable values as displyed text in drop down box. Sandeep On Sat, 25 Aug 2001 Jay Patel wrote : From the subscription.jsp of the struts-example: %-- In real life, these would be loaded from a database --% % java.util.ArrayList list = new java.util.ArrayList(); list.add(new org.apache.struts.webapp.example.LabelVal- ueBean(IMAP Protocol, imap)); list.add(new org.apache.struts.webapp.example.LabelVal- ueBean(POP3 Protocol, pop3)); pageContext.setAttribute(serverTypes, list); % html:select property=type html:options collection=serverTypes property=value labelProperty=label/ /html:select Iteration is done by the tag, so don't worry. Each element of the collection will be looked up, from each object in the collection, two properties will be looked up; namely value and label ( in above example ). You may have different properties that you may want to look-up. Previous example I sent you *was* a real code I am using. Jay Patel 972-701-9773 972-849-0373 Mobile [EMAIL PROTECTED] -Original Message- From: s k m [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:24 PM To: [EMAIL PROTECTED] Subject: Re: RE: Most Urgent - html:select tag Hi jay... Thank you for your urgent reply. i'm trying out , but confused. will u please, send one example? sandeep On Sat, 25 Aug 2001 Jay Patel wrote : Short answer: html:select property=designId html:options collection=designs property=id labelProperty=name/ /html:select Long answer can be found at http://jakarta.apache.org Jay Patel 972-701-9773 972-849-0373 Mobile [EMAIL PROTECTED] -Original Message- From: s k m [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:10 PM To: [EMAIL PROTECTED] Subject: Most Urgent - html:select tag Hi all... Please, inform me how to implement html:select tag? I'm stuck up there. Please, help. Sandeep
Re: is the userguide wrong or am i wrong...
No, it should be bean:message like the others. Please feel free to report this at bugzilla. Venkat Jonnalagadda wrote: I was going through the userguide for struts on the apache site.Under the subsection 3.3.1 there is this html using the tags, I think that the prefix html is wrongly used for the message as i failed to see a tag message in struts-html.tld. I enclosed the html below and used the ##--## to point what i think might be wrong. Any idea? Venkat %@ page language=java % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % html:html head title bean:message key=logon.title/ /title body bgcolor=white html:errors/ html:form action=/logon focus=username table border=0 width=100% tr th align=right html:message key=prompt.username/ is this prefix correct? ## /th td align=left html:text property=username size=16/ /td /tr tr th align=right html:message key=prompt.password/ is this prefix correct? ## /th td align=left html:password property=password size=16/ /td /tr tr td align=right html:submit bean:message key=button.submit/ /html:submit /td td align=right html:reset bean:message key=button.reset/ /html:reset /td /tr /table /html:form /body /html:html
Re: welcome file in web.xml with pre-compiled jsp's?
In any event, it's not a bug in Struts, so you might want to take it up with the support group for your container. [EMAIL PROTECTED] wrote: Hi Bill, I just want to have what works with uncompiled jsp's work with compiled jsps! My welcome page is called index.jsp, but when I compile it and put it in a jar file, it is not found for the first page (though I can call it directly). Is this some kind of bug? Cheers, Dave PS I can work around it with a index.htm as a welcome page that redirects you with javascript to index.jsp, but that's very clumsy!
Re: welcome file in web.xml with pre-compiled jsp's?
Yep, that's the conclusion I came to. I already posted to tomcat user mailing list, but no response. Dave Ted Husted [EMAIL PROTECTED] on 08/24/2001 04:07:41 PM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc:(bcc: David Hay/Lex/Lexmark) Subject: Re: welcome file in web.xml with pre-compiled jsp's? In any event, it's not a bug in Struts, so you might want to take it up with the support group for your container. [EMAIL PROTECTED] wrote: Hi Bill, I just want to have what works with uncompiled jsp's work with compiled jsps! My welcome page is called index.jsp, but when I compile it and put it in a jar file, it is not found for the first page (though I can call it directly). Is this some kind of bug? Cheers, Dave PS I can work around it with a index.htm as a welcome page that redirects you with javascript to index.jsp, but that's very clumsy!
indexed tag
Hello, Has anyone using Tomcat run into the following error when using Ted's indexed tag: org.apache.jasper.compiler.CompileException: C:\applications\stapp-tomcat\build\stapp\app2.jsp(119,21) Attribute indexed invalid according to the specified TLD at org.apache.jasper.compiler.TagBeginGenerator.validate(TagBeginGenerator.java:170) at org.apache.jasper.compiler.TagBeginGenerator.init(TagBeginGenerator.java:119) at org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.init(JspParseEventListener.java:759) at org.apache.jasper.compiler.JspParseEventListener.addGenerator(JspParseEventListener.java:138)... I was running the application perfectly fine on weblogicbut when i switched over to Tomcat, it complains. Is it the jsp compiler or the servlet engine? thanks, cameron
RE: Cannot retrieve mapping for action /j_security_check
If you are using container-managed authentication, why use a Struts FormBean? You can get the username from the container using the getCallPrincipal() method of HttpServletRequest to get the logged in user's principal. If you absolutely want to use an ActionForm via Struts, keep reading. You will need to create a FormBean with 2 fields of type String. -- Code for LoginForm.java -- package com.yourcompany.yourapp.LoginForm; //import statements here public class LoginForm extends ActionForm { protected String j_username; protected String j_password; public LoginForm() { super(); } public void setJ_username(String j_username) { this.j_username = j_username; } public String getJ_username() { return j_username; } public void setJ_password(String j_password) { this.j_password = j_password; } public String getJ_password() { return j_password; } //other methods for ActionForm } -- End Code -- You will also have to supply the name and type parameters in the html:form tag -- code for login.jsp -- html:form name=loginForm action=j_security_check method=POST type=com.yourcompany.yourapp.LoginForm scope=session %-- Other html elements --% /html:form -- end code -- You will also need to declare your LoginForm inside struts-config.xml -- code for struts-config.xml -- struts-config form-beans form-bean name=loginForm type=com.yourcompany.yourapp.LoginForm/ !-- other form-bean declarations -- /form-beans !-- other struts-config elements -- /struts-config -- end code -- That should be it, just make sure you setup your web.xml file to use form-based login. James Hicks -Original Message- From: Shriver, Ryan [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:50 PM To: 'Jay Patel '; ''[EMAIL PROTECTED]' ' Subject: RE: Cannot retrieve mapping for action /j_security_check Thanks for the quick reply but this seems like too much work just to get some consistency across my .jsp forms. I would think there would be a way for struts to let forms posted to j_security_check pass through to the servlet container instead of the normal Action classes. I want the container, not Struts, to do my authentication/authorization. Thanks for the help though. -ryan -Original Message- From: Jay Patel To: '[EMAIL PROTECTED]' Sent: 8/24/2001 3:41 PM Subject: RE: Cannot retrieve mapping for action /j_security_check You will need to add the Action mapping in your struts-config.xml file. You will also need the form-bean mapping that your form will use to pass the form data to the action class. Here is an example. form-beans !-- Loin form bean -- form-bean name=loginForm type=com.dextera.examples.forms.LoginForm/ /form-beans action-mappings !-- Process a user login -- actionpath=/login type=com.dextera.examples.actions.LoginAction name=loginForm scope=request input=/login.jsp forward name=success path=/home.jsp/ /action-mappings All in all you will need the following: 1. A form bean to carry the data 2. Action servlet to perform your action 3. Form bean declaration in struts-config 4. Action mapping in struts-config Good luck. Jay Patel 972-701-9773 972-849-0373 Mobile [EMAIL PROTECTED] -Original Message- From: Shriver, Ryan [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:26 PM To: '[EMAIL PROTECTED]' Subject: Cannot retrieve mapping for action /j_security_check Hello all, I looked in the archives but couldn't find an answer to my question. I'd like to convert my working form-based login page to use struts' html form taglib. I get the following Exception when trying to load login.jsp: javax.servlet.ServletException: Cannot retrieve mapping for action /j_security_check I was hoping someone could help out with the conversion. This works: form name=login action=j_security_check method=POST table border=3 cellpadding=2 cellspacing=2 align=center tr th align=rightUsername:/th tdinput type=text name=j_username size=20/td /tr tr th align=rightPassword:/th tdinput type=password name=j_password size=20/td /tr tr align=center td colspan=2input type=submit value=Login/td /tr /table /form This does not: html:form action=j_security_check focus=j_username table border=3 cellpadding=2 cellspacing=2 align=center tr th align=rightUsername:/th tdhtml:text property=j_username//td /tr tr th align=rightPassword:/th tdhtml:password property=j_password//td /tr tr align=center td colspan=2html:submitLogin/html:submit/td /tr /table /html:form I'm hoping all I need to do is add an entry in struts-config.xml, but I'm not sure what that entry should be. Any help would be appreciated. -ryan
xml is html in fourletter word format
Sorry, had to to vent, been parsing/generating a lot of xml lately. The fact that xml has only three letters doesn't change my opinion! Have a good weekend folks. Kurt
Re: URL Encode for a JSP Page using Struts
Generally, I would tend to first put static parameters into the Global Forward, so they can have logical names, and then let the Struts html:link tag add whatever else was needed. If more than one set of dynamic parameter is needed, because of normalization issues, then a Map can be passed to the link tag. -Ted. Bill Clinton wrote: Ted, Maybe I am mistaken, but I think he wants to add the parameters in the perform method of his Action. So in the case the html:link tag might not work. For cases like these (and I am open to better suggestions) I have extended the Action Forward class to make a ParameterActionForward class. Here is the code: ### ParameterActionForward.java ## import org.apache.struts.action.ActionForward; import java.util.HashMap; import java.util.Iterator; /** * Implementation of strongActionForward/strong that allows requestParameters * added on to the path. * * @author Bill Clinton * @version $Id: ParameterActionForward.java,v 1.1 2001/08/17 15:24:42 bclinton Exp $ */ public final class ParameterActionForward extends ActionForward { private HashMap parameters = new HashMap(); private String path; private static final String questionMark = ?; private static final String ampersand = ; private static final String equals = =; public ParameterActionForward(ActionForward forward) { setName(forward.getName()); setPath(forward.getPath()); setRedirect(forward.getRedirect()); } public void addParameter(String paramName, Object paramValue) { addParameter(paramName,paramValue.toString()); } public void addParameter(String paramName, String paramValue) { parameters.put(paramName,paramValue); } public void setPath(String path) { this.path=path; } public String getPath() { StringBuffer sb = new StringBuffer(); sb.append(path); boolean firstTimeThrough = true; if (parameters!=null !parameters.isEmpty()) { sb.append(questionMark); Iterator it = parameters.keySet().iterator(); while (it.hasNext()) { String paramName = (String)it.next(); String paramValue = (String)parameters.get(paramName); if (firstTimeThrough) { firstTimeThrough=false; } else { sb.append(ampersand); } sb.append(paramName); sb.append(equals); sb.append(paramValue); } } return sb.toString(); } } ### End ParameterActionForward.java ## This is an example of using the class to add two parameters to a forward: ParameterActionForward forward = new ParameterActionForward( mapping.findForward(success)); forward.addParameter(id,String.valueOf(questionForm.getQuestionId())); forward.addParameter(modified,true); return forward; I hope this is useful to you Krishna. And I welcome any (constructive) peer criticism. In fact, as I was pasteing, I noticed a potential bug. I don't think this would work on forwards that didn't have redirect set to true, so play with it, test it, and modify it before you use it. I am using it for something specific and it works for me. Bill Ted Husted wrote: Then you would use a html:link tag with the actionForm as the source. http://jakarta.apache.org/struts/struts-html.html#link Bhamidi Krishna wrote: Hi Ted, thankyou for the mail, but what if mode and value (either one or both) keep getting generated dynamically dependent on the actionForm ? Krishna Just put it in as a Global Forward, something like this forward name=itemFindScript path=/do/item/Search?column=script/ or in your case forward name=something path=/do/Something?mode=21/ or, using extension mapping forward name=something path=/Something.do?mode=21/ You can also refer to Global Forwards in the link tag, and Struts will append any other parameters you supply (paramID, paramProperty). Bhamidi Krishna wrote: Hi, I have an elementary question. I want to encode the URL of my jsp page that I call using findForward() say something like a mode parameter. So my jsp url will look like: http://localhost:8080/someURL/doSomething?mode=21 How can I do that? Krishna _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/
Re: indexed tag
Disregard this message. I was able to fix the problem. The struts-html.tld file was the incorrect one. cameron - Original Message - From: cahana To: [EMAIL PROTECTED] Sent: Friday, August 24, 2001 4:10 PM Subject: indexed tag Hello, Has anyone using Tomcat run into the following error when using Ted's indexed tag: org.apache.jasper.compiler.CompileException: C:\applications\stapp-tomcat\build\stapp\app2.jsp(119,21) Attribute indexed invalid according to the specified TLDat org.apache.jasper.compiler.TagBeginGenerator.validate(TagBeginGenerator.java:170)at org.apache.jasper.compiler.TagBeginGenerator.init(TagBeginGenerator.java:119)at org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.init(JspParseEventListener.java:759)at org.apache.jasper.compiler.JspParseEventListener.addGenerator(JspParseEventListener.java:138)... I was running the application perfectly fine on weblogicbut when i switched over to Tomcat, it complains. Is it the jsp compiler or the servlet engine? thanks, cameron
OT: Configuring Weblogic External Resource
Hello All, Sorry for this posting, but I figured someone on this mailing list would have some helpful knowledge on this problem. I configured a Logger class that utilizes Log4J. I'm using an xml configuration for my logging preferences. I'm deploying to a war file to Weblogic 6.0. Does anyone know how to reference the xml file from a war file? Basically, I have my config.xml file in the classes directory of my WEB-INF directory, but my Logger class isn't finding the configuration file. It's looking in the root directory of the Weblogic installation. Any help would be great! Once again, sorry for the posting to the Struts mailing list. Have a good one, Steven application/ms-tnef
Thanxs from Sandeep
Hi Jay, Many many many thanxs. Thanxs to u we crossed a hurdle. Many more hurdles are to be crossed, but then my spirits are up. Thanxs once again. I would surely be in touch with U. Regards, Sandeep Mahajan Team
RE: Cannot retrieve mapping for action /j_security_check
Thanks for the quick reply but this seems like too much work just to get some consistency across my .jsp forms. I would think there would be a way for struts to let forms posted to j_security_check pass through to the servlet container instead of the normal Action classes. I want the container, not Struts, to do my authentication/authorization. Thanks for the help though. -ryan -Original Message- From: Jay Patel To: '[EMAIL PROTECTED]' Sent: 8/24/2001 3:41 PM Subject: RE: Cannot retrieve mapping for action /j_security_check You will need to add the Action mapping in your struts-config.xml file. You will also need the form-bean mapping that your form will use to pass the form data to the action class. Here is an example. form-beans !-- Loin form bean -- form-bean name=loginForm type=com.dextera.examples.forms.LoginForm/ /form-beans action-mappings !-- Process a user login -- actionpath=/login type=com.dextera.examples.actions.LoginAction name=loginForm scope=request input=/login.jsp forward name=success path=/home.jsp/ /action-mappings All in all you will need the following: 1. A form bean to carry the data 2. Action servlet to perform your action 3. Form bean declaration in struts-config 4. Action mapping in struts-config Good luck. Jay Patel 972-701-9773 972-849-0373 Mobile [EMAIL PROTECTED] -Original Message- From: Shriver, Ryan [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 2:26 PM To: '[EMAIL PROTECTED]' Subject: Cannot retrieve mapping for action /j_security_check Hello all, I looked in the archives but couldn't find an answer to my question. I'd like to convert my working form-based login page to use struts' html form taglib. I get the following Exception when trying to load login.jsp: javax.servlet.ServletException: Cannot retrieve mapping for action /j_security_check I was hoping someone could help out with the conversion. This works: form name=login action=j_security_check method=POST table border=3 cellpadding=2 cellspacing=2 align=center tr th align=rightUsername:/th tdinput type=text name=j_username size=20/td /tr tr th align=rightPassword:/th tdinput type=password name=j_password size=20/td /tr tr align=center td colspan=2input type=submit value=Login/td /tr /table /form This does not: html:form action=j_security_check focus=j_username table border=3 cellpadding=2 cellspacing=2 align=center tr th align=rightUsername:/th tdhtml:text property=j_username//td /tr tr th align=rightPassword:/th tdhtml:password property=j_password//td /tr tr align=center td colspan=2html:submitLogin/html:submit/td /tr /table /html:form I'm hoping all I need to do is add an entry in struts-config.xml, but I'm not sure what that entry should be. Any help would be appreciated. -ryan
RE: ServletUnit with Struts
I haven't seen ServletUnit. Where do you get it from? Can it be used to load-test a site? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 1:59 PM To: [EMAIL PROTECTED] Subject: ServletUnit with Struts Hi, I'm trying to test ActionObjects painlessly with Mock Objects of some kind; I don't want in-container test cases particularly. I'm trying to use ServletUnit, which is part of HttpUnit, as a starting point and am having a difficulty, not surprisinglym with the ActionServlet initialization. Here's a snippet of the test code: WebRequest request = new PostMethodWebRequest (http://test.meterware.com/actionServlet;); request.setParameter etc. set some parms for testing... WebResponse response = sc.getResponse(request); The above line throws an exception when I run the testcase: javax.servlet.UnavailableException: Missing configuration resource for path /WEB-INF/struts-config.xml at org.apache.struts.action.ActionServlet.initMapping(ActionServl et.java:1316) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:465) at javax.servlet.GenericServlet.init(GenericServlet.java:258) at com.meterware.servletunit.InvocationContext.getServlet(Invocat ionContext.java:69) I have added the war file for my application, which includes the /WEB-INF/struts-config.xml, at the bottom of my classpath that the testcase runs under junit with. Hmmm, just putting this email together I spotted something. The resource is obtained via getServletContext().getResourceAsStream (/WEB-INF/struts-config.xml). The servlet context must not be such that it is able to find that path in my war. Anybody used ServletUnit with Struts? Or some other Mock Objects solution? tia, Jim Weaver
Re: URL Encode for a JSP Page using Struts
Ted, Maybe I am mistaken, but I think he wants to add the parameters in the perform method of his Action. So in the case the html:link tag might not work. For cases like these (and I am open to better suggestions) I have extended the Action Forward class to make a ParameterActionForward class. Here is the code: ### ParameterActionForward.java ## import org.apache.struts.action.ActionForward; import java.util.HashMap; import java.util.Iterator; /** * Implementation of strongActionForward/strong that allows requestParameters * added on to the path. * * @author Bill Clinton * @version $Id: ParameterActionForward.java,v 1.1 2001/08/17 15:24:42 bclinton Exp $ */ public final class ParameterActionForward extends ActionForward { private HashMap parameters = new HashMap(); private String path; private static final String questionMark = ?; private static final String ampersand = ; private static final String equals = =; public ParameterActionForward(ActionForward forward) { setName(forward.getName()); setPath(forward.getPath()); setRedirect(forward.getRedirect()); } public void addParameter(String paramName, Object paramValue) { addParameter(paramName,paramValue.toString()); } public void addParameter(String paramName, String paramValue) { parameters.put(paramName,paramValue); } public void setPath(String path) { this.path=path; } public String getPath() { StringBuffer sb = new StringBuffer(); sb.append(path); boolean firstTimeThrough = true; if (parameters!=null !parameters.isEmpty()) { sb.append(questionMark); Iterator it = parameters.keySet().iterator(); while (it.hasNext()) { String paramName = (String)it.next(); String paramValue = (String)parameters.get(paramName); if (firstTimeThrough) { firstTimeThrough=false; } else { sb.append(ampersand); } sb.append(paramName); sb.append(equals); sb.append(paramValue); } } return sb.toString(); } } ### End ParameterActionForward.java ## This is an example of using the class to add two parameters to a forward: ParameterActionForward forward = new ParameterActionForward( mapping.findForward(success)); forward.addParameter(id,String.valueOf(questionForm.getQuestionId())); forward.addParameter(modified,true); return forward; I hope this is useful to you Krishna. And I welcome any (constructive) peer criticism. In fact, as I was pasteing, I noticed a potential bug. I don't think this would work on forwards that didn't have redirect set to true, so play with it, test it, and modify it before you use it. I am using it for something specific and it works for me. Bill Ted Husted wrote: Then you would use a html:link tag with the actionForm as the source. http://jakarta.apache.org/struts/struts-html.html#link Bhamidi Krishna wrote: Hi Ted, thankyou for the mail, but what if mode and value (either one or both) keep getting generated dynamically dependent on the actionForm ? Krishna Just put it in as a Global Forward, something like this forward name=itemFindScript path=/do/item/Search?column=script/ or in your case forward name=something path=/do/Something?mode=21/ or, using extension mapping forward name=something path=/Something.do?mode=21/ You can also refer to Global Forwards in the link tag, and Struts will append any other parameters you supply (paramID, paramProperty). Bhamidi Krishna wrote: Hi, I have an elementary question. I want to encode the URL of my jsp page that I call using findForward() say something like a mode parameter. So my jsp url will look like: http://localhost:8080/someURL/doSomething?mode=21 How can I do that? Krishna _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/ _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/about/struts/
RE: Security, authentication and authorisation with Struts
Jonathan: Another approach you may want to look at is the way we've done the Struts integration with our own OSS framework, Expresso: We subclass Action in our Controller class, and the Controller class actually does all of the authentication/authorization work for us. There of course more to it than that, but that's the gist - you can read about it at http://www.jcorporate.com/doc/index.html - the Expresso Developer's Guide explains about our Controller objects (basically finite-state machines that contain the application's logic) and there are a couple of write-ups in the index about how Struts and Expresso fit together. We have optional strong encryption for Expresso's entire security layer (and it's object/relational mapping layer), which is also discussed in the doc, making it possible to implement a highly secure application at all levels. Hope it's helpful! Regards, Mike Jcorporate Ltd. http://www.jcorporate.com -Original Message- From: Jonathan M Crater [mailto:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 10:45 AM To: [EMAIL PROTECTED] Subject: Re: Security, authentication and authorisation with Struts i would prefer not to put the authentication code in the action because it opens the possibility of having authentication logic in each and every action, which would essentially defeat one of the main purposes of having a controller in the first place--one point of access for security reasons. it seems to me that subclassing ActionServlet and/or adding authentication code to it are preferable to distributing the authentication logic across x number of action classes. [EMAIL PROTECTED] wrote: wouldn't it be better to put this code directly into the action servlet and rebuild struts? That goes against my code-reusability instincts. I strive to use the default struts build and default tag libraries. The other possibility would be to put this in the Action class. Before it checks the authorization, it could verify that it is in the session. If not, put it there. I don't do this because I also put an object in the application scope (for complicated reasons) and it seems silly to put this code in the Action code which is rather far from the application level. i'd also be interested in hearing the rationale behind the desire not to subclass ActionServlet from those of you who prefer to avoid it. Me too. Works fine for me. Devon
Why is it so difficult to make Struts working in JBuilder 5?
Hi, Just curious. Why is it so difficult to make Struts working with JBuilder 5? Where is the problem, Jbuilder 5 or Struts? Why can't we treat struts.jar the same as other struts, i.e., why cannot we put struts.jar into classpath? Thanks! Xin