used this <c:if test='${screenqq == "JWS1001"}'>
still no luck
i think the problem is somethng else
J
Main Topics
Browse All Topicshi experts
I have this code in my jsp page
<c:set var="screenqq" value="JWS1001"/>
<c:if test='${requestScope.scree
<c:set var="makeurl" value="option=reports"/>
</c:if>
<html:form action="/shopping/cart/add
when page loads ,For some reason , it says “makeurl” is empty.
Any ideas?
Thanks
J
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Looks like i am getting close
<c:if test='${screenqq == "JWS1001"}'>
<c:set var="makeurl" value="option=reports"/>
</c:if>
<c:out value='${makeurl}'/>
<html:form action="/shopping/cart/add
the above code prints "option=reports" on screen which is c:out value
but the same c:out is not working in <html:form action="/shopping/cart/add
ideas?
J
I know I have had some difficulty with interaction between html tags and c tags.
What does the page source show?
Alternatives are to use scriptlets instead of the c tags, or just to write out the form in normal html instead of with the html taglib
(i.e. <form action="/shopping/cart/add
ok, and then how do i append it to the URL. I want to add "option=reports" to the url ="/shopping/cart/add.do" something like
this
<html:form action="/shopping/cart/add
similarly , if someother <c:if> condition is true, i want
<html:form action="/shopping/cart/add
Is that possible?
J
This may be a problem with quotes, try
<html:form action='/shopping/cart/add
also you can try the following:
<c:choose>
<c:when test='${screenqq == "JWS1001"}' >
<html:form action="/shopping/cart/add
</c:when>
<c:otherwise>
<html:form action="/shopping/cart/add
</c:otherwise>
</c:choose>
>>>>>>>>>>>
<c:choose>
<c:when test='${screenqq == "JWS1001"}' >
<html:form action="/shopping/cart/add
</c:when>
<c:otherwise>
<html:form action="/shopping/cart/add
</c:otherwise>
</c:choose>
are you sure the above works on your system. I doesnt work on mine.
J
hi
can you check which JSTL version are you using
see the tag lib definition
<%@ taglib uri="http://java.sun.com/j
to
<%@ taglib uri="http://java.sun.com/j
which one have you used
i am using this
http://java.sun.com/jstl/c
in that case
try this one
<%@ taglib uri="http://java.sun.com/j
<c:choose>
<c:when test='${screenqq == "JWS1001"}' >
<html:form action="/shopping/cart/add
</c:when>
<c:otherwise>
<html:form action="/shopping/cart/add
</c:otherwise>
</c:choose>
will something like above work with <%@ taglib uri="http://java.sun.com/j
I am using JSTL 1.0 in our application so the taglib def looks like
<%@ taglib prefix="c" uri="http://java.sun.com/j
I am not sure what you wanted me to confirm working on my system,
choose-when-otherwise construct is working at all places in my code
I am not using html taglib in my code, so cannot confirm on the combination,
For generating dynamic URL, most of the time I code my logic in the controller & put the URL as an attribute in the request & in most of my JSPs, form definition looks like the following & this surely works:
<form method="post" action="<c:out value='${nextUrl}' />" name="thisDocForm">
oh, I misunderstood your problem, your problem is to use JSTL along with Struts tags, & yes you are correct this will not work with regular Struts tags..
To use Expression language syntax through struts tag libraries (1.2.8 onwards or just include struts-el.jar & TLD file from it), & in your code
<%@ taglib uri="/WEB-INF/lib/struts-h
<html-el:form action="${nextUrl}" method="post">
you can download it from
http://struts.apache.org/
Business Accounts
Answer for Membership
by: rowdy_hPosted on 2006-09-19 at 09:30:24ID: 17553402
I think your problem is that are you doing <c:if test='${requestScope.scree nqq == "JWS1001"}'>
and not <c:if test='${screenqq == "JWS1001"}'>?
When you set the screenqq var you aren't specifying the scope on it. If I remember correctly the default scope is page, so you won't find it in the request scope.