Rajibul Alam

Greenhorn
+ Follow
since Jul 01, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rajibul Alam

Hi

I am working on a web application that stores a value each time some user/client do some sort of search. And in the result page I display a look up number along with the result set. But if I click on the reload button the whole process starts again and it creates a new look up number and does all the search. I tried <t:saveState> to pass the value which works fine for the paging of the data table but doesn't work while I try to reload.

Can anyone please give me a hint or solution ..maybe an example code which would help me overcome this issue??

Regards

Rajib

10 years ago
JSF

Bear Bibeault wrote:You're not following the proper patterns -- that's what's causing your problems. The solution isn't to try and trick the forward (you can't) but to structure your application correctly.

Read this article and pay particular attention to the "PRG Pattern".



thanks a lot....for the article

I guess now I get to spend my weekend in a productive way
11 years ago

Bear Bibeault wrote:You don't. That's the whole point of the forward!

Why would you want it to?



Well I was just curious if there was a way to show the right jsp rather than the servlet in the url. It would help me fix some problem with the urls that i am facing in later part of the project. for example after deleting a user It sends the admin back to main page and from that page if I click any link that gets messed up as the context url is showing the deletservlet link.
11 years ago

Himanshu Kansal wrote:You'll ned to give a mapping for the servlet to a particular jsp. Do it in web.xml if you are not using any framework like Struts.

Regards




Thanks for the reply

But how do I map a servlet that can map to several JSP like this case. Can you please give an example of multiple mapping from one servlet. Or an example to do the mapping for the servlet to a particular jsp


thanks in advance

Rajib
11 years ago
Hi,

I have a login servlet and based on the user type it needs to forward user to specific types of profile/main pages. It does whats it suppose to do but the url on the browser shows the servlet name. "http://localhost:8080/project/LoginServlet"; instead of showing "http://localhost:8080/project/Admin/mainPage.jsp";

How do I achieve this???




thanks

Rajib



11 years ago

Bear Bibeault wrote:If this is a legacy app, why are you introducing the JSTL SQL tags into it when those should only be used for prototyping?



I am writing the whole application using J2EE but still need to use the old database .....and Using the JSTLSQL tags just for Select to show data in profile pages. All main SQl are done in Servlets.

I guess I can use Beans to store the values from a servlet and then pass em through session n show em in the JSP but I felt that might be too much for the purpose.

But If you have any suggestions then I would really appreciate it. Plus the main Question remains...Is it possible to access [Company name] (attribute with a space) value in JSTL.
11 years ago
JSP
Hi,

I am working on a project that was designed 10 year back and some of the attributes name in that database has a space in between.

For example Company Name

if there a way to get this value using

<sql:setDataSource dataSource="jdbc/_Ob" />
<sql:query var="selectedRows"
sql="select * from SystemUser where SystemUserID = ?">
<sql:param value = "${SYSTEMUSERID}"/>
</sql:query>
<c:forEach var="currentRow" items="${selectedRows.rows}">
<c:set var="CompanyName" value="${currentRow.['Company Name']}" />
....



thanks in advance
11 years ago
JSP
Figured out the solution....maybe it will help someone else someday

<c:set var="qry" value="${Query}" />

<sql:setDataSource dataSource="jdbc/_Obweo" />
<sql:query var="selectedRows" scope="application"
sql="${qry}">

</sql:query>
11 years ago
JSP
javax.servlet.ServletException: javax.servlet.jsp.JspTagException: No SQL statement specified

root cause

javax.servlet.jsp.JspTagException: No SQL statement specified

is the Error that I get
11 years ago
JSP
I am trying to do the following but its giving me error saying that sql doesnt have any query to execute. I print out the sqlQuery sting and it prints it out properly but sql="${sqlQuery}" portion of the code doesnt work. Can anyone please tell me why?
<%
String sqlQuery = sqlQueryBean.getQuery();
%>
<h2><%=sqlQuery%>
<sql:setDataSource dataSource="jdbc/_Obweo" />
<sql:query var="selectedRows"
sql="${sqlQuery}">

</sql:query>
<Select name="SysUserID">
<c:forEach var="currentRow" items="${selectedRows.rows}">
<option <c: out value="${currentRow.SystemuserID}" />>
<c: out value="${currentRow.first}" /> <c: out value="${currentRow.last}" />
</option>
</c:forEach>
</select>


Thanks in Advance
11 years ago
JSP

Bear Bibeault wrote:When things like this happen, look at the HTML source sent to the browser. The problem could have been seen in seconds.



thanks for the tip....really appreciate it
11 years ago
JSP

David Newton wrote:It needs to be in quotes.



thanks for the reply

do you mean it needs to be in quotes like this

<td ><INPUT TYPE=TEXT NAME="Phone" size="14" value="<c: out value="${Phone}"/"> ></td>


Works....thanks a lot.....
11 years ago
JSP
hi,

I am trying to create an Edit profile page. Thus I get the Users previous attributes value using a simple select query then setting the values like the following

<c :forEach var="currentRow" items="${selectedRows.rows}">
<c: set var="Last" value="${currentRow.Last}" />
<c: set var="First" value="${currentRow.First}" />
<c: set var="Address1" value="${currentRow.Address1}" />
<c: out value="${currentRow.Address1}" />
<c: out value="${Address1}" />
<c: set var="City" value="${currentRow.City}" />
<c: set var="State" value="${currentRow.State}" />
<c: set var="Zip" value="${currentRow.Zip}" />
<c: set var="Phone" value="${currentRow.Phone}" />
<c: out value="${currentRow.Phone}" /> // printing out to see if I am getting the values right or not .....and they show the right values
<c: out value="${Phone}" />
</c :forEach>

But when I try to do the following
<TR>
<TD ALIGN=RIGHT>Phone </TD>
<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME="Phone" size="14" value=<c: out value="${Phone}"/> ></TD>
</TR>

instead of giving me (123) 456-7890 it shows only (123) in the INput text box.

Can anyone please tell me the reason why or How do I fix it.

I have also printed out the value like this <TD ALIGN=RIGHT>Phone <c: out value="${Phone}"/> </TD>

and it did give the right value next to the Phone text but not in the Input box

Thanks in Advance

11 years ago
JSP