Servlets vs Struts

Hello every one,
As i am new to struts, i am not able to find the difference between servlets and struts. both of them use the xml file alone for any change not in their codes.please do help me out.
Thanking you
rashmi

Hello every one,
As i am new to struts, i am not able to find the
he difference between servlets and struts. Servlets are HTTP request handlers.
Struts uses a single servlet - its action servlet.
both of
them use the xml file alone for any change not in
their codes.Not so. Servlets have web.xml, which is required by every Web app including Struts. It does not configure everything that goes on in a servlet. Struts has the additional XML configuration files for page navigation, validation, etc.
please do help me out.
Thanking you
rashmiYou sound like you need to learn more about Struts.
%

Similar Messages

  • Is it possible to  call servlet in struts?

    hello,
    In struts we can submit form like this login.do
    likewise is it anything possible to call servlet in struts.

    In struts we can submit form like this login.donot nessarily it all depends on your ActionServlet configuration in what way you configured the its URLPattern in web.xml
    if you are intrested you can very well specify it to be
    <servlet>
         <servlet-name>StrutsActionServlet</servlet-name>
         <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
             <param-name>config</param-name>
             <param-value>/WEB-INF/strutsconfigurationfile.xml</param-value>
          </init-param>
          <init-param>
               <param-name>debug</param-name>
                <param-value>2</param-value>
          </init-param>
          <init-param>
         <param-name>detail</param-name>
         <param-value>2</param-value>
          </init-param>
           <init-param>
         <param-name>validate</param-name>
         <param-value>true</param-value>
           </init-param>
          <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
           <servlet-name>StrutsActionServlet</servlet-name>
           <url-pattern>*.sivakaminathan </url-pattern>
    </servlet-mapping>
    likewise is it anything possible to call servlet in struts. Why not ?
    Struts itself is driver by a Servlet(ActionServlet).
    all you have to do is to Configure your Custom built Servlet in web.xml with by naming the Servlet Instance,settings its configurations & specifying its URL pattern.
    just like the one which you did for Struts Action Servlet
    Hope that is the relavent answer for your question
    REGARDS,
    RaHuL

  • Get HTML source from servlet or strut action

    Hi, need ur help
    I would like to get the HTML source code after calling a URL, for example,
    Suppose a servlet will return a page hello.html, i would like to grap this HTML page source code in my servlet or strut action.
    How can i achieve this?
    Thanks

    This question does not make sense, because the Servlet is the thing that generates the HTML in the first place.
    If you want to view the HTML source of a given web page. Go to 'View'->'Source' in Internet Explorer.

  • 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 !
              

  • Http proxy servlet using struts

    Hi,
    I have 2 web application "webApp1" which based on struts, and "webApp2".
    I'm trying to http proxy a servlet from "webApp2" to "webApp1" and to redirect the call to an action in "webApp1"
    that's what I wrote in "webApp2"/web.xml, I expect it to arrive GetAction.do in "webApp1":
    <servlet>
    <servlet-name>GetHttp</servlet-name>
    <servlet-class> weblogic.servlet.proxy.HttpProxyServlet </servlet-class>
    <load-on-startup>1</load-on-startup>
    <init-param>
    <param-name>redirectURL</param-name>
    <param-value> http://localhost:7001/GetAction.do </param-value>
    </init-param>
    </servlet>
    <servlet-mapping>
    <servlet-name>GetHttp</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>
    but I fail on NullPointerException, any idea what's missing???
    Thanks all...

    Its a NPE related to the http proxy .
    I just try to get into my action via the servlet as I wrote and thats' what I get:
    <Jan 3, 2008 4:17:00 PM IST> <Error> <Kernel> <efrat01> <cscserver> <ExecuteThread: '23' for queue: 'weblogic.kernel.Default'> <<WLS Kernel>> <> <BEA-000802> <ExecuteRequest failed
    java.lang.NullPointerException.
    java.lang.NullPointerException
         at weblogic.servlet.internal.WebAppServletContext.getEnvironmentContext(WebAppServletContext.java:5569)
         at weblogic.servlet.internal.WebAppServletContext.pushEnvironment(WebAppServletContext.java:6603)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3519)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)

  • Reading Files from client directory folder using servlets or struts.

    HI All,
    Could you please help me out int the below query.
    I want read all files from paricular directory folder from the client machine in web application. I am able to do it from my local machine. but when I am try to do it from some other machine I am not able to get the file list.
    It is very urgent ..please hep me ASAP.

    It should be problem with the file permissions in your client machine ???Hardly.
    @OP: a servlet executes at the server. It doesn't haved any access whatsoever to the client machine.

  • How to send a String value  from Servlet to  Action class in Struts .

    when iam trying to send string value from Servlet to Struts Action class through Http Session, iam getting null value, iam really in big confusion, help me.

    please elaborate clearly or put you code of both action and servlet here
    Are both of them in same web application

  • Tomcat 5.5, struts, AJAX - Works on localhost but not on online web-server

    Hello,
    I'm trying to add some functionality from Ajax to my client's web application. And I'm stuck on this problem for the past 4 days now.
    To make a long story short, the application works perfectly on my localhost, but once I deploy it to the online server it pops a Page Not Found message (written in the JavaScript of Ajax engine). Though I have worked with servlets and struts a bit, I still consider myself very new.
    Here are some specifications:
    - The jar files are in tomcat-5.5/common/lib
    - The servlets (compiled correctly) are in webapps/ROOT/WEB-INF/classes/javaClasses
    - My web.xml and struts-config.xml are in WEB-INF, both of which I believe are configured correctly:
    web.xml
    =======
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
         <servlet>
              <servlet-name>action</servlet-name>
              <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
              <init-param>
              <param-name>config</param-name>
              <param-value>/WEB-INF/struts-config.xml</param-value>
              </init-param>
         </servlet>
         <servlet-mapping>
              <servlet-name>action</servlet-name>
              <url-pattern>*.do</url-pattern>
         </servlet-mapping>
         <welcome-file-list>
              <welcome-file>/index.jsp</welcome-file>
         </welcome-file-list>
    </web-app>
    struts-config.xml
    ==============
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
    <struts-config>
    <action-mappings>
    <action path="/signup" type="org.apache.struts.actions.ForwardAction" parameter="/signup.jsp" />
    <action path="/countries" type="javaClasses.GetCountries" />
    </action-mappings>
    </struts-config>
    I noticed when I type "countries.do" on my localhost, the action is processed perfectly, however on the online server, it displays me the 404 error page.
    I thought it wasn't seeing the struts-config.xml so I played around with the directory path struts-config.xml and replaced it with:
    <param-value>/home/shaghig/webapps/ROOT/WEB-INF/struts-config.xml</param-value>
    but still no luck.
    What is it that I am not doing right? Any input or guidance would be very much appreciated.

    Have you resolved your problem? I am running into the SAME EXACT issues with my application. The only difference is I'm not deploying to webapps/ROOT/; I'm deploying to my own directory based on my WAR file name (webapps/<web_application_name>/WEB-INF....blah blah). If you figured out your problem (believe me, I wish I could be of some help) I would LOVE to hear what you did/figured out.
    -C

  • Problem with multiple tiles-defs.xmls  in struts

    Hi,
    I am using struts1.3.I have two struts-config.xml files in my application.I am adding those files in web.xml.
    <servlet>
              <servlet-name>action</servlet-name>
              <servlet-class>
                   org.apache.struts.action.ActionServlet
              </servlet-class>
              <init-param>
                   <param-name>config</param-name>
                   <param-value>/WEB-INF/first-struts-config.xml,/WEB-INF/settings-struts-config.xml</param-value>
              </init-param>
              <init-param>
                   <param-name>convertNull</param-name>
                   <param-value>true</param-value>
              </init-param>
              <init-param>
                   <param-name>chainConfig</param-name>
                   <param-value>
                        org/apache/struts/tiles/chain-config.xml
                   </param-value>
              </init-param>
    </servlet>Each struts-config.xml file have seperate tiles-defs.xml .I am adding those files like the following
    first-struts-config.xml
    <plug-in className="org.apache.struts.tiles.TilesPlugin">
            <set-property property="definitions-config" value="/WEB-INF/first-tiles-defs.xml" />
            <!-- Set Module-awareness to true -->
            <set-property property="moduleAware" value="true" />
        </plug-in>settings-struts-config.xml
    <plug-in className="org.apache.struts.tiles.TilesPlugin">
            <set-property property="definitions-config" value="/WEB-INF/settingst-tiles-defs.xml" />
            <!-- Set Module-awareness to true -->
            <set-property property="moduleAware" value="true" />
        </plug-in>I am getting one error
    javax.servlet.ServletException: Path .settings.users does not start with a "/" character..settings.users definition is specified in settingst-tiles-defs.xml.
    If i want to pick the definitions which are there in first-tiles-defs.xml ,then it is working fine.
    Is there any idea for this problem?
    Regards
    kondal

    Try a forum/mailinglist devoted to struts. There´s one at their own homepage over there at apache.org.

  • Struts And XML?

    Hi all,
    I have two questions on which I would appreciate your help.
    1. How to call a normal servlet from Struts Servlet???
    - I suppose I have difficulties in calling a normal Servlet from an Struts controller, because the controller has to choose a JSP at the end. How can I overcome it???
    2. How would I form and output XML output on the web browser using Struts Framework?
    Regards.

    Hi,
    I have the situation in which I need to print the xml output from the struts servlet.
    But, i guess, the action servlet has to choose any one of the jsp page for findForward....
    Thus, by default, it will choose a jsp page and it will not produce the xml output on a browser...
    If there is other way out then also, i would like to know if we can call other servlet or not???
    Cheers.

  • Init actionservlet in struts

    Hi all,
    is there a common way to initialize servlets in struts.
    I want to put some variable into the servletcontext.
    I do that in my loginaction via
        if(firsttime) {
          setSessionManager(); // Method which sets my variable
          firsttime = false;
        }I think thats is not a very elegant way.
    I could derive from actionservlet, do my stuff in init()
    and put that into the web.xml.
    But I do not like introducing a new class just for initializing.
    Is there an easier way to init things ?
    Any hint is appreciated.

    You could have a servlet that is configured to load on startup.
    In its init procedure, set the servlet context attributes as you wish.
    The only purpose for this servlet would be to run at startup and do config.

  • Please look at this problem and give me solution

    hi all,
    iam getting this problem when i run th server
    javax.servlet.UnavailableException: Missing configuration resource for path /WEB-INF/struts-config.xml
    so, i am unable to run jsp, servlets using struts in tomcat.
    pls solve this problem
    --> i have a servlet file namd Form.java
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.ServletOutputStream;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    public class Form extends Action {
    public ActionForward execute(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException {
    ServletOutputStream sos=response.getOutputStream();
    String fname=request.getParameter("firstname");
    String lname=request.getParameter("lastname");
    String dob=request.getParameter("dob");
    String uid=request.getParameter("uid");
    String pwd=request.getParameter("pwd");
    sos.println("First Name = " + fname +" "+lname+"<br>");
    sos.println("DOB = " + dob);
    sos.println("Username = " + uid);
    sos.println("password = " + pwd);
    String target = new String("success");
    return (mapping.findForward(target));
    -->jsp file named form.jsp
    <html>
    <body>
    exe on httpservlet
    <form action="http://localhost:8080/satish/Form">
    enter firstname <input type= "text" name="firstname"><br>
    enter lastname <input type="text" name="lastname"><br>
    enter DateofBirth <input type="text" name="dob"><br>
    enter userid <input type="text" name="uid"><br>
    enter password <input type="text" name="pwd"><br>
    <input type="submit" value="register">
    </form>
    </body>
    </html>
    and i have web.xml in F:\projects\tomcat\webapps\satish\WEB-INF
    with below contents
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <display-name>struts example</display-name>
    <description>
    Mycode
    </description>
    <!--GENERATED_JSPS-->
    <!-- JSPC servlet mappings start -->
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class> org.apache.struts.action.ActionServlet </servlet-class>
    <init-parameter>
    <name>application</name>
    <value>ApplicationResources</value>
    </init-parameter>
    <init-param>
    <param-name>config</param-name>
    <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    </servlet>
    <servlet-mapping>
    <servlet-name>action </servlet-name>
    <url-pattern>/satish/Form</url-pattern>
    </servlet-mapping>
    <!-- JSPC servlet mappings end -->
    </web-app>
    and struts-config.xml file in F:\projects\tomcat\webapps\satish
    with below contents
    <!DOCTYPE struts-config PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
    "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd" >
    <struts-config>
    <action-mappings>
    <action path="/form" type="Form" input="/form.jsp" >
    </action>
    </action-mappings>
    </struts-config>
    and run the tomcat server
    typed http://localhost/satish/form.jsp
    given the input and clicked submit button and i got
    this
    HTTP Status 404 - /satish/Form
    type Status report
    message /satish/Form
    description The requested resource (/satish/Form) is not available.
    Apache Tomcat/5.0.5

    double post:
    http://forum.java.sun.com/thread.jspa?threadID=684573&tstart=0

  • Java career advice, now that I've been laid off

    After nearly 13 years at the same company (my only job since finishing college), I was laid off. One would think that with such experience, a new job would be easy to find. The problem is that in those 12+ years I've focused on a rather narrow set of Java technologies, mostly core J2SE, with a little bit of EJB & JDBC. Nothing really web based at all. 99% of the job postings I see require experience with web development and/or experience with Spring, Hibernate, Servlets, JSP, Struts, etc... things that I have at best a passing familiarity with.
    Does anyone have any advice about how to best overcome this? A crash course of teaching myself these new skills (which I've already begun, starting with Hibernate)? Enroll in a CS graduate school program (part time, so that I can continue in the evening when/if i find a job)? Find some other crash course sessions of these topics? Any advice at all? I'm in San Francisco, for what it's worth.
    Thanks!

    jjr001 wrote:
    After nearly 13 years at the same company (my only job since finishing college), I was laid off. One would think that with such experience, a new job would be easy to find. The problem is that in those 12+ years I've focused on a rather narrow set of Java technologies, mostly core J2SE, with a little bit of EJB & JDBC. Nothing really web based at all. 99% of the job postings I see require experience with web development and/or experience with Spring, Hibernate, Servlets, JSP, Struts, etc... things that I have at best a passing familiarity with.
    Does anyone have any advice about how to best overcome this? A crash course of teaching myself these new skills (which I've already begun, starting with Hibernate)? Enroll in a CS graduate school program (part time, so that I can continue in the evening when/if i find a job)? Find some other crash course sessions of these topics? Any advice at all? I'm in San Francisco, for what it's worth.You still have programming experience and problem solving skills. That's worth a lot especially if your college degree is related to computing.
    Most companies are looking for competence. I wouldn't let buzzwords in the job postings put me off. Just apply for the jobs. And how hard are these technologies you mention. I promise to be an expert in any XXX in a week and in a month I'll outprogram people who have spent years toiling away with XXX and they come to me for advice. And if I can so can you. -:)
    Another more important question is whether you really would want to spend the next decade with XXX? To me it would be hellishly boring. If I were you I would apply for jobs directly to the technical departments of companies I admire. Stick with core Java. This is where the challenges are and the fun takes place. Leave XXX to the monkeys.

  • Memory Leak: Do I need to explicitly free memory reference for collection?

    Hi,
    My web application uses JRockit JDK 1.4.2, Java Servlet, JSP &Struts. It is a clustered environment using WL 8.1 sp 4. I am investigating whether there are any memory leaks in the application & what are best practices to avoid leaks.
    A specific scenario is as follows:
    For an incoming request, the struts action class creates object �O� (of class A) and set �O� as a request attribute. This request attribute is used to display values on the JSP.
    Now, class A has a heavily nested structure: Class A has object of class B, where B has a HashSet of objects of type C and where C has an object of type D and E.
    Though I set this object �O� in request scope, do I need to explicitly nullify any of the references within object �O�? Can �not doing this� result in a memory leak?
    Thanks in advance,
    sjaiprakash

    jEnv->ReleaseStringUTFChars((jstring) jStr, str);free(str); //Is this line valid or outright wrong?Outright wrong.
    Another question is if ReleaseStringUTFChars actually frees str then will it set str to NULL?No, that's impossible by the semantics of C and C++.
    I guess not as we are not sending this pointer by reference.Exactly, so what you described is impossible. No need to ask really.
    My last question is if str is NULL then calling ReleaseStringUTFChars over it can cause any problem?How could it be null? If it comes from GetStringUTFChars that's impossible, and if it doesn't you don't have any business calling ReleaseStringUTFChars() on it, whatever its value.

  • Best practice: Saving form data

    Hello,
    I'm new to the JSP technology.
    To get some experience I built my own little shoutbox "application" where you can insert your name and a message and if you click on "submit" your message appears at the top of the page. Older messages also appear below the new message.
    For this, I created a little JavaBean which handles the entered name and the message. I called this class "Message".
    To read the messages out of the database I created another class (MessageHandler) which returns an ArrayList of objects from the Message class.
    I don't know if I'm doing this the right way, but I use this MessageHandler as a JavaBean so that I can do this:
    <jsp:useBean id="handler" scope="session" class="net.stiefels.myshoutbox.MessageHandler"/>
    <jsp:setProperty name="handler" property="limitMessages" value="2"/>
    <c:forEach items="${handler.messages}" var="msg">
         ${msg.text}<br/>
    </c:forEach>The next step is, "how to save new data?".
    With my current experience in JSP I found this possibility:
    Save the form data in a "Message"-Bean and use a MessageHandler method (e.g. setNewMessage) to save the data in the database. The code would then look like this:
    <jsp:useBean class="net.stiefels.myshoutbox.MessageHandler" id="handler" scope="session"/>
    <jsp:useBean class="net.stiefels.myshoutbox.Message" id="newMessage" scope="page"/>
    <jsp:setProperty name="newMessage" property="*"/>  // save form data
    <jsp:setProperty name="handler" property="newMessage" value="${newMessage}"/>  // save Message-Bean in databaseMy question now is if this way is the normal procedure to save form input in a database?
    If not, which way would be a better one?
    Thanks a lot!
    Simon

    I never use that approach
    Simple pages
    When I submit I have a servlet or Struts action that does the insert and then redirects/forwards to the submitting JSP , this JSP will then requery DB.
    More complex
    Always start with Struts and store all information on the Struts actionform.

Maybe you are looking for

  • Installer crashes: OfficeJet 5610 Drivers on 64-bit Windows 7 Professional

    This is the result each time I download the package from the HP website and try to install it on my new Dell Inspiron 17R with Windows 7 Professional 64-bit: Microsoft Visual C++ Runtime Library  Runtime Error! This application has requested the Runt

  • Enlightenment E17's EFM breaks when theme changes

    Hello. I've installed the "enlightenment17" package, as indicated in the wiki article. After a few clashes against the Enlightened way of life (which it totally won), I was ready to give it a look & feel more to my liking. So I installed the e17-them

  • Multicast blocking in layer 2 switch

    Hello there, I need your help, this is the problem that I have. We have a 3750X with 7 ports assigned to a different multicast IP address (connected to the encoders), these are the ports with the multicast ip address and the rate that the encoder is

  • Changing List's item renderer and layout causes exception

    I have buttons in my UI to switch a list between a tile view (thumbnails) and a list view (details). This code works:      var layout:TileLayout = new TileLayout();      resultsList.layout = layout;      resultsList.itemRenderer = new ClassFactory(Me

  • How to Drag and Drop mutliple rows in the jtable

    hai i am having a jtree ,in which i added many nodes,each nodes hav corresponding jtable with values. now i need to drag a group of rows from a jtable of particular node in jtree to another node. at the same time i am possible to drag and drop the si