Re: Newbie Help: Struts 2 + Spring + Hibernate
Ryan, I just went through a similar learning process. I found that by following the model of the online tutorial, I had a lot more luck getting started than trying to start from scratch. Load up the WTP plugins for Eclipse, grab the "quickstart" zip file mentioned in the online tutorial, and use that as your starting point. Everything will already be laid out where it needs to be. You begin to understand why and how as you start adding your own functionality to the project. It really is a good learning tool. As for the Maven commands, you could use "mvn war:war" to build your WAR file. I often use "mvn install" because it builds, runs unit tests, packages, and installs the artifact in your repository. There are easily a dozen different ways to use Maven to build at various levels. As for hibernate mappings, just don't. I've found that the JPA annotations are cleaner and, in my opinion, easier! The tutorial covers those a bit, but the more advanced annotations are not difficult to catch on to. Good luck! Dave Ryan Detert wrote: I just read the Manning book on Struts 2 and understand the theory behind Struts but am a little bit confused as to how to actually implement my first app in practice. The locations of the config files, etc are a little confusing. For my development environment I'm using Maven 2 + Ecplise IDE. I'm not compiling in Eclipse at all, I want to package and everything using Maven for compatibility purposes. I have already read this tutorial: http://struts.apache.org/2.0.11.2/docs/struts-2-spring-2-jpa-ajax.html as well as the sample app in Manning's book. The files are relatively similar but always placed in different locations. For my first app, all I want to do is create a form and have the submitted values placed in a database table. Simple. For my current webapp, I have used a command like this I've had to add a few modules like hibernate to the pom.xml: mvn archetype:create -DgroupId=tutorial \ -DartifactId=tutorial \ -DarchetypeGroupId=org.apache.struts \ -DarchetypeArtifactId=struts2-archetype-starter \ -DarchetypeVersion=2.0.3-SNAPSHOT \ -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository How do I compile the webapp? I have been using 'mvn package' but it never seems to generate any errors. I have used the Ecplise plugin to reverse engineer the database I've built and each class comes with an *.hbm.xml file, do I need to worry about these? How do I know where to put config files like applicationContext.xml, every sample app I look at they seem to be in a different place? If anyone could login to my system that would be great, it would probably take anyone who knew what they were doing a very short amount of time. -thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Newbie Help: Struts 2 + Spring + Hibernate
I just read the Manning book on Struts 2 and understand the theory behind Struts but am a little bit confused as to how to actually implement my first app in practice. The locations of the config files, etc are a little confusing. For my development environment I'm using Maven 2 + Ecplise IDE. I'm not compiling in Eclipse at all, I want to package and everything using Maven for compatibility purposes. I have already read this tutorial: http://struts.apache.org/2.0.11.2/docs/struts-2-spring-2-jpa-ajax.html as well as the sample app in Manning's book. The files are relatively similar but always placed in different locations. For my first app, all I want to do is create a form and have the submitted values placed in a database table. Simple. For my current webapp, I have used a command like this I've had to add a few modules like hibernate to the pom.xml: mvn archetype:create -DgroupId=tutorial \ -DartifactId=tutorial \ -DarchetypeGroupId=org.apache.struts \ -DarchetypeArtifactId=struts2-archetype-starter \ -DarchetypeVersion=2.0.3-SNAPSHOT \ -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository How do I compile the webapp? I have been using 'mvn package' but it never seems to generate any errors. I have used the Ecplise plugin to reverse engineer the database I've built and each class comes with an *.hbm.xml file, do I need to worry about these? How do I know where to put config files like applicationContext.xml, every sample app I look at they seem to be in a different place? If anyone could login to my system that would be great, it would probably take anyone who knew what they were doing a very short amount of time. -thanks
Re: Newbie help with Struts idiom: functional if/else tags
Wow. Right on. Using the with additional attributes as shown in the wiki entry below indeed solved the problem. Thank you, and thanks to everyone else who patiently read my posts and offered help. Mark On 15Nov, Rahul Akolkar wrote: > On 11/15/05, Mark S Petrovic <[EMAIL PROTECTED]> wrote: > > I know I'll look back on this learning curve with a head-slapping > > recollection, but until then, for posterity: > > > > 1. If I remove the taglib directive in the JSP, the various tags > > are copied directly into the html output, with the browser doing its > > best to just ignore them. The plaintext tag body content is actually > > rendered, again, the result of the browser doing its best with what it > > considers unknown markup. > > > > 2. When I put the taglib directive back in, the JSP compiles and > > subsequently does something with the tag directives, as the tags are > > no longer copied into the resultant html and the default > > always seems to execute. Nor do I receive any exception output in the > > browser or in the catalina.out logfile. > > > > Whatever is misconfigured in my app is not a completely fatal situation: > > I just can't get at the scripting variables to do meaningful operations > > on them. > > > > > Match JSTL to Servlet/JSP spec. You're using JSTL 1.1, and I suspect > you don't have a Servlet 2.4 web.xml. Some details are here [1]. > > -Rahul > > [1] http://wiki.apache.org/jakarta-taglibs/FrequentlyAskedQuestions > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- Mark Petrovic Pasadena, CA USA - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie help with Struts idiom: functional if/else tags
Hi I had a similar problem a while back and found that using this instead worked: <%@ taglib uri="http://java.sun.com/jstl/core"; prefix="c" %> I don't know why. Might be worth a try. -Original Message- From: Mark S Petrovic [mailto:[EMAIL PROTECTED] Sent: 15 November 2005 16:34 To: Struts Users Mailing List Subject: Re: Newbie help with Struts idiom: functional if/else tags I know I'll look back on this learning curve with a head-slapping recollection, but until then, for posterity: 1. If I remove the taglib directive in the JSP, the various tags are copied directly into the html output, with the browser doing its best to just ignore them. The plaintext tag body content is actually rendered, again, the result of the browser doing its best with what it considers unknown markup. 2. When I put the taglib directive back in, the JSP compiles and subsequently does something with the tag directives, as the tags are no longer copied into the resultant html and the default always seems to execute. Nor do I receive any exception output in the browser or in the catalina.out logfile. Whatever is misconfigured in my app is not a completely fatal situation: I just can't get at the scripting variables to do meaningful operations on them. On 15Nov, Mark Petrovic wrote: > On 15Nov, Dave Newton wrote: > > Mark S Petrovic wrote: > > > > >which isn't even iterating over the list items. E.g, I get one > > >line of html output for the > > >tag, containing the string literal '${feature.premium}' in quotes - > > >as if expansion of ${feature.premium} is not taking place. > > > > > > > > You're using the JSP taglib directive? You have all the necessary > > JARs for JSTL? J2EE version your app server implements? > > 1. The JSP has the following taglib directive > > <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %> > > 2. In my WEB-INF/lib directory I have files and checksums > > 1677728891 20682 webapps/mx/WEB-INF/lib/jstl.jar > 1935831951 393259 webapps/mx/WEB-INF/lib/standard.jar > > from the TagLibs Standard 1.1.2 binary distrbution > > 3. I'm using Apache Tomcat/5.5.12. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- Mark Petrovic Pasadena, CA USA - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The information contained herein is confidential and is intended solely for the addressee. Access by any other party is unauthorised without the express written permission of the sender. If you are not the intended recipient, please contact the sender either via the company switchboard on +44 (0)20 7623 8000, or via e-mail return. If you have received this e-mail in error or wish to read our e-mail disclaimer statement and monitoring policy, please refer to http://www.drkw.com/disc/email/ or contact the sender. 3166 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie help with Struts idiom: functional if/else tags
On 11/15/05, Mark S Petrovic <[EMAIL PROTECTED]> wrote: > I know I'll look back on this learning curve with a head-slapping > recollection, but until then, for posterity: > > 1. If I remove the taglib directive in the JSP, the various tags > are copied directly into the html output, with the browser doing its > best to just ignore them. The plaintext tag body content is actually > rendered, again, the result of the browser doing its best with what it > considers unknown markup. > > 2. When I put the taglib directive back in, the JSP compiles and > subsequently does something with the tag directives, as the tags are > no longer copied into the resultant html and the default > always seems to execute. Nor do I receive any exception output in the > browser or in the catalina.out logfile. > > Whatever is misconfigured in my app is not a completely fatal situation: > I just can't get at the scripting variables to do meaningful operations > on them. > Match JSTL to Servlet/JSP spec. You're using JSTL 1.1, and I suspect you don't have a Servlet 2.4 web.xml. Some details are here [1]. -Rahul [1] http://wiki.apache.org/jakarta-taglibs/FrequentlyAskedQuestions - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie help with Struts idiom: functional if/else tags
Mark S Petrovic wrote: Whatever is misconfigured in my app is not a completely fatal situation: I just can't get at the scripting variables to do meaningful operations on them. Can you set a String into scope: request.setAttribute("foo", "bar"); then in a JSP do: ? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie help with Struts idiom: functional if/else tags
I know I'll look back on this learning curve with a head-slapping recollection, but until then, for posterity: 1. If I remove the taglib directive in the JSP, the various tags are copied directly into the html output, with the browser doing its best to just ignore them. The plaintext tag body content is actually rendered, again, the result of the browser doing its best with what it considers unknown markup. 2. When I put the taglib directive back in, the JSP compiles and subsequently does something with the tag directives, as the tags are no longer copied into the resultant html and the default always seems to execute. Nor do I receive any exception output in the browser or in the catalina.out logfile. Whatever is misconfigured in my app is not a completely fatal situation: I just can't get at the scripting variables to do meaningful operations on them. On 15Nov, Mark Petrovic wrote: > On 15Nov, Dave Newton wrote: > > Mark S Petrovic wrote: > > > > >which isn't even iterating over the list items. E.g, I get one line of > > >html output for the tag, containing > > >the string literal '${feature.premium}' in quotes - as if expansion of > > >${feature.premium} is not taking place. > > > > > > > > You're using the JSP taglib directive? You have all the necessary JARs > > for JSTL? J2EE version your app server implements? > > 1. The JSP has the following taglib directive > > <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %> > > 2. In my WEB-INF/lib directory I have files and checksums > > 1677728891 20682 webapps/mx/WEB-INF/lib/jstl.jar > 1935831951 393259 webapps/mx/WEB-INF/lib/standard.jar > > from the TagLibs Standard 1.1.2 binary distrbution > > 3. I'm using Apache Tomcat/5.5.12. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- Mark Petrovic Pasadena, CA USA - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie help with Struts idiom: functional if/else tags
On 15Nov, Dave Newton wrote: > Mark S Petrovic wrote: > > >which isn't even iterating over the list items. E.g, I get one line of > >html output for the tag, containing > >the string literal '${feature.premium}' in quotes - as if expansion of > >${feature.premium} is not taking place. > > > > > You're using the JSP taglib directive? You have all the necessary JARs > for JSTL? J2EE version your app server implements? 1. The JSP has the following taglib directive <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %> 2. In my WEB-INF/lib directory I have files and checksums 1677728891 20682 webapps/mx/WEB-INF/lib/jstl.jar 1935831951 393259 webapps/mx/WEB-INF/lib/standard.jar from the TagLibs Standard 1.1.2 binary distrbution 3. I'm using Apache Tomcat/5.5.12. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie help with Struts idiom: functional if/else tags
Mark S Petrovic wrote: which isn't even iterating over the list items. E.g, I get one line of html output for the tag, containing the string literal '${feature.premium}' in quotes - as if expansion of ${feature.premium} is not taking place. You're using the JSP taglib directive? You have all the necessary JARs for JSTL? J2EE version your app server implements? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie help with Struts idiom: functional if/else tags
On 15Nov, Mark Petrovic wrote: > > > > > > > Should just be Sorry. I failed to mention in my reply that I tried this, too, and it made no difference in the html output. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie help with Struts idiom: functional if/else tags
Thank you for the reply. 1. I want to say yes, Feature is a proper JavaBean, with essentials public class Feature { private boolean premium; public void setPremium(boolean b) { premium = b; } public boolean isPremium(){ return premium; } } and no overloaded methods. "features" is populated thusly ArrayList features = new ArrayList(); Feature f = new Feature(); f.setPremium(true); // e.g. features.add(f); and finally, in the Action.execute() method of the associated Struts action request.setAttribute("features", features); return (mapping.findForward(target)); where the request.setAttribute() is the share-with-JSP-view technique used by the Struts book I'm reading. 2. Failing to get the to work within in #1 above, I also tried a different tack: using instead of to cycle through the list elements that formerly treated: For the same ArrayList "features", containing instances of bean "Feature" as above and set with the same Struts Action.execute via request.setAttribute("features", features); I attempt True False which isn't even iterating over the list items. E.g, I get one line of html output for the tag, containing the string literal '${feature.premium}' in quotes - as if expansion of ${feature.premium} is not taking place. I know the issues I'm raising are very elementary, but I hope they help someone else in the process. Mark On 14Nov, Wendy Smoak wrote: > On 11/14/05, Mark S Petrovic <[EMAIL PROTECTED]> wrote: > > > > > Should just be > > Is 'feature' a proper JavaBean? The types for get(is)/set methods > match, no overloaded set methods, etc? > > -- > Wendy > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- Mark Petrovic Pasadena, CA USA - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie help with Struts idiom: functional if/else tags
On 11/14/05, Mark S Petrovic <[EMAIL PROTECTED]> wrote: > Should just be Is 'feature' a proper JavaBean? The types for get(is)/set methods match, no overloaded set methods, etc? -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie help with Struts idiom: functional if/else tags
I'm still stumbling on some details. For fwiw, "features" is put in the request scope using request.setAttribute("features", features); in the Action that provides data to this JSP view. The JSP prints false for cases where I know feature.isPremium() is true. I suspect the 'feature' scripting variable has different meanings in the two ways in which it is being used (logic:iterate tag and c:choose tag) Help is appreciated, and I'm on my way to get modern books on both Struts and JSPs. On 14Nov, Craig McClanahan wrote: > On 11/14/05, Mark S Petrovic <[EMAIL PROTECTED]> wrote: > > > > Good day. I am new to Struts, and while I am coming up to speed, I'm > > still struggling with what are surely common idioms. > > > > In a JSP, I want to output, say, a element body conditionally based > > on a given bean property. > > > > In pseudocode, I want > > > > if bean.property == true > > print X > > else > > print Y > > > > I examined the Struts Logic tags, but found no if/else construct, and > > I suspect there is a good reason for this. > > > > Does Struts culture encourage me to somehow move the solution into the > > bean itself, or is there a informed, stylish way to deal with this in > > the JSP? > > > You can easily simulate if/else (or even if - else if - else if) chains with > the JSTL tag, with nested or tags. It's > similar in spirit to using the "switch" statement in Java or C. > > Craig > > > Thank you. > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > -- Mark Petrovic Pasadena, CA USA - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie help with Struts idiom: functional if/else tags
I like this: true Larry On 11/14/05, Michael Jouravlev <[EMAIL PROTECTED]> wrote: > Use either Struts or JSTL or bare scriptlet. In > your particular case you can make the decision in the bean itself. Do > not print HTML tags from Java, this produces unmaintable and > unportable code. > > Michael. > > On 11/14/05, Mark S Petrovic <[EMAIL PROTECTED]> wrote: > > Good day. I am new to Struts, and while I am coming up to speed, I'm > > still struggling with what are surely common idioms. > > > > In a JSP, I want to output, say, a element body conditionally based > > on a given bean property. > > > > In pseudocode, I want > > > > if bean.property == true > >print X > > else > >print Y > > > > I examined the Struts Logic tags, but found no if/else construct, and > > I suspect there is a good reason for this. > > > > Does Struts culture encourage me to somehow move the solution into the > > bean itself, or is there a informed, stylish way to deal with this in > > the JSP? > > > > Thank you. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie help with Struts idiom: functional if/else tags
Thank you for the reply. Using, for example, seems to solve only half the problem. Using , I can see my way clear to True True which gives a crude if/else effect, but this is almost surely ill advised. I think the same would apply to , as I know of no "else" construct that goes with either. One could also perhaps use ... ... which looks a bit better. Thanks. Mark On 14Nov, Michael Jouravlev wrote: > Use either Struts or JSTL or bare scriptlet. In > your particular case you can make the decision in the bean itself. Do > not print HTML tags from Java, this produces unmaintable and > unportable code. > > Michael. > > On 11/14/05, Mark S Petrovic <[EMAIL PROTECTED]> wrote: > > Good day. I am new to Struts, and while I am coming up to speed, I'm > > still struggling with what are surely common idioms. > > > > In a JSP, I want to output, say, a element body conditionally based > > on a given bean property. > > > > In pseudocode, I want > > > > if bean.property == true > >print X > > else > >print Y > > > > I examined the Struts Logic tags, but found no if/else construct, and > > I suspect there is a good reason for this. > > > > Does Struts culture encourage me to somehow move the solution into the > > bean itself, or is there a informed, stylish way to deal with this in > > the JSP? > > > > Thank you. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- Mark Petrovic Pasadena, CA USA - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie help with Struts idiom: functional if/else tags
On 11/14/05, Mark S Petrovic <[EMAIL PROTECTED]> wrote: > > Good day. I am new to Struts, and while I am coming up to speed, I'm > still struggling with what are surely common idioms. > > In a JSP, I want to output, say, a element body conditionally based > on a given bean property. > > In pseudocode, I want > > if bean.property == true > print X > else > print Y > > I examined the Struts Logic tags, but found no if/else construct, and > I suspect there is a good reason for this. > > Does Struts culture encourage me to somehow move the solution into the > bean itself, or is there a informed, stylish way to deal with this in > the JSP? You can easily simulate if/else (or even if - else if - else if) chains with the JSTL tag, with nested or tags. It's similar in spirit to using the "switch" statement in Java or C. Craig Thank you. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: Newbie help with Struts idiom: functional if/else tags
Use either Struts or JSTL or bare scriptlet. In your particular case you can make the decision in the bean itself. Do not print HTML tags from Java, this produces unmaintable and unportable code. Michael. On 11/14/05, Mark S Petrovic <[EMAIL PROTECTED]> wrote: > Good day. I am new to Struts, and while I am coming up to speed, I'm > still struggling with what are surely common idioms. > > In a JSP, I want to output, say, a element body conditionally based > on a given bean property. > > In pseudocode, I want > > if bean.property == true >print X > else >print Y > > I examined the Struts Logic tags, but found no if/else construct, and > I suspect there is a good reason for this. > > Does Struts culture encourage me to somehow move the solution into the > bean itself, or is there a informed, stylish way to deal with this in > the JSP? > > Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Newbie help with Struts idiom: functional if/else tags
Good day. I am new to Struts, and while I am coming up to speed, I'm still struggling with what are surely common idioms. In a JSP, I want to output, say, a element body conditionally based on a given bean property. In pseudocode, I want if bean.property == true print X else print Y I examined the Struts Logic tags, but found no if/else construct, and I suspect there is a good reason for this. Does Struts culture encourage me to somehow move the solution into the bean itself, or is there a informed, stylish way to deal with this in the JSP? Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [offlist] Re: Newbie Help
On 7/6/05, Frasso, Anthony <[EMAIL PROTECTED]> wrote: > Thanks for your help, Rahul. My current web.xml file looks like this: > > > > "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" > "http://java.sun.com/dtd/web-app_2_3.dtd";> > > >... > > According to the wiki, it seems that I should be changing it to this: > > > >http://java.sun.com/xml/ns/j2ee"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee > http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; > version="2.4"> >... > > Do I have this right? It seems that the web-app tag attributes substitute for > the dtd definition file. Is there a good reference for the web-app tag > attribute definitions? Yes, that will indicate to Tomcat you're meaning to use the Servlet 2.4 / JSP 2.0 specs. The attributes (that I think you are refering to) are really XML artifacts, so Iook for XML and W3C XML Schema tutorials, here is one [ http://www.xml.com/pub/a/2000/11/29/schemas/part1.html ] -Rahul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [offlist] Re: Newbie Help
Thanks for your help, Rahul. My current web.xml file looks like this: http://java.sun.com/dtd/web-app_2_3.dtd";> ... According to the wiki, it seems that I should be changing it to this: http://java.sun.com/xml/ns/j2ee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4"> ... Do I have this right? It seems that the web-app tag attributes substitute for the dtd definition file. Is there a good reference for the web-app tag attribute definitions? Regards, Anthony Frasso - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [offlist] Re: Newbie Help
On 7/6/05, Frasso, Anthony <[EMAIL PROTECTED]> wrote: > Instead of doing what I would expect, it prints out the the text of > "$(project.projectId}" instead of its value. > > Note that I also tried using your JSP 2.0 recommendation, replacing the > tag with just "${project.projectId}". Same result. > See Question 1 [ http://wiki.apache.org/jakarta-taglibs/FrequentlyAskedQuestions ]. See the rest if you have another minute ;-) c:out's aren't needed. -Rahul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [offlist] Re: Newbie Help
Wendy, (and Struts Dev list) Thanks again for your help. I've started playing with the JSTL tags and they seem quite useful. This is my first Web development project, which could explain some of my confusion. I'm directly jumping into struts, so I'm not sure when some of my questions are about the Struts framework or about J2EE in general. In any case, I have a few follow up questions based on your last two emails: > Lucky you! You have some options. I believe that 'out of > the box' TC5 acts > like a JSP 1.2 container. You have to "do something" to > enable the use of > expressions througout the page. You'll have to figure out > what that is, I'm > stuck on 4.1 due to work. Once you do that, you can write > ${expr} > anywhere in the page, and it will be evaluated prior to dealing with > whatever surrounds it. I haven't found any information on configuring Tomcat 5 to work with JSP 2.0. As far as I can tell, it doesn't need any extra configuration. In any case, I've written code that should work for JSP 1.2, and then for JSP 2.0, but neither seems to work. As it stands, my application is pretty simple (I'm keeping it this way until I learn all of the ins and outs of struts). There is a login page, which contains a struts form. In the LoginAction class I load my ProjectsBean into the request object: request.setAttribute("projectsBean", new ProjecsBean()); which automatically populates the bean with the data I'd like to display. I then forward to the projects page. The following jsp page (using scriptlets, I know, *blch*), works, and does basically what I would like it to do: <% ProjectsBean projectsBean = (ProjectsBean) request.getAttribute("projectsBean"); Set projects = projectsBean.getProjects(); Iterator projectsIterator = projects.iterator(); Project project; %> Project ID Project Customer Software Version <% while (projectsIterator.hasNext()) { project = (Project) projectsIterator.next(); %> <%= project.getProjectId() %> <%= project.getProjectName() %> <%= project.getCustomerName() %> <%= project.getSoftwareVersionName() %> <% } %> I tried coding it using the JSTL tags that you recommended, which of course, is a lot cleaner: Project ID Project Customer Software Version Instead of doing what I would expect, it prints out the the text of "$(project.projectId}" instead of its value. Note that I also tried using your JSP 2.0 recommendation, replacing the tag with just "${project.projectId}". Same result. Thanks again for your help, Wendy, and to everyone who responded to my earlier post. I've forwarded this response to the list as well in case Wendy is not available again to respond. Regards, Anthony Frasso > -Original Message- > From: Wendy Smoak [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 05, 2005 7:53 PM > To: Frasso, Anthony > Subject: Re: [offlist] Re: Newbie Help > > > From: "Frasso, Anthony" <[EMAIL PROTECTED]> > > > Thanks for the quick feedback Wendy! I will indeed check out JSTL. > > (You also have a couple of replies on the list, if you didn't > see them.) > > > Actually... I am using Tomcat 5.5, which I believe uses JSP > 2.0. How > would your advice change? > > Lucky you! You have some options. I believe that 'out of > the box' TC5 acts > like a JSP 1.2 container. You have to "do something" to > enable the use of > expressions througout the page. You'll have to figure out > what that is, I'm > stuck on 4.1 due to work. Once you do that, you can write > ${expr} > anywhere in the page, and it will be evaluated prior to dealing with > whatever surrounds it. > > What that means is that you should NOT use Struts-EL. And > you won't need > the tags in my example, you can write >${project.projectName} > directly. > > You can continue using the 'Struts Classic' tags, and can use > expressions > whereever you please. Do try to avoid the Struts tags that have JSTL > equivalents-- the README file for Struts-EL might be useful > there, even > though you're not using those tags. > > It also means that when you acquire JSTL, you'll want the 1.1 version. > http://jakarta.apache.org/taglibs/doc/standard-doc/intr
Re: Newbie Help
Frasso, Anthony wrote the following on 7/5/2005 5:34 PM: <% ProjectsBean projectsBean = new ProjectsBean(); projectsBean.populate(); pageContext.setAttribute("pojectsBean", projectsBean); %> Any scope should work. Also make sure the Project object includes the appropriate (JavaBeans compliant) getter methods for the properties you want to displey. L. -- Laurie, Open Source advocate, Java geek and novice blogger: http://www.holoweb.net/~laurie/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie Help
Anthony, I'm still a newbie to struts myself, so take this email with a gain of salt (or 2). I put in a suggestion down below that may make your life easier if you have a lot of reports to deliver (or similiar items on what you are displaying). > -- Start JSP Code > > <% > ProjectsBean projectsBean = new ProjectsBean(); > projectsBean.populate(); > %> My personal opinion is that using this code negates the functionality of Struts (but I haven't seen any other part of your app or pretend to be anything but a newbie to struts still). My guess is that this is your problem, you might need to put inside the <% %> tags a request.getSession().setAttribute(projectsBean, projectsBean); or something to that effect. I could be wrong on this... See below for a solution that is *possibly* more adaptable. Suggestion: Anyhow, when I make reports for people to look at I give them 1 page with a drop down box with all the report names on it. Have an Actionform collect the report name and any other information the Struts Action then creates the object and puts it in the session and then below the submit button I have Table Code goes here. This allows me to maintain a minimal set of code to display any and all reports that the company ever wants. Add an item to the drop down box, they hit the submit button, the action grabs the data they want and I throw it into the session and redisplay the same page. In some cases I have multiple sets of logic tags for each report as there may be a wide variation of fields which need to be displayed. You could also use Tiles and design a jsp page for each individual report and inside the logic:present tags just put as well. I'm sure there's a number of ways to do it. HtH Andrew - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie Help
Frasso, Anthony wrote the following on 7/5/2005 5:34 PM: Hello, and thanks in advance for your help. I am a newbie with respect to struts, and for that matter web development in general. I am attempting to design a simple jsp page (using the struts framework) to print a table of values that are read from a bean. For now, I'll stick to trying to generate the table, and worry about any additional response from the user later. The following is code from my jsp, surrounded only by the opening and tags: -- Start JSP Code <% ProjectsBean projectsBean = new ProjectsBean(); projectsBean.populate(); %> Typically you won't want to do any logic like the above in scriplets. In other words it's better to do the above in a Servlet (ie Strut's Action) and put your 'projects' list in scope there ProjectsBean projectsBean = new ProjectsBean(); projectsBean.populate(); request.setAttribute("projects", projects); However, your code will probably work if you put your projectsBean in pageContext... <% ProjectsBean projectsBean = new ProjectsBean(); projectsBean.populate(); pageContext.setAttribute("pojectsBean", projectsBean); %> -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Newbie Help
Hello, and thanks in advance for your help. I am a newbie with respect to struts, and for that matter web development in general. I am attempting to design a simple jsp page (using the struts framework) to print a table of values that are read from a bean. For now, I'll stick to trying to generate the table, and worry about any additional response from the user later. The following is code from my jsp, surrounded only by the opening and tags: -- Start JSP Code <% ProjectsBean projectsBean = new ProjectsBean(); projectsBean.populate(); %> Project Customer Software Version -- End JSP Code The ProjectsBean object contains a Set object that is populated from a database with the populate() method. The Set object is populated with Project objects, each containing a projectId, projectName, customerName, and softwareVersionName. I'd simply like to print out this information. I'd like to use as much of the struts tag libraries as possible, without resorting to inline java code. The code above does not work as I would expect it to. Any tips on where I am going wrong? Regards, Anthony Frasso - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie Help html:text conditional arguments
OK, I found it and that works. George Sexton MH Software, Inc. http://www.mhsoftware.com/ Voice: 303 438 9585 > -Original Message- > From: George Sexton [mailto:[EMAIL PROTECTED] > Sent: Friday, March 25, 2005 10:45 AM > To: 'Struts Users Mailing List' > Subject: RE: Newbie Help html:text conditional arguments > > OK, I found the EL stuff. I'll try it. > > George Sexton > MH Software, Inc. > http://www.mhsoftware.com/ > Voice: 303 438 9585 > > > > -Original Message- > > From: George Sexton [mailto:[EMAIL PROTECTED] > > Sent: Friday, March 25, 2005 10:38 AM > > To: 'Struts Users Mailing List'; 'Hubert Rabago' > > Subject: RE: Newbie Help html:text conditional arguments > > > > How would I do this? I upgraded all of the jars to 1.2.4 > > version of struts, > > and copied the TLDs and DTDs, but the READONLY attribute is > > still not set. > > > > George Sexton > > MH Software, Inc. > > http://www.mhsoftware.com/ > > Voice: 303 438 9585 > > > > > > > -Original Message- > > > From: Hubert Rabago [mailto:[EMAIL PROTECTED] > > > Sent: Friday, March 25, 2005 9:45 AM > > > To: Struts Users Mailing List > > > Subject: Re: Newbie Help html:text conditional arguments > > > > > > It's possible you just need to update your taglib > > declarations to use > > > the EL version of the tags. > > > > > > Hubert > > > > > > > > > On Fri, 25 Mar 2005 11:41:41 -0500, Rick Reumann > > > <[EMAIL PROTECTED]> wrote: > > > > What is it doing wrong? Getting errors? What does the > > > resulting html src > > > > code look like? > > > > > > > > George Sexton wrote the following on 3/24/2005 10:45 PM: > > > > > I'm running into a problem with Struts, and I admit I'm a > > > newbie to it. > > > > > > > > > > I have a line in a JSP file: > > > > > > > > > > > > > > > > > > > > What I'd like to do is conditionally have readonly set: > > > > > <% > > > > > request.setAttribute("my_attr","true"); > > > > > %> > > > > > > > > > > > > > > > But it doesn't seem to work. I'm doing something > > similar with JSTL > > > > > FMT:MESSAGE. > > > > > > > > > > What is it I'm doing wrong? > > > > > > > > > > > > > > > George Sexton > > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie Help html:text conditional arguments
OK, I found the EL stuff. I'll try it. George Sexton MH Software, Inc. http://www.mhsoftware.com/ Voice: 303 438 9585 > -Original Message- > From: George Sexton [mailto:[EMAIL PROTECTED] > Sent: Friday, March 25, 2005 10:38 AM > To: 'Struts Users Mailing List'; 'Hubert Rabago' > Subject: RE: Newbie Help html:text conditional arguments > > How would I do this? I upgraded all of the jars to 1.2.4 > version of struts, > and copied the TLDs and DTDs, but the READONLY attribute is > still not set. > > George Sexton > MH Software, Inc. > http://www.mhsoftware.com/ > Voice: 303 438 9585 > > > > -Original Message- > > From: Hubert Rabago [mailto:[EMAIL PROTECTED] > > Sent: Friday, March 25, 2005 9:45 AM > > To: Struts Users Mailing List > > Subject: Re: Newbie Help html:text conditional arguments > > > > It's possible you just need to update your taglib > declarations to use > > the EL version of the tags. > > > > Hubert > > > > > > On Fri, 25 Mar 2005 11:41:41 -0500, Rick Reumann > > <[EMAIL PROTECTED]> wrote: > > > What is it doing wrong? Getting errors? What does the > > resulting html src > > > code look like? > > > > > > George Sexton wrote the following on 3/24/2005 10:45 PM: > > > > I'm running into a problem with Struts, and I admit I'm a > > newbie to it. > > > > > > > > I have a line in a JSP file: > > > > > > > > > > > > > > > > What I'd like to do is conditionally have readonly set: > > > > <% > > > > request.setAttribute("my_attr","true"); > > > > %> > > > > > > > > > > > > But it doesn't seem to work. I'm doing something > similar with JSTL > > > > FMT:MESSAGE. > > > > > > > > What is it I'm doing wrong? > > > > > > > > > > > > George Sexton > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie Help html:text conditional arguments
How would I do this? I upgraded all of the jars to 1.2.4 version of struts, and copied the TLDs and DTDs, but the READONLY attribute is still not set. George Sexton MH Software, Inc. http://www.mhsoftware.com/ Voice: 303 438 9585 > -Original Message- > From: Hubert Rabago [mailto:[EMAIL PROTECTED] > Sent: Friday, March 25, 2005 9:45 AM > To: Struts Users Mailing List > Subject: Re: Newbie Help html:text conditional arguments > > It's possible you just need to update your taglib declarations to use > the EL version of the tags. > > Hubert > > > On Fri, 25 Mar 2005 11:41:41 -0500, Rick Reumann > <[EMAIL PROTECTED]> wrote: > > What is it doing wrong? Getting errors? What does the > resulting html src > > code look like? > > > > George Sexton wrote the following on 3/24/2005 10:45 PM: > > > I'm running into a problem with Struts, and I admit I'm a > newbie to it. > > > > > > I have a line in a JSP file: > > > > > > > > > > > > What I'd like to do is conditionally have readonly set: > > > <% > > > request.setAttribute("my_attr","true"); > > > %> > > > > > > > > > But it doesn't seem to work. I'm doing something similar with JSTL > > > FMT:MESSAGE. > > > > > > What is it I'm doing wrong? > > > > > > > > > George Sexton > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Newbie Help html:text conditional arguments
The readonly attribute is not output. George Sexton MH Software, Inc. http://www.mhsoftware.com/ Voice: 303 438 9585 > -Original Message- > From: Rick Reumann [mailto:[EMAIL PROTECTED] > Sent: Friday, March 25, 2005 9:42 AM > To: Struts Users Mailing List > Subject: Re: Newbie Help html:text conditional arguments > > What is it doing wrong? Getting errors? What does the > resulting html src > code look like? > > George Sexton wrote the following on 3/24/2005 10:45 PM: > > I'm running into a problem with Struts, and I admit I'm a > newbie to it. > > > > I have a line in a JSP file: > > > > > > > > What I'd like to do is conditionally have readonly set: > > <% > > request.setAttribute("my_attr","true"); > > %> > > > > > > But it doesn't seem to work. I'm doing something similar with JSTL > > FMT:MESSAGE. > > > > What is it I'm doing wrong? > > > > > > George Sexton > > MH Software, Inc. > > http://www.mhsoftware.com/ > > Voice: 303 438 9585 > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > -- > Rick > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie Help html:text conditional arguments
It's possible you just need to update your taglib declarations to use the EL version of the tags. Hubert On Fri, 25 Mar 2005 11:41:41 -0500, Rick Reumann <[EMAIL PROTECTED]> wrote: > What is it doing wrong? Getting errors? What does the resulting html src > code look like? > > George Sexton wrote the following on 3/24/2005 10:45 PM: > > I'm running into a problem with Struts, and I admit I'm a newbie to it. > > > > I have a line in a JSP file: > > > > > > > > What I'd like to do is conditionally have readonly set: > > <% > > request.setAttribute("my_attr","true"); > > %> > > > > > > But it doesn't seem to work. I'm doing something similar with JSTL > > FMT:MESSAGE. > > > > What is it I'm doing wrong? > > > > > > George Sexton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Newbie Help html:text conditional arguments
What is it doing wrong? Getting errors? What does the resulting html src code look like? George Sexton wrote the following on 3/24/2005 10:45 PM: I'm running into a problem with Struts, and I admit I'm a newbie to it. I have a line in a JSP file: What I'd like to do is conditionally have readonly set: <% request.setAttribute("my_attr","true"); %> But it doesn't seem to work. I'm doing something similar with JSTL FMT:MESSAGE. What is it I'm doing wrong? George Sexton MH Software, Inc. http://www.mhsoftware.com/ Voice: 303 438 9585 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Newbie Help html:text conditional arguments
I'm running into a problem with Struts, and I admit I'm a newbie to it. I have a line in a JSP file: What I'd like to do is conditionally have readonly set: <% request.setAttribute("my_attr","true"); %> But it doesn't seem to work. I'm doing something similar with JSTL FMT:MESSAGE. What is it I'm doing wrong? George Sexton MH Software, Inc. http://www.mhsoftware.com/ Voice: 303 438 9585 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]