MVC with Struts?

If you are going to implement the MVC pattern in a webapp, what is the best framework to use?
I've done a tutorial with Struts. Is that a good framework?
Is there any disadvantages by using such frameworks?

If you are going to implement the MVC pattern in a
webapp, what is the best framework to use? None if you can do without it. The best solution is always the simplest. But you'd have to provide some requirements to get a better answer. Let me just say I've seen many projects that simply read/write small amounts of data from the database and display it on a web page, yet the architect will throw in struts, hibernate, etc. and almost all of the time (IMO) it's overkill.
I've done a tutorial with Struts. Is that a good
framework?Some people love it. Some people hate it. IMO it has many, many problems and I don't care for it one bit. However, it's very popular and lots of people use it, so it's not a bad skillset to have.
Is there any disadvantages by using such frameworks?There are tons of disadvantages:
1. The API is external (i.e. out of your control) so when it breaks you can't do anything but hack the source.
2. Performance can be a problem, since you've got an extra layer of software to run through, but usually isn't. Struts for example isn't going to bog you down.
3. It costs time (i.e. $$$) to train and come up to speed on how to use these frameworks. If you already know Java and have a small project you could likely complete it in the time it'd take you to learn struts.
4. Compatibility. When the latest version of struts comes out for example, you might want to upgrade to get the latest features, but you might find it breaks the old API and now you have to fix a bunch of code because it's not backwards compatible. That's probably rare, but it's happened to me more than once with struts.
5. Struts documentation (IMO) is horrible (maybe it's better today? i haven't used it in awhile) and it's not fun to learn.
6. Struts error messages are ridiculous and it's often very difficult to figure out what went wrong. Whereas in core Java I find the error messages to be very helpful in telling me what I did wrong.
The list goes on and on and on. Frameworks are bad news for many projects and then again they are saviors for others.

Similar Messages

  • InputText issue with Struts

    I'm using jsf 1.1 with struts 1.3.5 and am experiencing an issue with the inputText element. The problem is the name attribute being generated is not allowing the form bean's attributes to be set. For example:
    <h:inputText id="username" value="#{loginForm.username}"/>
    generates
    <input id="_idJsp3:username" name="_idJsp3:username" type="text" value=""/>
    The issue being the name of the field is _idJsp3:username so the form property 'username' is not getting set. I've tried removing the inputText tag and replacing it with this:
    <input name="username" type="text"/>
    And it works. What's the deal? I know a lot of people have used/are using JSF and struts together, what am I doing wrong?
    By the way, this is the last hurdle i need to clear so any help would be appreciated.

    first - thanks for your reply
    I can understand what you mean , to adhere to the MVC conception , we need to have any action go through the controler .
    but , once I wanna access to a jsp file , then I need to set a global-forward and a ForwardAction , when time goes by, and the project keeps getting larger , so there will be too many forwards and FrowardActions , right ?
    actually , I have a Office.jsp , which has a frameset inside , left and right,each invokes a jsp file like this :
    <frameset rows="*" cols="144,*" framespacing="2" frameborder="NO" border="2" bordercolor="#CC0000">
    <frame src="OfficeLeft.jsp" name="leftFrame" scrolling="NO" noresize>
    <frame src="Notification.jsp" name="RightFrame">
    </frameset>
    when I have successfully forwarded to this Office.jsp , it prompts OfficeLeft.jsp and Notification.jsp are not available. so my problem is I don't know how to get this work fine .

  • Error 500, deployment with struts

    An application developed in JDeveloper 9.02 with struts 1.1b works fine when running using the local OC4J instance running from JDeveloper. I created a deployment profile with a .war and .ear, deployed to the OC4J standalone instance using the EM website, and all seemed well. Now it sporadically gives the "Internal Server Error" when navigating between pages. I can't find anything in the logs, and ideas?

    It's OC4J core install for 9iAS Release 9.02. I've deployed to Solaris since there is a bug that can give this error that is patched for Solaris, but not Windows. The error occurs when navigating pages in a struts app. Sometimes it works fine, then you click on one of the image buttons to go to the next .jsp and this error comes up.
    Ruth
    What version of OC4J you are testing on ?
    Is it OC4J standalone or Oracle9iAS that you are using.
    more details would be helpful in diagnosing the problem.
    -Prasad

  • WLS 8.1 sp1 with Struts 1.1 JSP with bean tag won't compile

              Hello,
              We are currently porting our application which uses struts 1.1 to WLS 8.1 sp1
              from another app server. Everything seems to deploy correctly and pages which
              use struts tags appear to compile and run fine. However, the pages with struts
              <bean:define> tags are not compiling.
              Example JSP Code:
              <bean:define id="userForm" name="userForm" scope="session" toScope="page" type="UserFormBean"/>
              <% if (userForm.hasUserData()) {hasUser=true;} %>
              WLS Console Output:
              ..jsp_servlet\_jsp\_sailor\__home.java:493: cannot resolve symbol
              symbol : variable userForm
              location: class jsp_servlet._jsp._sailor.__home
              if (userForm.hasUserData()) { //[ /jsp/sailor/home.jsp; Line: 38]
              When I look at the JSP's parsed java code (__home.java:493) I find that nowhere
              in the class is the variable userForm declared.
              Is this a bug in WLS? Does anyone know of a workaround?
              Thanks,
              Scott
              

    Please contact customer support [email protected] and request a patch for
              CR112789. AT_END tags do not work correctly in 81sp1
              --Nagesh
              "Scott Fleming" <[email protected]> wrote in message
              news:3f734c0d$[email protected]..
              >
              > Hello,
              >
              > We are currently porting our application which uses struts 1.1 to WLS 8.1
              sp1
              > from another app server. Everything seems to deploy correctly and pages
              which
              > use struts tags appear to compile and run fine. However, the pages with
              struts
              > <bean:define> tags are not compiling.
              >
              > Example JSP Code:
              >
              > <bean:define id="userForm" name="userForm" scope="session" toScope="page"
              type="UserFormBean"/>
              >
              > <% if (userForm.hasUserData()) {hasUser=true;} %>
              >
              > WLS Console Output:
              >
              > ..jsp_servlet\_jsp\_sailor\__home.java:493: cannot resolve symbol
              > symbol : variable userForm
              > location: class jsp_servlet._jsp._sailor.__home
              > if (userForm.hasUserData()) { //[ /jsp/sailor/home.jsp; Line:
              38]
              >
              > When I look at the JSP's parsed java code (__home.java:493) I find that
              nowhere
              > in the class is the variable userForm declared.
              >
              > Is this a bug in WLS? Does anyone know of a workaround?
              >
              > Thanks,
              > Scott
              

  • Custom tag with struts

    Hi
    I would like to create a custom tag that will print this section of html with struts:<tr>
         <td class="f_name"><bean:message bundle="fields" key="firstName" /></td>
         <td class="f_value"><html:text property="firstName" /></td>
    </tr>This means that i sould pass to the custom tag the folowing attributes:
    1. bundle - the bundle name to use ("fields").
    2. property - the name of the submitted filed and the key in the bundle resource ("firstName").
    This is how i want to use it:<html:form action="/register.do" enctype="UTF-8">
    <table cellspacing="0" cellpadding="0" border="0" class="t_details">
    <mytld:text bundle="fields" key="firstName"/>
    <mytld:text bundle="fields" key="lastName"/>
    </html:form>For me, this way looks much easier to develop my application/s, don't you agree?
    The problem is that i can't (or i don't know how) to use custom tags in other a custom tag, and if i include a jsp file (with pageContext.indlude("url");), how do i pass the attributes to the jsp page?
    Thanks a lot
    mamtz

    Interesting answer, i'll put it in my mind, but this is not what i ment :) (nice thinking...)
    what i ment was, html:text tag has many attributes like: property, name, alt, size, maxLength and so on...
    i would like sometimes to use size or maxLength and sometimes not.
    take a look at what i wrote:<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%
         String property=""+request.getAttribute("property");
         String bundle=""+request.getAttribute("bundle");
         Object max=request.getAttribute("maxLength");
         String maxLength= max==null ? "" : ""+max;
         Object s=request.getAttribute("size");
         String size= s==null ? "" : ""+s;
    %>
         <tr>
              <td class="f_name"><bean:message bundle="<%=bundle%>" key="<%=property%>" /></td>
    <%     if(max!=null && s!=null){
    %>          <td class="f_value"><html:text property="<%=property%>" maxlength="<%=maxLength%>" size="<%=size%>" /></td>
    <%     }else if(max!=null){
    %>          <td class="f_value"><html:text property="<%=property%>" maxlength="<%=maxLength%>" /></td>
    <%     }else if(s!=null){
    %>          <td class="f_value"><html:text property="<%=property%>" size="<%=size%>" /></td>
    <%     }else{
    %>          <td class="f_value"><html:text property="<%=property%>" /></td>
    <%     }
    %>     </tr>pretty complicated, is'nt it?
    think what would happen if i would like to add just one more attribute...

  • Easiest way to validate with Struts?..

    Hello,
    I have a problem with validating a simple form with javascript via Struts validator. It inserts the whole javascript instead <html:javascript formName="whatever"/> and as a result half of the html code that follows gets cut off. I don't know why this happens, maybe because the javascript is so big (although that sounds like nonsense).
    Is there a better, simpler way to validate with Struts? I just want something to start working..
    Thanks.

    Make sure you have validator-rules.xml file in WEB-INF/ folder
    Make sure you have validation.xml file in WEB-INF/ folder
    Modifty validation.xml file to match your form name (as defined in struts-config.xml)
    i think this should be enough

  • Problem with FileUpload with Struts

    Hello,
    Here is my form I've created :
    <html:form action="/UploadFile.do" method="post" enctype="multipart/form-data">
    <html:file property="file" />
    </html:form>
    The form I submit conatins a "file" attribute of FileForm type.
    I did exatcly as mentionned in different tutorials to upload files with Struts.
    But I get the following exception and I can't figure out what's happening:
    javax.servlet.ServletException: BeanUtils.populate
    at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
    java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    Please Help !
    I'm using Struts 1.1 by the way
    Thank your for your help
    Hugo

    What is in the form bean you're using? You need a field that holds a FormFile object:
    import org.apache.struts.upload.*;
         private FormFile file;
         public FormFile getFile() {
              return this.file;
         public void setFile(FormFile file) {
              this.file = file;
    ...

  • How to use displaytags with struts

    How to use display tags with struts to generate report from database

    I think it would only consist in including the tag library of displaytags in the header and use the prefix of desplay tags.
    Exporting the report from a database would only need to retrieve this information from the database as a List, Map or Collection of objects (beans) and display tem with the corresponding tag (table)
    You have some more information here:
    http://displaytag.sourceforge.net/11/tut_basic.html
    Regards and good luck,
    Fran Serrano.

  • Exception Handling of JboException with Struts

    Hi,
    I am using BC4J with Struts. The struts <html:errors/> tag displays all the exception messages generated by ActionErrors and JboExceptions automatically. The problem i have is, I get a Jbo-26041 exception when i try to create a duplicate primary key. I have caught the exception in the ***Impl.java file in the doDML() method and I want to ignore the exception but want to display a message through the <html:errors/> tag. How can i do that???
    When i dont catch the jbo-26041 exception the application crashes and when i catch the exception i donno how to show the message in the <html:errors/> tag of struts.
    Need Help... a.s.a.p.
    ~Faraz
    The code is:
    protected void doDML(int operation, TransactionEvent e)
    try{
    super.doDML(operation, e);
    catch (JboException ex)
    if ("26041".equals(ex.getErrorCode()))
    //*** WHAT TO DO HERE ***//
    }

    repost

  • Exception Handling of JboException with Struts  Jun 25, 2003 9:46 AM

    Hi,
    I am using BC4J with Struts. The struts <html:errors/> tag displays all the exception messages generated by ActionErrors and JboExceptions automatically. The problem i have is, I get a Jbo-26041 exception when i try to create a duplicate primary key. I have caught the exception in the ***Impl.java file in the doDML() method and I want to ignore the exception but want to display a message through the <html:errors/> tag. How can i do that???
    When i dont catch the jbo-26041 exception the application crashes and when i catch the exception i donno how to show the message in the <html:errors/> tag of struts.
    And can I somehow show the error messages through the adderrors() method of EditAction or UpdateAction ???
    Need Help... a.s.a.p.
    ~Faraz
    The code is:
    protected void doDML(int operation, TransactionEvent e)
    try{
    super.doDML(operation, e);
    catch (JboException ex)
    if ("26041".equals(ex.getErrorCode()))
    //*** WHAT TO DO HERE ***//
    }

    repost

  • How to use custumer DataTagsLibrary for BC4J in the JSP's with Struts Suppo

    I've been looking for a good tutorial to learn very well
    BC4J, DataTags Library for JSP , all with struts support.
    But it's dificult to join all this topics.
    Can someone help.
    If you have any answer for me, plesea send an e-mail to
    [email protected]

    Try these links:
    http://radio.weblogs.com/0118231/ - Look for the Toy Store demo.
    http://otn.oracle.com/sample_code/tutorials/bc4jvsm/content.html - The new Shopping Mall tutorial.
    http://otn.oracle.com/products/jdev/howtos/content.html - The JDeveloper how to list.
    Also, check frequently on the JDeveloper forum here on OTN.
    HTH.
    Thanks, George

  • Steps of Integrating JSF with struts

    Can anybody tell me the steps of intrgrate JSF with Struts
    Regds
    Amit Verma

    It's a better idea to upgrade your memory amount up to at least 1GB.

  • Project titles in J2ee with struts

    Hi,
    I am final year BE student. I want some efficient project titles in j2ee with struts. Thanks in advance.

    > I m in need of some project titles in j2ee.can
    anybody help me plzzzzzzz
    1) JBuzzword
    2) ActivePudding
    3) Gonad
    Try one of those, for starters.why not combine them into a single project title?

  • How to deploy servlets with struts in weblogic61sp2 ?

              I success to config a web app with struts framework via welogic61 admin console,but
              I only saw the first page but I cannot sumit to next page. (Of course,it's right
              if I set struts.jar's classpath and web app jar in my system classpath.But it's
              a bad solution.)
              Here is my startWebLogic.cmd:
              @rem set CLASSPATH=%CLASSPATH%;%PLATFORM%\src\lib\struts.jar
              set STARTMODE=false
              My Folder Structure:
              WEB-INF
                   ->classes->...
                   ->lib->struts.jar,servlet23.jar,...
                   web.xml
                   weblogic.xml
                   index.jsp
              My errors info on the weblogic console:
              validate loginName
              admin
              8
              123456
              6
              java.lang.NoClassDefFoundError: org/apache/struts/action/ActionErrors
              at kava.web.FormUtility.getErrorFields(FormUtility.java:382)
              at kava.module.authentication.web.LoginForm.validate(LoginForm.jav
              a:118)
              at org.apache.struts.action.ActionServlet.processValidate(ActionServlet.
              java:2106)
              at org.apache.struts.action.ActionServlet.process(ActionServlet.java:156
              4)
              at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              pl.java:265)
              at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:21)
              at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
              va:27)
              at kava.web.JspFilter.doFilter(JspFilter.java:82)
              at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
              va:27)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
              rvletContext.java:2501)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
              pl.java:2204)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              client connection:1 closed.server connection id:0
              LocalTransXAWrapper:end
              LocalTransXAWrapper:rollback
              rollback transaction(server connection id:0)
              Cleaning up the connection
              clean up server connection:0
              What's wrong I made ? Any suggestions are very welcome !
              

    Christian,
              When you put the struts.jar in the classpath, everything works correctly? And then
              when you remove the struts.jar from the classpath and put it in the web-inf/lib it
              fails? According to the stack trace, the server appears to be able to find some of the
              struts files. Can you explain what the "kava" classes are doing? Are they part of the
              struts package?
              Thanks,
              Simon Nunn
              Developer Relations Engineer
              BEA Support
              Christian Lee wrote:
              > I success to config a web app with struts framework via welogic61 admin console,but
              > I only saw the first page but I cannot sumit to next page. (Of course,it's right
              > if I set struts.jar's classpath and web app jar in my system classpath.But it's
              > a bad solution.)
              >
              > Here is my startWebLogic.cmd:
              > ---------------------------
              > ..
              > @rem set CLASSPATH=%CLASSPATH%;%PLATFORM%\src\lib\struts.jar
              > ..
              > set STARTMODE=false
              > ..
              > ----------------------------
              >
              > My Folder Structure:
              > ----------------------------
              > WEB-INF
              > ->classes->...
              > ->lib->struts.jar,servlet23.jar,...
              > web.xml
              > weblogic.xml
              > index.jsp
              > ...
              > --------------------------------------------
              >
              > My errors info on the weblogic console:
              > ----------------------------------------------
              > validate loginName
              > admin
              > 8
              > 123456
              > 6
              > java.lang.NoClassDefFoundError: org/apache/struts/action/ActionErrors
              > at kava.web.FormUtility.getErrorFields(FormUtility.java:382)
              > at kava.module.authentication.web.LoginForm.validate(LoginForm.jav
              > a:118)
              > at org.apache.struts.action.ActionServlet.processValidate(ActionServlet.
              > java:2106)
              > at org.apache.struts.action.ActionServlet.process(ActionServlet.java:156
              > 4)
              > at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
              >
              > at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
              > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              > at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
              > pl.java:265)
              > at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:21)
              > at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
              > va:27)
              > at kava.web.JspFilter.doFilter(JspFilter.java:82)
              > at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.ja
              > va:27)
              > at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
              > rvletContext.java:2501)
              > at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
              > pl.java:2204)
              > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              > client connection:1 closed.server connection id:0
              > LocalTransXAWrapper:end
              > LocalTransXAWrapper:rollback
              > rollback transaction(server connection id:0)
              > Cleaning up the connection
              > clean up server connection:0
              >
              > -----------------------------------------------------
              > What's wrong I made ? Any suggestions are very welcome !
              

  • How Ajax works with Struts framework

    How Ajax works with Struts framework .
    Thanks
    Ramki

    So we must write file name(like abc.do), If am using struts <html:link > tag like <html:like action="abc" >Click</html:link>, so with ajax we must call like <a href ="abc.do">Click</a> .
    But there is a problem, if am using ,
    <servlet-mapping>
    <servlet-name>MainServlet</servlet-name>
    <url-pattern>/r/*</url-pattern>
    </servlet-mapping>
    or
    <servlet-mapping>
    <servlet-name>MainServlet</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    here i am changing web.xml file based on client interest. At those situation we must change all jsp pages for <a href ="/r/abc">Click</a> .like,.
    It's very difficult.
    Is any other way to use ajax with Struts (Only struts tags)
    Thanks
    Ramki

Maybe you are looking for

  • Best Practice for ESS/ MSS role customization

    Hi , I would want to know the best practice for role customization for ESS / MSS business package . For eg if my company does not want to use someof the workset like working time , travel etc , what is the best practice for this scenario . anEEZ

  • Traditional Chinese character?

    We all know that the support for Traditional Chinese is excluded in iPad, make no difference to me since I don't use Chinese, both Simplified Chinese or Traditional Chinese character. But I still would like to know, Can iPad English version view well

  • Policy issues with RMI

    I developed a client app that runs correctly on my computer but when uploaded to a remote web server, it returns no answer. I believe this is caused by SocketPermission. It appears to be making a request. Can you tell me how the socket permissions ca

  • 10.1.3ea1 - Exception on loading JDev

    JDev team, I'm receiving the exception below each time I start JDev 10.1.3ea1. If I click ok in the error dialog JDev continues correctly. Any idea why it's occuring? I believe it only started occuring since I started using the versioning support a c

  • Adding a server into a failover cluster

    Hi all, i have the following question: i have a Failover Cluster with 3 servers and now i have to add another server. The cluster is in a pruction environment and the service cant be cut off during working hours. Adding this new server will cut off t