Joseph Hatton

Greenhorn
+ Follow
since Dec 12, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Joseph Hatton

Hi, All.

I think development is dependent on the project. I think some of people tend to take what they know and design around it. One project, I developed my own framework and other project, I decided to use Struts. In my current project, I am using JSF. AND in another project, the client piece was written in .NET but the backend was J2EE.

And just because something is popular or mature doesn't mean that people will use it just because of the trend or for the sake of popularity. I used Struts long time ago when it wasn't even popular and the name was barely used!

I guess it depends on what you know and what the requirements demand.
20 years ago
JSP
Thanks, Gregg.

I am not familiar with Tapestry, but I heard good things about it. I will have to look into it.

20 years ago
JSP
Hi, all.

I am very sadden by some of the comments made about Struts. I don't understand what is meant by bloated and complex. If you mean "bloated" by the size, the total size of Struts1.1 of the TLDs, JARs, and XMLs is approximately 1.4 meg which is rather small size. If you mean "bloated" by the amount of functionality, I am pretty impressed by the amount of functionality packed in Struts1.1. It has client and server validation, built-in error handling, templating, JSP custom tags, and internationalization. I would like to see other frameworks that have these functionality and still be considered "lightweight". If you mean "bloated" in terms of performance, we have mission critical Struts applications running on 5 different servers(Tomcat,WebSphere, WebLogic,JRun,JBoss) and its performance and response time are great!

There has been a growing trend to use Struts. Struts has provided solid foundation for building small, medium, and large applications. Mastercard, Monsanto, IBM, Express Scripts, Anheiser-Busch,Citicorp and etc. etc. Temendous amount of companies that has implemented Struts speaks for itself. A good example is IBM's implementation of Struts in their WebSphere 5.0 admin tool for deploying web apps and server configurations.

Whether it is a small, medium or large app, the biggest and strongest advantage of Struts is it MVC pattern! In web application, there has been a evolutionary movement from Model I to Model II type design. Strut's framework is to separate the business logic from the presentation logic. Of course, if you have 2 static pages you would not want to use Struts. Or you can build your own framwork. However, the amount of time it takes to create the data access layer, error handling and business layer, it would be about the same amount of using Struts. Also, Struts is a framework. It is exactly that...a framework. It is not suppose to provide every functionality like POJO graphs. It suppose to provide basic web mechanics like session management,handling request/response and fowarding, so you can concentrate on the business aspect of the application.


If you think Struts is complex, you haven't seen JSF(Java Server Faces). The learning curve of JSF is higher than Struts. JSF framework concept is totally different than Struts in that the components are tied directly the the form and higher abstactions like actionListener, dataTables, changeListeners, action,

So please if you make a blanket generalization, I would appreciate that you clarify and state your reasoning behind your claim. I expect statements like that from green horns like me.
20 years ago
JSP
Hi, James.

Until I get more info about the project it is difficult to decipher the exception. To me, it sounds like a JSTL version problem. About halfway through the exception, it was trying parse through a directive that it could not understand. The big indication is the "JasperException". I ran into similar problems in my JSP. I notices that you are using the latest version to Tomcat which uses JSP 2.0, JSTL1.1 and Servlet 2.4. And when you went to JBoss 3.2.5, the exception got resolved.

From my inference, I would say that you were using JSTL 1.0 and when you moved to JBoss 3.2.5(JBoss 3.2.3 was using Tomcat 4.x) with Tomcat 4.x which uses Servlet 2.3

Here is the breakdown:
JSTL 1.1 requires Servlet 2.4
JSTL 1.0 requires Servlet 2.3
And little 1st 2 line changes in the web.xml
20 years ago
JSP
Hi, all!

Correct. JavaScript is executed on the client-side. But that doesn't mean that JSTL can't be evaluated and mixed with JavaScript. Not only can you pass JSTL evaluated code to JavaScript function, you can add JSTL code within the <script></script> tags.

I was caught by surprise when I could do this and set the proper window size. Here is a good example:

<script>
var totalDocSize = <c ut value="${retrieveDocumentForm.numOfSvgPages}"/>;
<!-- Use a different set of values when there are versions involved -->
<c:choose>
<c:when test="${retrieveDocumentForm.versionSize > 1}">
var toolbarHeight = 100;
var maxHeight = 200;
var maxWidth = 230;
</c:when>
<c therwise>
var toolbarHeight = 130;
var maxHeight = 190;
var maxWidth = 170;
</c therwise>
</c:choose>
var rowHeight = 20;
var printPageHight = 40;
var thumbnailHeight = rowHeight * Math.round(((totalDocSize / 4) + 1));
var totalHeight = toolbarHeight + thumbnailHeight + printPageHight;
if (totalHeight > maxHeight) {
totalHeight = maxHeight
}
create_window(wins-1,440,10,maxWidth,totalHeight)
</script>


However, I don't recommend mixing and matching JSTL with JavaScript. Just in case you can to port this to a JS file, you might have to rip out all of the JSTL expression. Personally, I do try to minimize JSTl and JavaScript mix.
20 years ago
JSP
I agree with Bear. Not that scriplets are bad, but implicitly we see it as a negative coding practice.
20 years ago
JSP
Hi, all!

The reason I said that it was weird is because I would NOT have given the correct answer. I am usually slow and methodical instead of fast and quick-witted! I have been to alot of inteviews where their goal it to trip you up instead of finding out what you know. If I had to truly anwser that question, I would respond like this: "I don't know that answer, but anyone that wanted to find the solution could go on the internet to look that up on http://www.javaranch.com

20 years ago
Junilu Lacar,

Thanks for the correction. I should have mention that normally, you cannot access parameter values unless it is properly mappe in the Struts-config.xml form. However, Index parameter ONLY applies to String Arrays. You cannot do that to list of Person object, Address object or Any Bean objects. I should have stated clearly my intentions.
20 years ago
Hi, all.

Of course it is in its early stage but any issues to bugs is because of JSF 1.0. I noticed that JSP imported from another JSP acted kinda weird. I recommend that you update JSF 1.0 to JSF 1.1. I haven't seen a bug in the mid-size project I have completed.

Actually, you can get data from a GET through JSF:
If you have a link http://localhost:8080/jsf/main.jsf?userid=joseph&pwd=test, you can access the parameters this way:
FacesContext ctx = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest)ctx.getExternalContext().getRequest();
String userid = request.getParameter("userid");
String pwd = request.getParameter("pwd");

Where you invoke the actionListener or the data binding, the GET values are always available through the FacesContext in JSF.

Actually, I just got finished with moving data from one listbox to another listbox. The functionality occurred where there were able to select multple items from the list and hit the ">>" button to move it to the seletected listbox. The great thing about this is that it did not require one single line of JavaScript. It was all done through JSF.

I think the biggest misunderstanding that I had was comparing Struts to JSF. Or better yet, applying what I know to JSF. While Struts is servlet concentric based, where action is routed to the ActionServlet and then back to JSP for display. The concept is totally different for JSF, where all action or behavior is component based. If you have 4 buttons, you can literally tie 4 DIFFERENT BEAN to these button. Also, you have to understand the behavior of JSF. If you are using the ACTION event and ACTIONLISTENDER, which does it execute first? If you submit a FORM and ACTION is not specified(in JSF, you do not have to specifies where it goes to next), where does it go? If you submit on a form with no ACTION value, JSF will naturally submit back to the page that submiited it. Point being, there is alot more learning curve to JSF than what is being assumed. Although, it has similarites as I mentioned before, trying to compare Struts to JSF can lead you down the wrong path or leveraging it improperly.

I think any IDE is appropriate. I cannot give advice on which IDE is better than another. Currently, I am using Eclipse 3.0 and running Tomcat 5 with a plugin as my app server.

Hope that helps.
20 years ago
First off, let break this down. From the first discussion thread you have this code:

1 <logic:iterate name="multiForm" id="foo" property="keys" indexId="index" >
2 <tr><td>
3 <html:text name="multiForm" property='<%="keysIndexed["+index+"]"%>' />
4 </td></tr>
5 </logic:iterate>

