File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Help needed with struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Help needed with struts2" Watch "Help needed with struts2" New topic
Author

Help needed with struts2

Rao Papa
Greenhorn

Joined: Jul 28, 2006
Posts: 26
Hi,

I have this piece of code in my jsp file
<s:hidden name="lastIndex" value="'<%=j%>'" />

but I get an exception related to tld not supporting an expression.
I would like to know if anyone has faced a similar issue. I would like to know the equivalent of the <%=variableName%> in struts 2.

Thanks
Papa Rao


-----<br />SCJP(1.5)<br />SCWCD (In Progress....)<br/>IBM Certified Application Developer - WebSphere Commerce V6.0 <br/>
Quince bise
Greenhorn

Joined: Jan 22, 2008
Posts: 8
hi,
try to use jsp expression language for this.

Basic Syntax is: ${variablename} <-- means to search the PageContext, HttpServletRequest, HttpSession and ServletContext and output the object with that attribute name.

equivalent form: pageContext.findAttribute("variablename") or
<jsp:useBean id="variablename" class="sompackage" scope="session,request,application">
<%=variablename%>

I hope it could help you.
Rao Papa
Greenhorn

Joined: Jul 28, 2006
Posts: 26
Hi Thank you for responding back i tried using $ but i still face this error

I tried this ::
<s:url id="next" action="Next">
<s aram name="lastIndex" value="%{${pageIndex}}"/>
</s:url>

using it still gives me this error which is the same as what i got when i used <%= =%>

According to TLD or attribute directive in tag file, attribute value does not accept any expressions
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
Quince bise
Greenhorn

Joined: Jan 22, 2008
Posts: 8
hi! please do it this way: remove "%" and the other "{}"

value="${pageIndex}"

and make sure that pageIndex is stored as pageContext or request or session.

example:
<% request.setAttribute("pageIndex", urvalue)%> or from your action class
Rao Papa
Greenhorn

Joined: Jul 28, 2006
Posts: 26
Hi Thank you for responding back i tried using $ but i still face this error

I tried this ::
<s:url id="next" action="Next">
<s aram name="lastIndex" value="%{${pageIndex}}"/>
</s:url>

using it still gives me this error which is the same as what i got when i used <%= =%>

According to TLD or attribute directive in tag file, attribute value does not accept any expressions
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)
Rao Papa
Greenhorn

Joined: Jul 28, 2006
Posts: 26
Hi Quincy,

Thanks for the reply. I tried it but i still get the same exception. Any other ideas on how I can tackle this issue..

Regards,
Papa Rao
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The Struts <s:hidden> tag is tied to the value referenced by the name attribute. If you want to put some value into the tag, change the value of the property referenced by the name. Example: Suppose I have the following tag

If I want the value of this tag to be "someValue", I must manipulate the value of the foo property, either in the action class that forwards to the JSP as in:

or, in the JSP itself as in:

[ April 01, 2008: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help needed with struts2
 
Similar Threads
transform xml into html tables - generic way?
Xpath Question
XML Transformation
Request-Time Attribute Expressions
XSLT equality test