[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to work with STRUTS

Posted on 2006-11-23
11
Medium Priority
?
280 Views
Last Modified: 2010-04-01
Hi All,
I want to make a JSP project but manager say use STRUTS technology (dont know why)
Im Using NetBeans and wanted to ask if someone can post a very simplr sample on how to create a JSP page with STRUTS and actually make it work.

I had many samples from internet but all when compile say problem

Thx

Just make a LOGIN page will be enough
0
Comment
Question by:gilboker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 10

Expert Comment

by:jaggernat
ID: 18005789
0
 
LVL 1

Author Comment

by:gilboker
ID: 18005919
HI,
I did the same sample as u sudgested but in my INDEX.jsp there is a problem with my FORM TAG!

<html:form action="name" name="nameForm" type="STRUTS.NameForm">

Say, Attribute name invalid for tag form according to TLD!!!
TRIED EVERYTHING
0
 
LVL 5

Expert Comment

by:gkishoreji
ID: 18006114
html:form tag doesnt have a name attribute.
it automatically gives the type value as it name

<html:form action="name" type="STRUTS.NameForm">
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:gilboker
ID: 18006146
Yes i know.
Figure it out before so now i have a text field i have to place name in.
after submit i debug and see that he got the currect name.

But now on Success i told the system to go to jsp page.
return mapping.findForward(target)

In the config file it says  <forward name="success" path="/welcomeStruts.jsp"/>

but after i submit i cant see this page, just blank one with STRUTS.do in the address.

Any idea why
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18006163
>>"return mapping.findForward(target)"
should be
return mapping.findForward("success")

as your struts-config.xml defines <forward name="success" path="/welcomeStruts.jsp"/>
0
 
LVL 1

Author Comment

by:gilboker
ID: 18006172
Hi,
No this is OK becasue i initialize it.
But i found the problem!!!! FUCKING JAJA is ket sensative and i made it Success not success

Thank you for your help.

Do u know how to pass parameters to the next page? and if i have to do some Database work should i do it in the NameAction file?

Ill give u the points same way.

If u can explain in yr words very plain what is diff between nameAction.java and nameForm.java

Thank u
0
 
LVL 16

Accepted Solution

by:
suprapto45 earned 800 total points
ID: 18006196
>>"Do u know how to pass parameters to the next page?"
You can use request to help you to do that.

request.setAttribute("whateverIdentificationHere", "anyValue");
return mapping.findForward(target);

Then in your JSP, you can get it using
<%
    out.println(request.getAttribute("whateverIdentificationHere").toString());
%>

>>"and if i have to do some Database work should i do it in the NameAction file?"
Yes, every business logic should be done in Action.

>>"what is diff between nameAction.java and nameForm.java"
Well, Action is the place where you will put all your business logics and etc. Form will only play part as the medium to send and retrieve the parameters from / to JSP. So let say that you are submitting one textbox value, it will go to the Form and the values in the Form will be retrieved in Action.

Hope that helps
David
0
 
LVL 1

Author Comment

by:gilboker
ID: 18006252
Thx so much,

now i made new file to test myself but keep getting this

"No getter method for property UserName of bean LogInForm"
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18006266
>>"No getter method for property UserName of bean LogInForm"
I assumed that you have userName variable in your LogInForm class. Do you create the setter and getter?

And I think that this question is worth to be splitted. Am I right?

I need to go soon and will be back in few hours time
0
 
LVL 1

Author Comment

by:gilboker
ID: 18006325
Yes i did,

   private String UserName=null;
    private String UserPassword=null;
   
    private int number;
   
    /**
     * @return
     */
    public String getUserName() {
        return UserName;
    }
     public String getUserPassword() {
        return UserPassword;
    }
    /**
     * @param string
     */
    public void setUserName(String string) {
        this.UserName = string;
    }
     public void setUserPassword(String string) {
        this.UserPassword = string;
    }


Anything wrong with this>?
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 18006340
Post your JSP and try to change it into private String userName;

Not sure though...okay I need to go now. Will be back later
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question