html form widgets not appearing
My pages are showing up fine and the form Actions are working, w/ one exception, all of mypages are not displaying any of the form widgets like radio buttons or text entry boxes and even bean message keys, yet no errors are occurring. Is there anything wrong w/ the below page that would prevent forms from not showing? A problem I had before of not findingmessage keys was thatin the taglib lines where the prefix was only - prefix="bean" - and I actually needed - prefix="struts-bean", though I've seen no examples of it anywhere's, just from somebody's post, so I tried it and it worked. TIA my index.jsp --- %@ page language="java" %%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="struts-bean" %%@ taglib uri="/WEB-INF/struts-html.tld" prefix="struts-html" % html:htmlhead title bean:message key="main.title" //title %@ include file="menubar.js" %%@ include file="main.css" % /head body bgcolor="white"html:errors/ %@ include file="header.jsp" %%@ include file="mainMenu.jsp" % html:form action="view.do" table border="0" cellspacing="2" cellpadding="0" align="left" tr td html:radio property="view" value="Master View" bean:message key="main.master" /nbsp; /html:radio /td td html:radio property="view" value="Details View" bean:message key="main.detail" / /html:radio /td td center html:submit value="View"/ /center /td /tr/table /html:form br br br br br%@ include file="footer.jsp" % /body/html:html
Re: html form widgets not appearing
I don't get it, if I match prefix=struts-bean w/ a tag of bean:message key ... it can't find the keys in the properties file, which I'd say is to be expected. But if I change the prefix=bean w/ tags of bean:message ... making the prefix and tag the same like it should be, then I get the following error. 500 Internal Server Error javax.servlet.jsp.JspException: Missing message for key main.title at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:242) at /index.jsp._jspService(/index.jsp.java:136) (JSP page line 9) at com.orionserver[Orion/1.4.8 (build 10374)].http.OrionHttpJspPage.service(Unknown Source) at com.evermind[Orion/1.4.8 (build 10374)]._aj._nxd(Unknown Source) ... I traced this file in the struts code and the file is being found, the key is in the file, there are no invisible characters, but it's not find the key. - Original Message - From: Scott Cressler To: '[EMAIL PROTECTED]' Sent: Friday, April 27, 2001 5:59 PM Subject: RE: html form widgets not appearing prefix=struts-html, but tag uses are html:* ? -Original Message- From: G.L. Grobe [mailto:[EMAIL PROTECTED]] Sent: Friday, April 27, 2001 3:30 PM To: [EMAIL PROTECTED] Subject: html form widgets not appearing My pages are showing up fine and the form Actions are working, w/ one exception, all of my pages are not displaying any of the form widgets like radio buttons or text entry boxes and even bean message keys, yet no errors are occurring. Is there anything wrong w/ the below page that would prevent forms from not showing? A problem I had before of not finding message keys was that in the taglib lines where the prefix was only - prefix=bean - and I actually needed - prefix=struts-bean, though I've seen no examples of it anywhere's, just from somebody's post, so I tried it and it worked. TIA my index.jsp --- %@ page language=java % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=struts-bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=struts-html % html:html head title bean:message key=main.title / /title %@ include file=menubar.js % %@ include file=main.css % /head body bgcolor=white html:errors/ %@ include file=header.jsp % %@ include file=mainMenu.jsp % html:form action=view.do table border=0 cellspacing=2 cellpadding=0 align=left tr td html:radio property=view value=Master View bean:message key=main.master /nbsp; /html:radio /td td html:radio property=view value=Details View bean:message key=main.detail / /html:radio /td td center html:submit value=View/ /center /td /tr /table /html:form br br br br br %@ include file=footer.jsp % /body /html:html
Re: html form widgets not appearing
Title: RE: html form widgets not appearing The entire index.jsp file is included in this message so you can see the html source at the end. I havn't actually re-compiled the struts.jar file to see what was happening (because it wasn't easy to get working w/ orion server)but just by looking at MessageTag.java,I could see where in doStart() the message var came back as null and threw the exception when trying to read the key. I sawthe file it was trying to read was correct bydoing aprintln(getClass().getResource("my.properties")... in my jsp file. I'll look at this loadLocale to see how and where to use it. Thnxs. - Original Message - From: Jason Chaffee To: '[EMAIL PROTECTED]' Sent: Friday, April 27, 2001 7:09 PM Subject: RE: html form widgets not appearing What does the html source look like? You also might want to check the method loadLocale() and make sure the message strings are being loaded from the file. -Original Message----- From: G.L. Grobe [mailto:[EMAIL PROTECTED]] Sent: Friday, April 27, 2001 5:11 PM To: [EMAIL PROTECTED] Subject: Re: html form widgets not appearing Heh, I've been on this prob for almost two weeks and I'm loosing motivation in this project because of this bug. My servlet config I believe is correct. I made it as simple as possible by putting the cais.properties file in the ~/WEB-INF/classes dir (no package path) and saying: !-- Action Servlet Configuration -- servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuecais/param-value /init-param Other keys are not being found as well. I know the correct file is being found as I println the ...getClass().getResources("cais.properties") and it shows it's got the correct path and according to the struts code, it's finding the file, but not the key. I'm pretty sure I'm referencing the key correclty: %@ page language="java" % %@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" % %@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" % html:html head title bean:message key="main.title" / /title - Original Message - From: "Scott Cressler" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 27, 2001 6:58 PM Subject: RE: html form widgets not appearing Well, at least now you know you're invoking the bean:message tag. ;-) That's a problem I've found with debugging custom tags: if you forget the taglib directive or screw it up, you get no complaints. It seems to be saying it can't find your message by that key. Can you find any messages? Do you have the correct reference to the properties file in your web.xml file, e.g.: !-- Action Servlet Configuration -- servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuecom.propel.webapp.Resources/param-value /init-param In my case, that means the file is at webapproot/classes/com/propel/webapp/Resources.properties . I don't think it necessarily has to be there (isn't there some search path for finding it?), but that has worked for me (using resin). Make sure you can find any message and then make sure your tag is referencing the message key correctly, e.g., I would expect given what you've said it would be: bean:message key="main.title"/ Scott -Original Message- From: G.L. Grobe [mailto:[EMAIL PROTECTED]] Sent: Friday, April 27, 2001 4:51 PM To: [EMAIL PROTECTED] Subject: Re: html form widgets not appearing I don't get it, if I match prefix="struts-bean" w/ a tag of bean:message key ... it can't find the keys in the properties file, which I'd say is to be expected. But if I change the prefix="bean" w/ tags of bean:message ... making the prefix and tag the same like it should be, then I get the following error. 500 Internal Server Error javax.servlet.jsp.JspException: Missing message for key main.title at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag .java:242) at /index.jsp._jspService(/index.jsp.java:136) (JSP page line 9) at com.orionserver[Orion/1.4.8 (build 10374)].http.OrionHttpJspPage.service(Unknown Source) at com.evermind[Orion/1.4.8 (build 10374)]._aj._nxd(Unknown Source) ... I traced this file in the struts code and the file is being found, the key is in the file, there are no invisible characters, but it's not find the key. - Original Message - From: Scott Cressler To: '[EMAIL PROTECTED]' Sent: Friday,
Re: html form widgets not appearing
I just commented out the load-on-startup tag and I get a new error. So my web.xml looks like this. servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuecais/param-value /init-param init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param init-param param-namevalidate/param-name param-valuetrue/param-value /init-param !-- load-on-startup1/load-on-startup -- /servlet Here's the new error. 500 Internal Server Error javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGEat org.apache.struts.util.RequestUtils.message(RequestUtils.java:285) at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:239)at /index.jsp._jspService(/index.jsp.java:148) (JSP page line 129) at com.orionserver[Orion/1.4.8 (build 10374)].http.OrionHttpJspPage.service(Unknown Source) at com.evermind[Orion/1.4.8 (build 10374)]._aj._nxd(Unknown Source)at com.evermind[Orion/1.4.8 (build 10374)].server.http.JSPServlet.service(Unknown Source) at com.evermind[Orion/1.4.8 (build 10374)]._iib._vfd(Unknown Source) at com.evermind[Orion/1.4.8 (build 10374)]._iib._qjc(Unknown Source) at com.evermind[Orion/1.4.8 (build 10374)]._kj._qbc(Unknown Source)at com.evermind[Orion/1.4.8 (build 10374)]._kj._oa(Unknown Source) at com.evermind[Orion/1.4.8 (build 10374)]._jw.run(Unknown - Original Message - From: shunhui zhu [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 27, 2001 8:35 PM Subject: Re: html form widgets not appearing Just another thing to look at. The message resource is loaded at startup, in ActionServlet.initApplication(), and stored in the ServletContext with the key Action.MESSAGES_KEY (which is really the String org.apache.struts.action.MESSAGE). The message tag simply gets the resource from there. You can try to put a break point in initApplication(), and see whether the resource is read correctly there, if yes, you may want to check whether any of your Actions overwrites that key. Shunhui --- G.L. Grobe [EMAIL PROTECTED] wrote: RE: html form widgets not appearingThe entire index.jsp file is included in this message so you can see the html source at the end. I havn't actually re-compiled the struts.jar file to see what was happening (because it wasn't easy to get working w/ orion server) but just by looking at MessageTag.java, I could see where in doStart() the message var came back as null and threw the exception when trying to read the key. I saw the file it was trying to read was correct by doing a println(getClass().getResource(my.properties)... in my jsp file. I'll look at this loadLocale to see how and where to use it. Thnxs. - Original Message - From: Jason Chaffee To: '[EMAIL PROTECTED]' Sent: Friday, April 27, 2001 7:09 PM Subject: RE: html form widgets not appearing What does the html source look like? You also might want to check the method loadLocale() and make sure the message strings are being loaded from the file. -Original Message- From: G.L. Grobe [mailto:[EMAIL PROTECTED]] Sent: Friday, April 27, 2001 5:11 PM To: [EMAIL PROTECTED] Subject: Re: html form widgets not appearing Heh, I've been on this prob for almost two weeks and I'm loosing motivation in this project because of this bug. My servlet config I believe is correct. I made it as simple as possible by putting the cais.properties file in the ~/WEB-INF/classes dir (no package path) and saying: !-- Action Servlet Configuration -- servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuecais/param-value /init-param Other keys are not being found as well. I know the correct file is being found as I println the ...getClass().getResources(cais.properties) and it shows it's got the correct path and according to the struts code, it's finding the file, but not the key. I'm pretty sure I'm referencing the key correclty: %@ page language=java % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:html head title bean:message key=main.title / /title - Original Message - From: Scott Cressler [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 27, 2001 6:58 PM Subject: RE: html form widgets not appearing Well, at least now you know you're invoking the bean:message tag
Re: html form widgets not appearing
Ok, I just grabbed the struts nightly source from 4-27 and built it and sprinkled loadLocale() with println()'s. I got the same errors. Very true that if loadLocale does not find the file, it will not trap the error. ---My jsp page printed this -- 500 Internal Server Error javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGEat org.apache.struts.util.RequestUtils.message(RequestUtils.java:292) at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:239)at /index.jsp._jspService(/index.jsp.java:148) (JSP page line 129) at com.orionserver[Orion/1.4.8 (build 10374)].http.OrionHttpJspPage.service(Unknown Source) at com.evermind[Orion/1.4.8 (build 10374)]._aj._nxd(Unknown Source)at com.evermind[Orion/1.4.8 (build 10374)].server.http.JSPServlet.service(Unknown Source) at com.evermind[Orion/1.4.8 (build 10374)]._iib._vfd(Unknown Source) at com.evermind[Orion/1.4.8 (build 10374)]._iib._qjc(Unknown Source) - In the loadLocale() I got this on my console after starting my app server. The name line is the properties files being found, obviously my ~/WEB-INF/classes/cais.properties (configured in my web.xml) is not being found. Anyone know right off where I should be looking in order to find this stuff. -- cassia(build):/u/public/orion# java -jar orion.jar Auto-unpacking /u/build/release/cais.ear... done. Auto-unpacking /u/build/release/cais/cais-web.war... done. Auto-deploying cais (Assembly had been updated)... Auto-deploying cais-ejb.jar (ejb-jar.xml had been touched since the previous deployment)... done. Orion/1.4.8 initialized Auto-deploying CAIS (Assembly had been updated)... name = org/apache/struts/util/LocalStrings_en_US.properties name = org/apache/struts/util/LocalStrings_en.properties name = org/apache/struts/util/LocalStrings.properties key = message.bundle key = lookup.bean key = lookup.target key = lookup.scope key = write.io key = lookup.method key = lookup.access - Original Message - From: Jason Chaffee [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 27, 2001 8:40 PM Subject: Re: html form widgets not appearing Actually, the file isn't loaded until getMessage() is called, so you need to check the loadLocale() method. The initApplication() just creates an instance of the resource class, it doesn't load the properties file. shunhui zhu wrote: Just another thing to look at. The message resource is loaded at startup, in ActionServlet.initApplication(), and stored in the ServletContext with the key Action.MESSAGES_KEY (which is really the String org.apache.struts.action.MESSAGE). The message tag simply gets the resource from there. You can try to put a break point in initApplication(), and see whether the resource is read correctly there, if yes, you may want to check whether any of your Actions overwrites that key. Shunhui --- G.L. Grobe [EMAIL PROTECTED] wrote: RE: html form widgets not appearingThe entire index.jsp file is included in this message so you can see the html source at the end. I havn't actually re-compiled the struts.jar file to see what was happening (because it wasn't easy to get working w/ orion server) but just by looking at MessageTag.java, I could see where in doStart() the message var came back as null and threw the exception when trying to read the key. I saw the file it was trying to read was correct by doing a println(getClass().getResource(my.properties)... in my jsp file. I'll look at this loadLocale to see how and where to use it. Thnxs. - Original Message - From: Jason Chaffee To: '[EMAIL PROTECTED]' Sent: Friday, April 27, 2001 7:09 PM Subject: RE: html form widgets not appearing What does the html source look like? You also might want to check the method loadLocale() and make sure the message strings are being loaded from the file. -Original Message- From: G.L. Grobe [mailto:[EMAIL PROTECTED]] Sent: Friday, April 27, 2001 5:11 PM To: [EMAIL PROTECTED] Subject: Re: html form widgets not appearing Heh, I've been on this prob for almost two weeks and I'm loosing motivation in this project because of this bug. My servlet config I believe is correct. I made it as simple as possible by putting the cais.properties file in the ~/WEB-INF/classes dir (no package path) and saying: !-- Action Servlet Configuration -- servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuecais/param-value /init-param Other keys are not being
Re: html form widgets not appearing
Are you sure it's up to the app server to pass the found resources to struts. I thought I passed over some code where struts did the reading of params from web.xml? Therefore making it a struts problem. - Original Message - From: Jason Chaffee [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 27, 2001 11:59 PM Subject: Re: html form widgets not appearing If you have everything set correctly as you say, there might be a bug with you app server and its ability to find resources. G.L. Grobe wrote: Ok, I just grabbed the struts nightly source from 4-27 and built it and sprinkled loadLocale() with println()'s. I got the same errors. Very true that if loadLocale does not find the file, it will not trap the error. ---My jsp page printed this -- 500 Internal Server Error javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGEat org.apache.struts.util.RequestUtils.message(RequestUtils.java:292) at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:239) at /index.jsp._jspService(/index.jsp.java:148) (JSP page line 129) at com.orionserver[Orion/1.4.8 (build 10374)].http.OrionHttpJspPage.service(Unknown Source) at com.evermind[Orion/1.4.8 (build 10374)]._aj._nxd(Unknown Source) at com.evermind[Orion/1.4.8 (build 10374)].server.http.JSPServlet.service(Unknown Source) at com.evermind[Orion/1.4.8 (build 10374)]._iib._vfd(Unknown Source) at com.evermind[Orion/1.4.8 (build 10374)]._iib._qjc(Unknown Source) - In the loadLocale() I got this on my console after starting my app server. The name line is the properties files being found, obviously my ~/WEB-INF/classes/cais.properties (configured in my web.xml) is not being found. Anyone know right off where I should be looking in order to find this stuff. -- cassia(build):/u/public/orion# java -jar orion.jar Auto-unpacking /u/build/release/cais.ear... done. Auto-unpacking /u/build/release/cais/cais-web.war... done. Auto-deploying cais (Assembly had been updated)... Auto-deploying cais-ejb.jar (ejb-jar.xml had been touched since the previous deployment)... done. Orion/1.4.8 initialized Auto-deploying CAIS (Assembly had been updated)... name = org/apache/struts/util/LocalStrings_en_US.properties name = org/apache/struts/util/LocalStrings_en.properties name = org/apache/struts/util/LocalStrings.properties key = message.bundle key = lookup.bean key = lookup.target key = lookup.scope key = write.io key = lookup.method key = lookup.access - Original Message - From: Jason Chaffee [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 27, 2001 8:40 PM Subject: Re: html form widgets not appearing Actually, the file isn't loaded until getMessage() is called, so you need to check the loadLocale() method. The initApplication() just creates an instance of the resource class, it doesn't load the properties file. shunhui zhu wrote: Just another thing to look at. The message resource is loaded at startup, in ActionServlet.initApplication(), and stored in the ServletContext with the key Action.MESSAGES_KEY (which is really the String org.apache.struts.action.MESSAGE). The message tag simply gets the resource from there. You can try to put a break point in initApplication(), and see whether the resource is read correctly there, if yes, you may want to check whether any of your Actions overwrites that key. Shunhui --- G.L. Grobe [EMAIL PROTECTED] wrote: RE: html form widgets not appearingThe entire index.jsp file is included in this message so you can see the html source at the end. I havn't actually re-compiled the struts.jar file to see what was happening (because it wasn't easy to get working w/ orion server) but just by looking at MessageTag.java, I could see where in doStart() the message var came back as null and threw the exception when trying to read the key. I saw the file it was trying to read was correct by doing a println(getClass().getResource(my.properties)... in my jsp file. I'll look at this loadLocale to see how and where to use it. Thnxs. - Original Message - From: Jason Chaffee To: '[EMAIL PROTECTED]' Sent: Friday, April 27, 2001 7:09 PM Subject: RE: html form widgets not appearing What does the html source look like? You also might want to check the method loadLocale() and make sure the message strings are being loaded from the file. -Original Message- From: G.L. Grobe [mailto:[EMAIL PROTECTED]] Sent: Friday, April 27, 2001 5:11 PM To: [EMAIL PROTECTED
Re: html form widgets not appearing
The problem happens on 1.4.5, 1.4.7 and the latest (which is gotten from an autoupdate utility) 1.4.8. The earliest I can use w/ my app is 1.4.5 because of other fixes. Unfortunately, I need an EJB container, so can't use Tomcat unless I get JBoss which is a J2EE config nightmare for me at this point. I do have one struts.jar (which is not in the classpath and I removed for testing) in which I use to have ant package my *.ear file before it get's deployed to the same account I use to develop this in. But I've removed it after deployment to see if this was the problem. Nothing different. I would think since I'm using the struts controller servlet, I can use the standard resource factory implementation which is what I'm doing, as opposed to a previous suggestion to develope my own. This *seemed* easier and I'd still like to find the problem. I'm just going to have to keep sprinkling struts.jar with println()'s till I see where/how/why it's not getting this file. - Original Message - From: Dan Miser [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, April 28, 2001 12:22 AM Subject: Re: html form widgets not appearing What can you do to help isolate the problem so others can see it? I couldn't find Orion 1.48. Does the same problem happen on earlier versions? Does the same problem occur on Orion with struts-example and/or struts-test? Does the same problem occur if you move your app over to Tomcat? I know I mentioned it before, but this is the *exact* error you get if you have extra struts.jar files laying around... -- Dan Miser http://www.distribucon.com - Original Message - From: G.L. Grobe [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, April 28, 2001 12:14 AM Subject: Re: html form widgets not appearing Are you sure it's up to the app server to pass the found resources to struts. I thought I passed over some code where struts did the reading of params from web.xml? Therefore making it a struts problem.
needed taglibs
Someone told me they thought some of my tag-libs were depricated and that I shouldn't be using them anymore. From the examples at Bluestone, I added these to my web.xml file. The web site only shows four that look to be needed. template, logic, form, bean. Are these correct? If anyone knows of which ones I should or shouldn't have, much apprecitated. Taglibs I've included in my web.xml file -- taglib taglib-uri/WEB-INF/struts-bean.tld/taglib-uri taglib-location/WEB-INF/struts-bean.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-html.tld/taglib-uri taglib-location/WEB-INF/struts-html.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-form.tld/taglib-uri taglib-location/WEB-INF/struts-form.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-logic.tld/taglib-uri taglib-location/WEB-INF/struts-logic.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-template.tld/taglib-uri taglib-location/WEB-INF/struts-template.tld/taglib-location /taglib
Struts MessageTag.java not reading property file keys
Yep, I've posted this before, but still can't find the problem. I've dug into the struts code and don't know what's going on here.I'm using Orion1.4.8 w/ linux 2.2.16. I've got some new info, if I remove my resource file, it's still being found. This after I've just done a fresh install of the server and inside a new account and there are no other resource files in my classpath or on the machine. Can anyone point me to the location where struts is find the resource file, i.e. the path it's using? 500 Internal Server Error javax.servlet.jsp.JspException: Missing message for key main.title at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java,Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at ... According to the above error and this snippit of code taken from the 4-20 tar.gz source, the properties file that my web-app is looking for*is being found* and all seems to be setup/configured correctly, otherwise theerror would be about messageTag.resources (not finding the property file). So for some reason, the key can't be gotten from the file. I've also included my properties (cais.properties) file below with this key included in it. The only thing else I think that can be wrong is the value of the args array just before the Exception is thrown and I was wondering if anyone could tell me what those might be. The linewith 'String message = resources.getMessage(locale, key, args);' must be returning null and so this is giving me the above error, but I'm not sure what's being stuffed into it or where it comes from. Any help much appreciated. - MessageTag.java public int doStartTag() throws JspException { // Acquire the resources object containing our messages MessageResources resources = (MessageResources) pageContext.getAttribute(bundle, PageContext.APPLICATION_SCOPE); if (resources == null) throw new JspException (messages.getMessage("messageTag.resources", bundle)); // Calculate the Locale we will be using Locale locale = null; try { locale = (Locale) pageContext.getAttribute(localeKey, PageContext.SESSION_SCOPE); } catch (IllegalStateException e) { // Invalidated session locale = null; } if (locale == null) locale = defaultLocale; // Construct the optional arguments array we will be using Object args[] = new Object[5]; args[0] = arg0; args[1] = arg1; args[2] = arg2; args[3] = arg3; args[4] = arg4; // Retrieve the message string we are looking for String message = resources.getMessage(locale, key, args); if (message == null) throw new JspException (messages.getMessage("messageTag.message", key)); -- ~WEB-INF/web.xml servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuecais/param-value /init-param ... -- ~/index.jsp %@ page language="java" %%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %html:htmlheadtitle bean:message key="main.title" //title -- ~WEB-INF/classes/cais.properties # C.A.I.S. Resource Bundlemain.title=CAISmain.master=Master Viewmain.detail=Detailed View
struts accessing bean:message tags from somewheres
How can I still get the following error if I've commented all my bean:message tags out from the below file? It still says key not found and w/ these tags commented, it shouldnt' even try to pull a key, correct? I do a println on the resource below to see that i'm getting the correct resource file. 500 Internal Server Error javax.servlet.jsp.JspException: Missing message for key main.title at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:242) at /index.jsp._jspService(/index.jsp.java:159) (JSP page line 133) at com.orionserver[Orion/1.4.8 (build 10374)].http.OrionHttpJspPage.service Any ideas/help appreciated. - my index.jsp -- %@ 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=main.title /-- /title %@ include file=menubar.js % %@ include file=main.css % /head body bgcolor=white html:errors/ % System.out.println(HERE ... + this.getClass().getClassLoader().getResource(cais.properties));// ... this show's i'm accessing the right *.properties file % %@ include file=header.jsp % %@ include file=mainMenu.jsp % html:form action=view.do table border=0 cellspacing=2 cellpadding=0 align=left tr td html:radio property=view value=Master View !-- bean:message key=main.master / --nbsp; /html:radio /td td html:radio property=view value=Details View !-- bean:message key=main.detail / -- /html:radio /td td center html:submit value=View/ /center /td /tr /table /html:form br br br br br %@ include file=footer.jsp % /body /html:html
Re: Struts MessageTag.java not reading properties file keys
Well, I'm using Orion so this isn't the case. I get the error just after a fresh install and configuration of a new account. Any more ideas appreciated. - Original Message - From: Tony Wang [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, April 21, 2001 3:57 PM Subject: Re: Struts MessageTag.java not reading properties file keys Hi, I got exactly the same error in VAJ-Tomcat environment when I first time load my own project after running the struts-examples successfully. It turned out that Tomcat mixed up the property files that are loaded into its environment and could not figure out who is who. Fix: Leave only the project you are working with in Tomcat's classpath and projectpaths. For me in VAJ, I have to also delete the JSP compiled servlet project to clean it up. Hope it helps, Tony From: G.L. Grobe [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Struts MessageTag.java not reading properties file keys Date: Sat, 21 Apr 2001 00:17:11 -0500 I've dug into the struts code and am posting this problem again w/ a little more info. I'm using Orion 1.4.7. 500 Internal Server Error javax.servlet.jsp.JspException: Missing message for key main.title at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java, Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at ... According to the above error and this snippit of code taken from the 4-20 tar.gz source, the properties file that my web-app is looking for is being found and all seems to be setup/configured correctly, else the error would be about messageTag.resources (not finding the property file). I've also included my properties (cais.properties) file below with this key included in it. The only thing else I think that can be wrong is the value of the args array just before the Exception is thrown and I was wondering if anyone could tell me what those might be. The line with 'String message = resources.getMessage(locale, key, args);' must be returning null and so this is giving me the above error, but I'm not sure what's being stuffed into it or where it comes from. Any help much appreciated. - MessageTag.java public int doStartTag() throws JspException { // Acquire the resources object containing our messages MessageResources resources = (MessageResources) pageContext.getAttribute(bundle, PageContext.APPLICATION_SCOPE); if (resources == null) throw new JspException (messages.getMessage(messageTag.resources, bundle)); // Calculate the Locale we will be using Locale locale = null; try { locale = (Locale) pageContext.getAttribute(localeKey, PageContext.SESSION_SCOPE); } catch (IllegalStateException e) { // Invalidated session locale = null; } if (locale == null) locale = defaultLocale; // Construct the optional arguments array we will be using Object args[] = new Object[5]; args[0] = arg0; args[1] = arg1; args[2] = arg2; args[3] = arg3; args[4] = arg4; // Retrieve the message string we are looking for String message = resources.getMessage(locale, key, args); if (message == null) throw new JspException (messages.getMessage(messageTag.message, key)); -- ~WEB-INF/web.xml servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuecais/param-value /init-param ... -- ~/index.jsp %@ page language=java % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:html head title bean:message key=main.title / /title -- ~WEB-INF/classes/cais.properties # C.A.I.S. Resource Bundle main.title=CAIS main.master=Master View main.detail=Detailed View _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
jboss2.2.1-tomcat3.2.1 w/ struts 1.0_b1 ... does it work ?
Anyone had any success w/ getting struts to work w/ JBoss2.2.1-Tomcat3.2.1. In my J2EE app, I'm having problems withthe web-app portion below. Seems it's not liking my web.xml stuff and I've already pulled out tags like welcome-file-list, now it's not liking the taglib tags and I'm not sure what's supposed to be where now. Any help appreciated. -- partialjboss output when loading my *.ear --- [Service Control] Started 25 services[Default] JBoss 2.2.1 Started in 0m:55s[EmbeddedTomcat] Warning: validation was turned on but an org.xml.sax.ErrorHandler was not[EmbeddedTomcat] set, which is probably not what is desired. Parser will use a default[EmbeddedTomcat] ErrorHandler to print the first 10 errors. Please call[EmbeddedTomcat] the 'setErrorHandler' method to fix this.[EmbeddedTomcat] Error: URI=null Line=53: Element "web-app" does not allow "taglib" here.[EmbeddedTomcat] Error: URI=null Line=58: Element "web-app" does not allow "taglib" here.[EmbeddedTomcat] Error: URI=null Line=63: Element "web-app" does not allow "taglib" here.[EmbeddedTomcat] Error: URI=null Line=68: Element "web-app" does not allow "taglib" here.[EmbeddedTomcat] Error: URI=null Line=73: Element "web-app" does not allow "taglib" here.[EmbeddedTomcat] Warning: validation was turned on but an org.xml.sax.ErrorHandler was not[EmbeddedTomcat] set, which is probably not what is desired. Parser will use a default[EmbeddedTomcat] ErrorHandler to print the first 10 errors. Please call[EmbeddedTomcat] the 'setErrorHandler' method to fix this.[EmbeddedTomcat] Error: URI=null Line=53: Element "web-app" does not allow "taglib" here.[EmbeddedTomcat] Error: URI=null Line=58: Element "web-app" does not allow "taglib" here.[EmbeddedTomcat] Error: URI=null Line=63: Element "web-app" does not allow "taglib" here.[EmbeddedTomcat] Error: URI=null Line=68: Element "web-app" does not allow "taglib" here.[EmbeddedTomcat] Error: URI=null Line=73: Element "web-app" does not allow "taglib" here.2001-04-22 06:35:34 - Ctx( ): JasperException: R( + /index.jsp + null) Unable to compile class for JSP/u/public/JBoss-2.2.1_Tomcat-3.2.1/tomcat/work/localhost_8080/_0002findex_0002ejspindex_jsp_0.java:66: Class org.apache.struts.taglib.html.HtmlTag not found.
struts MessageTag.java not reading properties file
I've dug into the struts code and amposting this problem again w/ alittle more info.I'm using Orion1.4.7. 500 Internal Server Error javax.servlet.jsp.JspException: Missing message for key main.title at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java,Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at ... According to the above error and this snippit of code taken from the 4-20 tar.gz source, the properties file that my web-app is looking for is being found and all seems to be setup/configured correctly, else the error would be about messageTag.resources (not finding the property file). I've also included my properties (cais.properties) file below with this key included in it. The only thing else I think that can be wrong is the value of the args array just before the Exception is thrown and I was wondering if anyone could tell me what those might be. The linewith 'String message = resources.getMessage(locale, key, args);' must be returning null and so this is giving me the above error, but I'm not sure what's being stuffed into it or where it comes from. Any help much appreciated. - MessageTag.java public int doStartTag() throws JspException { // Acquire the resources object containing our messages MessageResources resources = (MessageResources) pageContext.getAttribute(bundle, PageContext.APPLICATION_SCOPE); if (resources == null) throw new JspException (messages.getMessage("messageTag.resources", bundle)); // Calculate the Locale we will be using Locale locale = null; try { locale = (Locale) pageContext.getAttribute(localeKey, PageContext.SESSION_SCOPE); } catch (IllegalStateException e) { // Invalidated session locale = null; } if (locale == null) locale = defaultLocale; // Construct the optional arguments array we will be using Object args[] = new Object[5]; args[0] = arg0; args[1] = arg1; args[2] = arg2; args[3] = arg3; args[4] = arg4; // Retrieve the message string we are looking for String message = resources.getMessage(locale, key, args); if (message == null) throw new JspException (messages.getMessage("messageTag.message", key)); -- ~WEB-INF/web.xml servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuecais/param-value /init-param ... -- ~/index.jsp %@ page language="java" %%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %html:htmlheadtitle bean:message key="main.title" //title -- ~WEB-INF/classes/cais.properties # C.A.I.S. Resource Bundlemain.title=CAISmain.master=Master Viewmain.detail=Detailed View
Struts MessageTag.java not reading properties file keys
I've dug into the struts code and amposting this problem again w/ alittle more info.I'm using Orion1.4.7. 500 Internal Server Error javax.servlet.jsp.JspException: Missing message for key main.title at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java,Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at ... According to the above error and this snippit of code taken from the 4-20 tar.gz source, the properties file that my web-app is looking for is being found and all seems to be setup/configured correctly, else the error would be about messageTag.resources (not finding the property file). I've also included my properties (cais.properties) file below with this key included in it. The only thing else I think that can be wrong is the value of the args array just before the Exception is thrown and I was wondering if anyone could tell me what those might be. The linewith 'String message = resources.getMessage(locale, key, args);' must be returning null and so this is giving me the above error, but I'm not sure what's being stuffed into it or where it comes from. Any help much appreciated. - MessageTag.java public int doStartTag() throws JspException { // Acquire the resources object containing our messages MessageResources resources = (MessageResources) pageContext.getAttribute(bundle, PageContext.APPLICATION_SCOPE); if (resources == null) throw new JspException (messages.getMessage("messageTag.resources", bundle)); // Calculate the Locale we will be using Locale locale = null; try { locale = (Locale) pageContext.getAttribute(localeKey, PageContext.SESSION_SCOPE); } catch (IllegalStateException e) { // Invalidated session locale = null; } if (locale == null) locale = defaultLocale; // Construct the optional arguments array we will be using Object args[] = new Object[5]; args[0] = arg0; args[1] = arg1; args[2] = arg2; args[3] = arg3; args[4] = arg4; // Retrieve the message string we are looking for String message = resources.getMessage(locale, key, args); if (message == null) throw new JspException (messages.getMessage("messageTag.message", key)); -- ~WEB-INF/web.xml servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuecais/param-value /init-param ... -- ~/index.jsp %@ page language="java" %%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %html:htmlheadtitle bean:message key="main.title" //title -- ~WEB-INF/classes/cais.properties # C.A.I.S. Resource Bundlemain.title=CAISmain.master=Master Viewmain.detail=Detailed View
Re: struts not reading properties file
Agreed, but not the case. - Original Message - From: "Dan Miser" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, April 17, 2001 11:13 PM Subject: Re: struts not reading properties file Most likely you have a copy of struts.jar somewhere on your CLASSPATH. It only belongs in WEB-INF/lib. -- Dan Miser http://www.distribucon.com - Original Message ----- From: G.L. Grobe To: [EMAIL PROTECTED] Sent: Tuesday, April 17, 2001 10:27 PM Subject: struts not reading properties file 500 Internal Server Error javax.servlet.jsp.JspException: Missing message for key main.title at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java, Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at
message key not found
Can someone clue me in if I'm on the right track in guessing that the my.properties file is not being found because of this error. I have this message key inside ~/WEB-INF/classes/my.properties. The html lines follow below. 500 Internal Server Error javax.servlet.jsp.JspException: Missing message for key main.title at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java, Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at com.orionserver.http.OrionHttpJspPage.service(JAX, Compiled Code) at com.evermind.server.http.HttpApplication.xj(JAX, Compiled Code) at com.evermind.server.http.JSPServlet.service(JAX, Compiled Code) at com.evermind.server.http.d3.sw(JAX, Compiled Code) at com.evermind.server.http.d3.su(JAX, Compiled Code) at com.evermind.server.http.ef.s1(JAX, Compiled Code) at com.evermind.server.http.ef.do(JAX, Compiled Code) at com.evermind.util.f.run(JAX, Compiled Code) %@ page language="java" % %@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" % %@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" % html:html head title bean:message key="main.title" / /title Any help much appreciated.
Re: struts can't find properties file
I'm using Orion 1.4.7 --- cais.properties file # C.A.I.S. Resource Bundlemain.title=CAIS main.master=Master Viewmain.detail=Detailed View Thnxs - Original Message - From: Abraham Kang To: [EMAIL PROTECTED] Sent: Friday, April 13, 2001 4:39 PM Subject: RE: struts can't find properties file Hey G.L. Which app server are you using? Can we take a look at cais.properties file? --Abraham -Original Message-From: G.L. Grobe [mailto:[EMAIL PROTECTED]]Sent: Friday, April 13, 2001 2:18 PMTo: [EMAIL PROTECTED]Subject: struts can't find properties file I've got the cais.properties file in the ~/WEB-INF/classes dir. Here's the error and below that is the section of web.xml that points to the properties file and below that is the section of index.jsp with the message key itself. Any help much appreicated. 500 Internal Server Errorjavax.servlet.jsp.JspException: Missing message for key main.title atorg.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java,Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at ... servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuecais/param-value /init-param %@ page language="java" %%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %html:htmlheadtitle bean:message key="main.title" //title
Re: struts can't find properties file
didn't work w/ either the directory or the directory and filename. - Original Message - From: "Charlemagne L. Rey" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, April 13, 2001 4:57 PM Subject: Re: struts can't find properties file try adding the location of that resource file on your classpath...
Re: struts can't find properties file
Anyone know ifthis error means it's finding the file but not the key, or just not finding the file. 500 Internal Server Errorjavax.servlet.jsp.JspException: Missing message for key main.title at - Original Message - From: G.L. Grobe To: [EMAIL PROTECTED] Sent: Friday, April 13, 2001 4:18 PM Subject: struts can't find properties file I've got the cais.properties file in the ~/WEB-INF/classes dir. Here's the error and below that is the section of web.xml that points to the properties file and below that is the section of index.jsp with the message key itself. Any help much appreicated. 500 Internal Server Errorjavax.servlet.jsp.JspException: Missing message for key main.title atorg.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java,Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at ... servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuecais/param-value /init-param %@ page language="java" %%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %html:htmlheadtitle bean:message key="main.title" //title
help with 'message key=main.title
I've included the error, web.xml, and a partial of index.jsp with short explanation just before each. I'm getting this error when I browse to my index.jsp file. 500 Internal Server Error javax.servlet.jsp.JspException: Missing message for key main.title at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java, Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at com.orionserver.http.OrionHttpJspPage.service(JAX, Compiled Code) at com.evermind.server.http.HttpApplication.xj(JAX, Compiled Code) at com.evermind.server.http.JSPServlet.service(JAX, Compiled Code) at com.evermind.server.http.d3.sw(JAX, Compiled Code) at com.evermind.server.http.d3.su(JAX, Compiled Code) at com.evermind.server.http.ef.s1(JAX, Compiled Code) at com.evermind.server.http.ef.do(JAX, Compiled Code) at com.evermind.util.f.run(JAX, Compiled Code) Here is my web.xml. In the init-param application line, I have cais and cais.properties is in my ~/WEB-INF/classes dir. --- web.xml --- servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuecais/param-value /init-param init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param init-param param-namevalidate/param-name param-valuetrue/param-value /init-param load-on-startup1/load-on-startup /servlet Below is a partial listing of the index.jsp file and the key="main.title" is what can't be found which is defined in the cais.properties file and sits in ~/WEB-INF/classes dir. -- index.jsp --- %@ page language="java" % %@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" % %@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" % html:html head title bean:message key="main.title" / /title Any help much appreciated.
Re: entity beans within an Action
So would I have to do a setAttribute to store every session? Is there someway to uniquely identify each session by it's attribute name, or how is that often handled, since I think I'm going to have to give it a unique name for each setAttribute.? Thnxs for the responses. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, April 03, 2001 8:54 AM Subject: RE: entity beans within an Action Hi Gary, To keep track of a stateful session bean (or any other object for that matter) across multiple requests, you will need to store its reference in the session using setAttribute(). You will also need to perform a check in the Action each time a request is processed to see if that object already exists- use getAttribute() and see if it returns null, and if so then create it. I suppose there are other ways to do this, but this is probably the most direct way to do it. Keep in mind that stateful session EJBs might be overkill for what you are trying to accomplish. You could just gather input and populate your same ActionForm using multiple input forms- then when the last form is submitted write the changes to the entity EJB. You will still need a session EJB to do this properly, with methods like saveUser() and getUser(), but there is no need to make it stateful. You should consider stateful if you need to write the changes after each input form is completed- if you can't wait until the last page is submitted. Regarding the field-to-field copies from an ActionForm to an Entity bean. This is the way I am doing things and it is working out nicely. Just make sure you name your fields the same and use the Struts PropertyUtils.copyProperties() method to do this work for you if possible. It would work even better if copyProperties could make simple type conversions :) Some may oppose this design- having the session EJB be aware of the ActionForm- since it somewhat couples the presentation to business, so if this bugs you then you could use an interface instead- let the session EJB be aware of the interface instead of a specific ActionForm (more details on this were posted by someone else a while back- last week I think). One thing you should not do is perform the copy operations from within the Action. Make sure you pass the entire data structure (i.e. the ActionForm) to a session EJB and let the session EJB invoke all the setters/getters on the entity EJB- either directly or via the Struts copy util. One short note on stateful session EJBs too... Some avoid using them for performance reasons. If you are building a high demand site then you may want to avoid using them. They can't be shared and pooled the same way stateless beans can- just make sure you really understand the lifecycle before you use them. I can't speak from personal experience on this, perhaps someone else can, but this is just what I hear through the grapevine. I am sure a lot depends on what EJB container you use as well. -Bob -Original Message- From: G.L. Grobe [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 03, 2001 1:43 AM To: [EMAIL PROTECTED] Subject: Re: entity beans within an Action Comments and questions below. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, April 02, 2001 10:23 PM Subject: RE: entity beans within an Action Creation of EJBs is really the job of the EJB container. The container manages the creation, passivation, destruction, etc... of the EJBs. When you "create" an EJB from your Action for example, you are just asking the container for a reference. Of course there is some overhead with looking up the bean's home interface and creating the stubs- but this should be negligible (compared with instantiation of the actual entity bean). However, If you know that many requests within the same session will need access to the same entity bean(s), you could create a stateful session bean and keep track of its reference in the session. I have an Action that spans multiple pages. I have only one ActionForm class to go w/ this Action for the multiple pages, so the user makes multiple submits on the same ActionForm. This part I don't get. If I've done a lookup and gotten the reference of this stateful session bean, how is that returned reference kept for the next time the Action is called, afterall, the Action was destroyed. Must I do another lookup everytime the Action is called to get the reference to the session bean? I can understand how the session bean itself can hold a reference to the entity bean, since the stateful session bean itself persists. Also, I guess as the last step in my conversation it's ok to do regular field-to-field copies of the ActionForm data into the entity bean. After writing all this out trying to explain it to you guys, I think I've just answered my question and am looking for a "yes, you're on the right trac
entity beans within an Action
If the life-span of an Action is only when that Action is being exec'd (which is also where I implemented my session bean since it's life-span is also not neccesary to hang around), where should entity beans be initialized and populated by data held in the ActionForm bean? Seems if I init'd them within the Action, I'd be creating a new Bean everytime it ran through that Action, same w/ the session. Am I going about this wrong? Any help much appreciated.
session bean in action
I'm getting the error at the bottom and would like to know if there's anything special I need to do inside an Action. Server type is Orion 1.4.5. ConfigBuildBean - Session Bean ConfigBuildHome - EJBHome ConfigBuild - EJBObject -- ejb-jar.xml session descriptionUsed in the configuration of new builds./description display-nameBuild Configuration Session Bean/display-name ejb-namecom.neuroquest.cais.ejb.config.ConfigBuildBean/ejb-name ejb-classcom.neuroquest.cais.ejb.config.ConfigBuildBean/ejb-class homecom.neuroquest.cais.ejb.config.ConfigBuildHome/home remotecom.neuroquest.cais.ejb.config.ConfigBuild/remote session-typeStateless/session-type transaction-typeContainer/transaction-type /session Session Bean Implementations -- public class NewAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { // turn form instance into custom form bean. NewForm newForm = (NewForm) form; //String viewName = newForm.getView(); String initCtxFactory = getInitParameter(Context.INITIAL_CONTEXT_FACTORY); String providerURL = getInitParameter(Context.PROVIDER_URL); try { Properties env = System.getProperties(); env.put(Context.INITIAL_CONTEXT_FACTORY, initCtxFactory); env.put(Context.PROVIDER_URL, providerURL); Context ctx = new InitialContext(env); ConfigBuildHome home = (ConfigBuildHome) ctx.lookup("ConfigBuildBean"); ConfigBuild cfgBuild = home.create(); cfgBuild.saveConfig(); } catch (Exception e) { log(e); e.printStackTrace(); } ... - The Error -- cassia(root):/u/public/orion# java -jar orion.jar Auto-unpacking /u/build/release/cais.ear... done. Auto-deploying cais-ejb.jar (ejb-jar.xml had been touched since the previous deployment)... done. Orion/1.4.5 initialized javax.naming.NameNotFoundException: ConfigBuildHome not found at com.evermind.server.rmi.RMIContext.lookup(JAX, Compiled Code) at com.evermind.server.hm.f4(JAX, Compiled Code) at com.evermind.server.hm.lookup(JAX, Compiled Code) at javax.naming.InitialContext.lookup(InitialContext.java, Compiled Code) at com.neuroquest.cais.actions.NewAction.perform(NewAction.java, Compiled Code) at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja va, Compiled Code) at org.apache.struts.action.ActionServlet.process(ActionServlet.java, Compiled Code) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java, Compiled Code) at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code) at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code) at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code) at com.evermind.server.http.d3.sw(JAX, Compiled Code) at com.evermind.server.http.d3.su(JAX, Compiled Code) at com.evermind.server.http.ef.s1(JAX, Compiled Code) at com.evermind.server.http.ef.do(JAX, Compiled Code) at com.evermind.util.f.run(JAX, Compiled Code)
init'ing a session bean in Action
Probably not the right group and I'm new to ejb's and am having a problem getting a sesson bean going from within an Action class (a class from the apache struts framework which probably doesn't make a difference what the class is). Is this on the right track to doing this correctly, though I get the following error. javax.naming.NameNotFoundException: ConfigHome not found at com.evermind.server.rmi.RMIContext.lookup(JAX, Compiled Code) at com.evermind.server.hm.f4(JAX, Compiled Code) at com.evermind.server.hm.lookup(JAX, Compiled Code) at javax.naming.InitialContext.lookup(InitialContext.java, Compiled Code) My Sesson bean is made up of the following:ConfigHome - home interfaceConfigBean - session beanConfig - ejbobject interface My ejb-jar.xml file looks like this. session display-nameConfiguration Session Bean/display-name ejb-namecom.neuroquest.cais.ejb.config.Config/ejb-name homecom.neuroquest.cais.ejb.config.ConfigHome/home remotecom.neuroquest.cais.ejb.config.Config/remote ejb-classcom.neuroquest.cais.ejb.config.ConfigBean/ejb-class session-typeStateless/session-type /session Any help much appreciated. --public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String initCtxFactory = getInitParameter(Context.INITIAL_CONTEXT_FACTORY); String providerURL = getInitParameter(Context.PROVIDER_URL); try { Properties env = System.getProperties(); env.put(Context.INITIAL_CONTEXT_FACTORY, initCtxFactory); env.put(Context.PROVIDER_URL, providerURL); Context ctx = new InitialContext(env); ConfigHome home = (ConfigHome) ctx.lookup("ConfigHome"); ConfigBean cfgBean = home.create(); cfgBean.doMyMethod(); } catch (Exception e) { log(e); e.printStackTrace(); }
ActionServlets calling Actions
From the API of the Action class: "The controller (ActionServlet) will select an appropriate Action for each request, create an instance (if necessary), and call the perform method." I have working Actions getting data from my client and populating the ActionForms, but now that I'm adding a session bean, how do I do what's explained above. What I'm needing the servlet for is to have the init() method of the Servlet initiate my session context.According to the Action class docs, I need to have an ActionServlet call the appropriate Actions. Any examples Any help much appreciated.
Re: ActionServlets calling Actions
I thought the Action class I've been using was the controller as it returns several different jsp's depending upon the outcome the population of ActionForms. I have a very simple example going, jsp's that use Action's in the form method tag. Is this not considered the controller? I think this is my point of confusion. I'm trying to figure out what's meant in the Action api, which states "The controller (ActionServlet) will select an appropriate Action for each request, create an instance (if necessary), and call the perform method." Do I need to create an ActionServlet (which will be the controller)? How does that then select an appropriate Action, any examples anywheres? And then, maybe anyone have examples of how session beans are tied in to all this. - Original Message - From: "Craig R. McClanahan" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, March 25, 2001 6:44 PM Subject: Re: ActionServlets calling Actions On Sun, 25 Mar 2001, G.L. Grobe wrote: From the API of the Action class: "The controller (ActionServlet) will select an appropriate Action for each request, create an instance (if necessary), and call the perform method." I have working Actions getting data from my client and populating the ActionForms, but now that I'm adding a session bean, how do I do what's explained above. I'm not sure quite what you are referring to when you say "what's explained above". The sentence you quoted is done by the controller servlet on each request. What I'm needing the servlet for is to have the init() method of the Servlet initiate my session context.According to the Action class docs, I need to have an ActionServlet call the appropriate Actions. Any examples The init() method of the servlet is not the right place to initialize a session. That is because init() is called only when the web application itself is first started (and then it's called only once). You would use the init() method to set up *application* scope things, rather than *session* scope things. In a servlet 2.2 environment, the best place to set up session stuff is in the Action that handles your login. For example, the example application does this (LogonAction) to create a User bean in session scope, once the user has been logged on successfully. Any help much appreciated. Craig
Actions and Session Beans
I've finally got struts taglibs and a few Actions working in my jsp pages, but I'd like to be able to populate some EJB's with the model data from the ActionForms. I'm not sure how to do this. I've got a session bean which operates on an entity bean which I will then send to another machines java app, but I'm not sure how to implement the session bean in my Action. Anyone know of examples or where I may find some refs on doing this?
init'ing session beans in an Action
I finally have my struts tags working. Next step. My app has jsp pages that populate ActionForms. I now have to populate my entity beans, but one step at a time, so I'm trying to instantiate session beans from my Action classes (which will later operate on the entity beans) and I'm not sure how this is done. I thought that the JNDI init context stuff would go in the init() method of a servlet, but with Actions, not sure if this is correct as I couldnt' override the init() method. Or should my action class be extending from ActionServlet instead of Action? Any help much appreciated.
Re: getter methods ...
Thanxs, I thought it was supposed to be the same case as what was in the getter method. Thnxs again. - Original Message - From: "Matthew O'Haire" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, March 20, 2001 9:56 PM Subject: RE: getter methods ... Hi, I think the culprit is in your JSP.. html:radio property="View" value="Master View" The property names are case-sensitive. Try property="view".
a simple struts test
Should my struts-config.xml have to be configured if I'm just testing to see ifI can get struts working w/ Orion. I've been having trouble getting struts working with orion 1.4.5. I've done everything the struts docs have said for the install and taken out all struts*.tld's from the struts.jar (removed, andwhich is in my WEB-INF/lib dir) and put them in theWEB-INF dir. Made the correct entries to web.xml. So I think I've got everything needed for a basic test of jsp's w/ a very simple config. I'm wondering if I need to do the controller, config files,etc.. for a simple test like this. %@ page language="java" %%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" % html:htmlheadtitle bean:message key="main.title" //title/head bodyhtml:errors / This is a atest./body/html:html Any help much appreciated.
how does a jsp find the resource file
I've been following the examples trying to get struts working w/ orion. When I go to a url like http://localhost/cais/index.jsp, I expect the following jsp test page to show up. But since it's mapped to the action servlet in the web.xml file (below), and since the jsp page has no reference to a servlet, how does it know where to find the resource properties file that's in the web.xml? - index.jsp - %@ page language="java" % %@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" % %@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" % html:html head title bean:message key="main.title" / /title /head body html:errors / This is a atest. /body /html:html - web.xml - The mapping in the ~/WEB-INF/web.xml file has the following entry: servlet servlet-nameaction/servlet-name servlet-class org.apache.struts.action.ActionServlet /servlet-class init-param param-nameapplication/param-name param-valuecom.neuroquest.cais.resources.cais/param-value /init-param /servlet - I have a file called cais.properties within the com/neuroquest/cais/resource directory. I keep getting the following error: 500 Internal Server Error javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE at org.apache.struts.util.RequestUtils.message(RequestUtils.java, Compiled Code) at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java, Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at com.orionserver.http.OrionHttpJspPage.service(JAX, Compiled Code) at com.evermind.server.http.HttpApplication.xj(JAX, Compiled Code) at com.evermind.server.http.JSPServlet.service(JAX, Compiled Code) at com.evermind.server.http.d3.sw(JAX, Compiled Code) at com.evermind.server.http.d3.su(JAX, Compiled Code) at com.evermind.server.http.ef.s1(JAX, Compiled Code) at com.evermind.server.http.ef.do(JAX, Compiled Code) at com.evermind.util.f.run(JAX, Compiled Code) Any help much appreciated.