I see that you are trying to leverage Struts Forms.
First line looks good. Make sure that the form "name" specified above matches the name specifed in struts-config.xml.

Third line is completely wrong.
(1)You are using the Struts Form bean name as your input textfield name. Also, what line 3 is saying that I am creating input textfield(s) with property of "keysIndexed" name. Which the property "keyIndexed" name MUST be included in the MultiFieldForm as gettters and setters. Why? When you add the Struts tag "<html:text property="somename"/>", it binds the getter and setter method to that input textfield.

(2) Unless you use Scriptlets to access the form bean, in struts you cannot access a method that has PARAMETER VALUE. getBean1(), getBean2()... Getting a method with int parameter values will not be called.

(3) To access the Form bean, this scriptlet does nothing to access the Struts Form Bean. "<%="keysIndexed["+index+"]"%>" , this is not correct. This is the correct syntax: <bean:write name="foo" property="someMethod"/>
The "id" is specified in the first line to reference the object. The bean tags are used to access the methods in the form

(4)<logic:iterate> can be very frustrating if not used properly. Especially if you are looping throught a LIST. There is a special way to loop through a list of objects.

Hope that helps. Sorry for being short winded. Doing this at work.
20 years ago
Hamlin,

If you understand Struts really well, then JSF is the next logical step. I noticed that JSF derive some of its attributes from Struts like the config file(faces-config.xml), bean mapping, and page navigation. I noticed that JSF has little more flexiblity and power than Struts. I say this because Struts makes you conform to the Action and Form structure but JSF does not. JSF strongest suite is its UI components. It ties the bean nicely to the form components. JSF has a steeper learning curve, but once I got my head around it, I really liked it.

I would recommend not using Sun Studio creator because it uses proprietary object that is not standard in JSF download. I noticed this because this one developer decided to move from Studio creator to Eclipse. Each bean created by Sun Studio Creator extended AbstractPageBean. The AbstractPageBean is referenced in the jsfcl.jar which is not included in the JSF 1.0 download. I would say be careful of using that IDE.
20 years ago
That is kinda a weird questions because why would you want to call destroy() method when you are initializing objects? destroy() method is usually added to controlling and cleaning-up threads in an applet environment. There are 3 ways of handling destroy() method:

(1) Leave out the destroy(). If this method is left out of your code. You super class destroy() method is called.
(2) Add a destroy() method with your own clean up code. So when the applet is closed or exited, the overriding destroy() method is called.
(3) Add a destroy() method to start, stop, and destroy threads.

Hope that helps.
20 years ago
Geetu,

I ran into this exact problem in my project. The key is whether you are using JSTL 1.0 or JSTL1.1. JSTL 1.0 demands that you s <c ut value"">, while JSTL 1.1 uses the direct approach of ${}. AND the most important thing is know which version of servlet your serer is using(2.3 or 2.4). I noticed that JSTL1.0 supports Servlet 2.3 and JSTL1.1 support 2.4. So, proper adjustments need to be made in your web.xml file to reflect these changes.

JSTL1.0
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">


JSTL1.1
<web-app xmlns="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 web-app_2_4.xsd" version="2.4">
20 years ago
Which version of WAS are you on? WAS 3.5,4.03.5.01? I have never heard of DataSource coming from a tab-delimited file? If you are WAS 4.0+, you have to create the DataSource through the Admin Console.

I think you need to clarify if you want to use straight JDBC connection or use the connection pooling. Straight JDBC connection does not require datasource. ONLY connection pooling requires DataSource object. Again that reside on the server because how is the server going to manage the pool of connections if it does not reside on the server.
Hashmap map = new Hashmap();
Context ctx = new InitialContext();
DataSource src = (DataSource) ctx.lookup("java:comp/env/jdbc/prod");
map.put("dsName",src);

I noticed in this code that the datasource object was put into a hashmap. To me, it seem little unorthodox because I haven't seen this done before. Is there any danger or ramifications of putting the datasource object in a Hashmap or collection?

Thanks in advance.