DynaBean Soup

13 08 2007

Java Struts.. now where do I start?

EXACTLY how I felt going thru the abundant (but mostly repetitive) tutorial available online. The model-view-controller stuff is enough to put ur head in a whirl spin.

So let’s start with an IDE:

  • Notepad: Ha! Good luck with that!
  • NetBeans: resource eating monster!
  • Eclipse: we have a winner!

Eclipse is pretty awesome for struts (thanks to the Exadel plugin). Problem is on a bad day, it’ll hang a zillion times but on a good day, u can go on struting ur stuff till kingdom comes 😀

One thing about struts is it’s flexibility. You can’t do stuff like

<html:link href="user.do?edit=<%=editFlag%>">Edit User</html:link>

instead you’ll have to place the entire link into editURL variable

<html:link href="<%=editURL%>">Edit User</html:link>

which i suppose is much “safer”.

Another thing about a struts application, your jsp pages can end up containing html, struts tags, Javascript, Java or all of the above coz when a struts tag don’t work the way i want it to (blardy <html:checkbox>) i end up using the good ol reliable html tags which leaves me wondering why on earth am i using struts then?!

Why?

for 1, the auto form validation saves u a ton of code! that is.. if u get it to work and u’re dealing with simple validation.

2. displaying a populated listbox has never been so easy!
<html:select property="favColour" value='<%= request.getParameter("favColour")%>'">
<html:options collection="colours" property="value" labelProperty="description"/>
</html:select>

3. DynaBeans – Oh How I Love Thee!! i call it the recyclable classes. don’t have to create and write new .java classes, just set as many properties as u like.

DynaBean userBean = new LazyDynaBean();
userBean.set("First Name", "John");
userBean.set("Last Name", "Doe");

4. <bean:define> can save ur coding arse all because u can declare it’s type. Yes my friends.. ALL data types! including java.util.ArrayList and java.lang.String[]

so end of the day project, am pretty sure there’s more tricks and what-nots that makes struts coders life easier.. i just haven’t found it yet and tis why i started this blog 😛

Happy Coding Amigos

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: