Results 1 to 6 of 6
- 09-03-2009, 09:33 AM #1
Member
- Join Date
- Mar 2009
- Location
- new delhi
- Posts
- 9
- Rep Power
- 0
Problem with jsp using struts......
hiii friends
i m a student and working on one project using j2ee with struts framework, in which now i m making a page called " feedback " ,i got success in submitting the values from the feedback page to the database.
my succes and errors path is same that is " feedback" page. so whenever user enters wrong or right data in the feedback page it will dispatch to the feedback page again with errors.
till here i m able to show the errors on the feedback page but i want to show a successfull message to show user that he or she successfully submitted their feedback.
problmem 1 - how can i show a successfull message only after the successfull entry of data in the database ?
My 2nd problem is that whnever user enters data successfully it again comes back to feedback . But when it comes back all the data fields should hav to be null values but it does'nt hav.
problem 2 - how can i set d null value(blank) to all the data fields after the successfull submission of data ?
one thing i want to remind u tht m using struts framework in which text fields does'nt hav d id feild by wich i cud achieve d this target using javascript.
please show me right waut to solve these problems.
thanks in advance.......
- 09-03-2009, 09:42 AM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
You configure that in the action tags in your struts.xml
All your questions are easily answered by referring the struts tutorial that came with your struts download.
Here is an online version.
- 09-03-2009, 11:50 AM #3
Senior Member
- Join Date
- Dec 2008
- Location
- Hong Kong
- Posts
- 473
- Rep Power
- 5
you may use actionmessage if success and actionerror, fielderror for fail
- 09-04-2009, 08:31 AM #4
Member
- Join Date
- Mar 2009
- Location
- new delhi
- Posts
- 9
- Rep Power
- 0
mtyoung sir,
i got the point , that how to use ActionMessages , but m not able to understand how i can show this message after successfull insertion of data on the jsp page.
beacuse we use <html:errors/> to show erros on jsp page. But in the case of success how can i show the successfull msg ??
please give me example if u can .
thanks for help
- 09-04-2009, 11:56 AM #5
Hi Sachin,
Gothru this thread and if u get any errors,send the cocde and I will have a look
Using ActionMessages in strutsRamya:cool:
- 09-06-2009, 06:33 PM #6
Member
- Join Date
- Mar 2009
- Location
- new delhi
- Posts
- 9
- Rep Power
- 0
sorry for late reply RamyaSivakanth's Sir
thanks sir for helping me......
i read your given link and tried to implement it but i did'nt get the right answer after implementing the ActionMessage Class .
my code is here:-
i m asking about this because i have 1 password recovery page in which i have 1 user name field , 1 password question field , 1 password answer field and submit button. so whenever user enter rite username , pass. qs nd pass. ans than d password shud be show on d same page below these fields . nd this msg only show on d successfull insertion of data not on d page load .Java Code:this is my jsp page code: - <html:form action="login" method="get" > <html:errors/> <html:text property="name" name="loginbean" styleId="myname" onclick="email(document.getElementById('myname'), 'Please Enter a Value')"> </html:text> <html:text property="pass" name="loginbean" ></html:text> <html:submit > Submit</html:submit> </html:form> this is my action class code:- public class loginaction extends Action { /* forward name="success" path="" */ private final static String SUCCESS = "success"; private final static String FAILURE = "errors"; public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionErrors errors = new ActionErrors(); ActionMessages messages = new ActionMessages(); ActionMessage msg = new ActionMessage("data.ok"); messages.add("message1", msg); msg = new ActionMessage("data.continue"); messages.add("message2", msg); String str = " u r rite user"; saveMessages(request, messages); saveMessages(request,errors); loginbean lb = (loginbean)form; String nm = lb.getName(); String pa = lb.getPass(); String strname = "sachin"; String strpass = "kumar"; if(strname.equals(nm) && strpass.equals(pa)) { String sname = null; sname = strname; String commsg = sname + str ; request.setAttribute("msg1",commsg); return mapping.findForward(SUCCESS); } return null; } } this is my welcome page code:- <html:messages id="msg" message="true" property="message1"> <bean:write name="msg"></bean:write> <br> </html:messages>
for eg:- Your password is - mycomputer.
thank you...
Similar Threads
-
Problem with my first Struts program....please help me
By sireesha in forum Web FrameworksReplies: 5Last Post: 10-16-2011, 04:19 PM -
decorator.jsp problem building Struts Menu in JSP when Struts action is used
By dkirvan in forum JavaServer Pages (JSP) and JSTLReplies: 3Last Post: 04-29-2010, 05:33 AM -
URL Problem with IE7 in my struts Application
By SreenivasGurramkonda in forum Web FrameworksReplies: 0Last Post: 11-27-2008, 08:14 AM -
Problem with struts
By oferk78 in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 09-11-2008, 07:14 PM -
Struts problem
By ziniestro in forum Web FrameworksReplies: 2Last Post: 05-10-2007, 05:41 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks