facebook

Need following JSP/Struts framework….

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #220470 Reply

    duraace
    Member

    I’ve been trying for several days to get the following framework working for a project. The flow is straightforward, but I’m stuck at one point:

    login (name, pwd) -> action -> returns a form, with some fields that can be edited-> update/subitted to another action handler returning a success/failure page.

    I’ve got the first action return working, but not the subsequent one on the original returned form/values. Could anyone provide me with do list/program structure using JSP’s, Action servlets, etc.?

    BTW Years of client side and server side Java, but no JSP/strut experience. This is driving me crazy. The tutorials don’t appear to cover the above scenerio.

    #220471 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev (not ME related, its a Struts question)

    duraace,
    I suggest posted a zip of your project or code snippets (assuming its short enough) so people can help.

    #220474 Reply

    Nabil Suleiman
    Participant

    so you get the login done fine, then you want to return some html form (fields to be edited ?) and once that’s submitted you forward to success/failure page ?

    #220475 Reply

    Riyad Kalla
    Member

    I’ll shoot in the dark here and guess you aren’t sticking your forms in the right scope, or are forgetting to repopulate the form values and you have it in the request, so they are trashed after your ‘update’ post…

    #220499 Reply

    duraace
    Member

    It was suggested I .zip the project and upload here. It’s not obvious to me how to do that. Also, to reiterate, I’m returning values via a .jsp on a login action. I what that .jsp via a submit button (got that) to tigger an action so I can process that edited values in a Java class.

    #220504 Reply

    Riyad Kalla
    Member

    duraace,
    I wasn’t asking you to post the ZIP file here, but post it online so people can download it and try and help you. We don’t support posting of attachments in these forums.

    #220509 Reply

    duraace
    Member

    I don’t have a site to host the file, so I’ll take another approach. Can you list the steps using MyEclipse to produce the following program structure. I have onle part working, but I may have painted myself into a corner by doing it.

    login.jsp invoking a Java Action class->returns editable values to a result.jsp->which in turn invokes another Java Action to process those same fields. I don’t have the latter step working.
    <MyEclips Steps go here> Many thanks.

    #220511 Reply

    Riyad Kalla
    Member

    Paste your source for struts-config.xml, result.jsp, the Struts Action it calls and the last success page for me to look at.

    #220515 Reply

    duraace
    Member

    Following 2 struts action classes defined in project

    com.eTravel.struts.action.LoginAction – is invoked by login.jsp submit
    com.eTravel.struts.action.submitCedentialsAction – not being called from login->dispCredentiials.jsp (login-> results)

    struts-config.xml

    <!DOCTYPE struts-config PUBLIC “-//Apache Software Foundation//DTD Struts Configuration 1.1//EN” “http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd”&gt;
    <struts-config>
    <data-sources />
    <form-beans >
    <form-bean name=”loginForm” type=”com.eTravel.struts.form.LoginForm” />
    <form-bean name=”submitCredentialsForm” type=”com.eTravel.struts.form.SubmitCredentialsForm” />

    </form-beans>

    <global-exceptions />
    <global-forwards />
    <action-mappings >
    <action
    attribute=”loginForm”
    input=”/form/login.jsp”
    name=”loginForm”
    path=”/login”
    scope=”request”
    type=”com.eTravel.struts.action.LoginAction” >
    <forward name=”credentials” path=”/form/dispCredentials.jsp” />
    </action>
    <action
    attribute=”submitCredentialsForm”
    input=”/form/dispCredentials.jsp”
    name=”submitCredentialsForm”
    path=”/submitCredentials”
    scope=”request”
    type=”com.eTravel.struts.action.SubmitCredentials” />

    </action-mappings>

    <controller bufferSize=”4096″ debug=”0″ />
    <message-resources parameter=”com.eTravel.struts.ApplicationResources” />
    </struts-config>

    dispCredentials.jsp (the result from login.jsp)

    <%@ page language=”java” import=”java.util.*” %>
    <%@ taglib uri=”http://jakarta.apache.org/struts/tags-bean&#8221; prefix=”bean”%>
    <%@ taglib uri=”http://jakarta.apache.org/struts/tags-html&#8221; prefix=”html”%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;
    %>

    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
    <html>
    <head>
    <title>JSP for submitCredentials form</title>
    <base href=”<%=basePath%>”>

    <meta http-equiv=”pragma” content=”no-cache”>
    <meta http-equiv=”cache-control” content=”no-cache”>
    <meta http-equiv=”expires” content=”0″>
    <meta http-equiv=”keywords” content=”keyword1,keyword2,keyword3″>
    <meta http-equiv=”description” content=”credentials submission page”>

    </head>

    <body>
    <html:form action=”/login”>

    e-mail address: <html:text property=”emplID”/> Is this correct?/br
    <html:submit/><html:cancel/>
    <!–comment
    result: <%=session.getAttribute(“emplID”)%> Is this right?
    –>

    </html:form>
    </body>
    </html>

    Can you please post all the information we request in the [URL=http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-393.html]Posting Guidelines[/URL] thread at the top of this forum? That will give us some context so that we can determine if this is an installation issue, a configuration problem, or a bug. Thanks.

    #220517 Reply

    Riyad Kalla
    Member

    Do me a favor, change your “scope=request” attributes for both your actions to “Scope=session” just to see if that is the issue. Otherwise make sure your param names are correct.

    #220518 Reply

    duraace
    Member

    Win2k
    Eclips 3.0.1 build 200409161125
    – Was Eclipse freshly installed for MyEclipse? – No
    – If not, was it upgraded to its current version using the update manager? – Yes
    What MyEclipse version are you using? (Help > About Eclipse Platform > Features)
    3.8.2 200408201200-3.82

    What JDK version are you using to run Eclipse? (java -version)
    J2SDK1.4.2_05
    What JDK version are you using to launch your application server?
    same

    What application server are you using?
    JBoss 1.4.0

    #220520 Reply

    Nabil Suleiman
    Participant

    jboss 1.4 ?

    #220521 Reply

    duraace
    Member

    @support-rkalla wrote:

    Do me a favor, change your “scope=request” attributes for both your actions to “Scope=session” just to see if that is the issue. Otherwise make sure your param names are correct.

    Before I do that, you need to know that the current dispCredentials, being invoked by the LoginAction is not coded correctly. It’s a syntax problem at this point. I don’t how to code retrieve values in a form from LoginAction. After that, the problem is “how” to invoke the submitCredentialsAction with the same values returned from the loginAction.

    #220522 Reply

    Riyad Kalla
    Member

    duraace,
    I think it would be best pickup a copy of Struts in Action, its an excellent book to get you started and I’m tied up with too much work to continue helping today with this.

    #220559 Reply

    john
    Member

    Not sure if this is the whole issue, but this is a problem.

    Currently in your file dispCredentials.jsp, you have this:
    <pre> <html:form action=”/login”></pre>
    That will cause the form to submit to your login action, which, if I understand corrently, is not what you want. (The user has already logged in by the time (s)he’s on this page.) To submit to your SubmitCredentials action, use:
    <pre> <html:form action=”/submitCredentials”></pre>
    Also double-check the class name in the type attribute of your SubmitCredentials action mapping. It’s not the same as the class name you have at the beginning of your message.

Viewing 15 posts - 1 through 15 (of 15 total)
Reply To: Need following JSP/Struts framework….

You must be logged in to post in the forum log in