This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Collecting Values from remove div

 
Ram Mandavkar
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am New o struts 2,
I am using remove div method to populate search result into a table with struts tag checkbox, I can able to traverse through search result with four link ( FIRST, NEXT, PRIVIOUS, LAST )
In my action class I am getting null pointer exception (java.lang.NullPointerException)at
for (Iterator<String> iterator = isSelectedData.iterator(); iterator.hasNext();)
While collecting checked values from Remotediv.jsp

I did not understand why this exception is coming
And
How to access values from remove div where a nex jsp is getting render which is pare of Index.JSP.

index.jsp

<table>
<td>
<s:url id="url" action="Searchresult" method="next"/>
<s:a theme="ajax" targets="two" href="%{url}" ><b>First</b>
</s:a>
</td>
</table>
<div id="two" style="border: 1px solid yellow;width:823px;height:350px;">
</div>

Config file

<action name="Searchresult" class="remotemonitor.userpreset.SearchResultAction" >
<result name="success">/jsp/remotemonitor/userpreset/SearchResult.jsp</result>
</action>

SearchResultAction.java Actionclass

private ArrayList<String> isSelectedData;
private List<SearchResultDAO> searchResultDAO;

public String next() throws Exception{
for (Iterator<String> iterator = isSelectedData.iterator(); iterator.hasNext();) {
String key = iterator.next();
if(key.equals("false")){
break;
}
System.out.println("Selected : "+ key);
}
setSearchResultDAO((List<SearchResultDAO>) new ArrayList());
for( int j=11;j<=20;j++ ){
SearchResultDAO Data_List = new SearchResultDAO();
Data_List.setPresetid(""+j);
Data_List.setPresetnm( "ROW"+j );
Data_List.setChecked(false);
getSearchResultDAO().add( Data_List );
}
}

public ArrayList<String> IsSelectedData() {
return isSelectedData;
}
public void setIsSelectedData(ArrayList<String> isSelectedData) {
this.isSelectedData=isSelectedData;
}
}

Remotediv.jsp

<table width="50%" border="1">
<s:iterator value="searchResultDAO">
<tr class='fieldsetfont'>
<td width="9%" align="center" bgcolor="#6389A0" class="frontValid11">
<s:checkbox labelposition="right" name=" isSelectedData"
label="%{presetnm}" value="%{presetCheck}" fieldValue="%{presetid}"/>
</td>
<td width="19%" align="center" bgcolor="#6389A0" class="frontValid11">
<s:a theme="simple" href="UserPreset.action?presetid=%{presetid}">
<s:property value="presetid" />
</s:a>
</td>
<td width="68%" align="center" bgcolor="#6389A0" class="frontValid11"> <s:property value="presetnm" />
</td>
</tr>
</s:iterator>
</table>
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see a form or JavaScript submission anywhere; how are you sending the checkboxes to the action?
 
Ram Mandavkar
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:I don't see a form or JavaScript submission anywhere; how are you sending the checkboxes to the action?


I was bit delayed.


 
Ram Mandavkar
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As shown in index.jsp ( form tag is missing in above code but it is there in my code
<s:form id='theForm2' theme="ajax" > )

‘FIRST ‘ is the link with action="Searchresult" method="next" theme="ajax"
If I click on ‘FIRST’ link then ‘Searchresult’ action will get called and index.jsp page is submitted and result jsp page (Remotediv.jsp) will get render into index.jsp as <div id="two"/>

How to send the checkboxes from Remotediv.jsp(Which are not part of index.jsp) page to the action(Searchresult)?
or
So how to access remote page(Remotediv.jsp) elements which is part of main page(index.jsp) as DIV.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic