Re: need some help regarding Display List and Update In Struts2

2008-07-23 Thread hisameer

Thanks Man ! You are great:clap:

As soon I changed ID it worked. I really appreciate it.



Lukasz Lenart wrote:
 
 using Strust 2.0 you have to use var instead.
 
 should be id instead ;-)
 
 
 Regards
 -- 
 Lukasz
 http://www.lenart.org.pl/
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/need-some-help-regarding-Display-List-and-Update-In-Struts2-tp18579243p18613005.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: need some help regarding Display List and Update In Struts2

2008-07-22 Thread Lukasz Lenart
table
tr
tds:text name=label.user.id//td
tds:text name=label.user.login//td
tds:text name=label.user.firstname//td
tds:text name=label.user.lastname//td
/tr
s:iterator value=userList var=user
s:url var=editUrl action=edit
s:param name=userId value=id/
/s:url
tr
tds:a href=%{editUrl}s:property
value=id//s:a/td
tds:property value=logon//td
tds:property value=firstName//td
tds:property value=lastName//td
/tr
/s:iterator
/table


Regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: need some help regarding Display List and Update In Struts2

2008-07-22 Thread hisameer

Thanks for your help Lukasz!

The code you gave me was really really helpful and I was able to popup the
usr list. But I got some error when I added the update and delete link into
the same page. 

Here is the snapshot of my userList.jsp:

table class=userTable
tr
ths:text name=User Name: //th
ths:text name=City: //th
ths:text name=State: //th
ths:text name=Description: //th
/tr
s:iterator value=userList status=userTable_stat
s:url var=updateUrl action=updateUser namespace=user
s:param name=userId value=id /
/s:url
s:url var=deleteUrl action=deleteUser namespace=user
s:param name=userId value=id /
/s:url
tr
class=s:if test=#userTable_stat.odd ==
trueodd/s:ifs:elseeven/s:else
tds:property value=name //td
tds:property value=city //td
tds:property value=state //td
tds:property value=description //td
tds:a href=%{updateUrl}
s:property 
value=id/s:textfieldUpdate/s:textfield
/s:a/td
tds:a href=%{deleteUrl}
s:property value=id 
/s:textfieldDelete/s:textfield
/s:a/td
/tr
/s:iterator
/table

and my struts.xml mappings are: 


action name=userList class=UserAction
method=userList
result/pages/userList.jsp/result
/action
action name=updateUser class=UserAction
method=updateUser
result name=failure/login.jsp/result
result/pages/updateUser.jsp/result
/action
action name=deleteUser class=UserAction
method=deleteUser
result/confirmation.jsp/result
/action

But when I tried to call the userList after adding the update and delete
links the following error came up:

SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /pages/userList.jsp(47,2) Attribute var
invalid for tag url according to TLD
at
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:236)
at
org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1198)
at
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:819)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1512)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
at
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:838)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1512)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
at org.apache.jasper.compiler.Validator.validate(Validator.java:1737)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:165)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)

I really don't know what should I do. Also please tell me whether the
struts.xml snapshot is good or not.

Thanx for your help in advance.






Lukasz Lenart wrote:
 
 table
 tr
 tds:text name=label.user.id//td
 tds:text name=label.user.login//td
 tds:text name=label.user.firstname//td
 tds:text name=label.user.lastname//td
 /tr
 s:iterator value=userList var=user
 s:url var=editUrl action=edit
 s:param name=userId value=id/
 /s:url
 tr
 tds:a href=%{editUrl}s:property
 value=id//s:a/td
  

Re: need some help regarding Display List and Update In Struts2

2008-07-22 Thread Dave Newton
--- On Tue, 7/22/08, hisameer [EMAIL PROTECTED] wrote:
 userList.jsp(47,2) Attribute var invalid for tag url according to TLD

The {{id}} attribute is deprecated in Struts 2.1.x, and has been replaced by 
the {{var}} attribute. So if you're using S2.0.x use id.

Dave


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: need some help regarding Display List and Update In Struts2

2008-07-22 Thread Lukasz Lenart
As Dave mentioned, var should be used with Struts 2.1, and if you are
using Strust 2.0 you have to use var instead.
Regarding your struts.xml, I don't know exactly what your updateUser
do, but you should follow below sequence:

list.action - success:list.jsp - edit.action - success:edit.jsp -
update.action - input:edit.jsp || success:redirect to list.action


Regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: need some help regarding Display List and Update In Struts2

2008-07-22 Thread Lukasz Lenart
 using Strust 2.0 you have to use var instead.

should be id instead ;-)


Regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: need some help regarding Display List and Update In Struts2

2008-07-21 Thread Gabriel Belingueres
I recommend using displaytag [1] for showing the user list.

How to know which user you want to delete/update? You need to add a
parameter to the delete/update action URL to identify the specific
user, usually the user's primary key or if your user list is stored in
session scope you could use the index that the user is in that list.
See the s:url tag [2] to learn how to build that URL.

[1] http://displaytag.sourceforge.net
[2] http://struts.apache.org/2.1.2/docs/url.html

2008/7/21 hisameer [EMAIL PROTECTED]:

 Hi everyone

 I was just going through the nabble.com and I found very nice help about
 struts2. Now I need some more help about it. I hope somebody is kind enough
 to help me.

 My problem is that I have to display all the users from the database and all
 the information related to the user(firstName,LastName,EmailAddress,Phone
 etc.) in a JSP page one by one by using struts2.
 and for each and every user in the list there should be a update and delete
 link. If there is no user then nothing should show up. I really don't know
 how this should work in the jsp page using struts2. I have got the list in
 Action Class of it and the list has name userList which is of type user
 object which has all the fields in it.

 I don't know how I can display the list into the jsp page. If somebody has
 done this already can you please send me the sample code to my email id:
 [EMAIL PROTECTED]

 Also how would I know about which user I want to delete or update,whenever
 the user clicks on any one of the link.

 Please help me. I need to finish it as soon as I can!:,(
 --
 View this message in context: 
 http://www.nabble.com/need-some-help-regarding-Display-List-and-Update-In-Struts2-tp18579243p18579243.html
 Sent from the Struts - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]